Monday, July 6, 2009

Installing facebook4GWT using Maven2 and Ant

1) Download the newest (facebook4gwt-1.0.4.jar) from:


2) In Terminal change directory to your download location

3) Install the jar in your local Maven2 REPO:

mvn install:install-file -DgroupId=com.reveregroup.gwt -DartifactId=facebook4gwt -Dversion=1.0.4 -Dpackaging=jar -Dfile=facebook4gwt-1.0.4.jar

4) Verify that the jar is installed correctly:

uki@Uki:~/.m2/repository/com/reveregroup/gwt/facebook4gwt/1.0.4 $ ls
facebook4gwt-1.0.4.jar

5) Update your pom.xml (Maven2) with the dependency:

<dependency>
<groupId>com.reveregroup.gwt</groupId>
<artifactId>facebook4gwt</artifactId>
<version>1.0.4</version>
</dependency>

6) Run Ant (build.xml) to bring the jars to your project:

       <target name="copy_maven_jars_filtered_resources">
<echo>Maven Executable: ${MAVEN_EXEC}</echo>
<!-- resources:resources filters the files in the resources directory and copies them to target/classes -->
<!-- dependency:copy-dependencies copies the dependencies to the target/dependency folder -->
<exec taskname="mvn war" dir="${basedir}"
executable="${MAVEN_EXEC}">
<arg line="clean resources:resources dependency:copy-dependencies -Dtarget=${TARGET}" />
</exec>
<delete dir="${GOOGLE_WAR}\\WEB-INF\\lib" />
<!-- copy the maven depenecies to the war/WEB-INF/lib folder -->
<copy todir="${GOOGLE_WAR}\\WEB-INF\\lib">
<fileset dir="${MAVEN_TARGET}\\dependency" />
</copy>
<!-- copy the filtered resources to the src folder -->
<copy todir="${GOOGLE_SRC}">
<fileset dir="${MAVEN_TARGET}\\classes" />
</copy>
</target>

7) Use the facebook4gwt API and send us the feedback