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










1 comment:

  1. Hi,
    I'm using this library to integrate facebook in my application. I run into problems when I try to authenticate a user on the server side. In the code, I call Facebook.init(FB_API_KEY); and use the sample code here to get things started and I get an error Caused by: java.lang.NoClassDefFoundError: com/reveregroup/gwt/facebook4gwt/Facebook.
    I do have the jar file in the classpath and I know it works because If I implement the user logging in and out on the client, in the onModuleLoad() method it works fine.
    Is there an issue with running facebook4gwt on the server side or something I may have missed?

    Thanks.

    ReplyDelete