Thursday, July 2, 2009

Installing the "photo carousel" jar using Maven 2

The Photo Carousel is one of the cool GWT widget that our team (Jordan Beck and Brandon Wong) developed, check it out:

Using Maven2 to manage dependencies is important for large teams and large number of dependencies, with source control system.
If you work alone, just copy the jar in the lib folder.

1. Download the latest jar from:

2. Open Terminal and cd to your download location

3. Add dependency to your pom.xml

Using Terminal:
~/Downloads $ mvn install:install-file -DgroupId=com.reveregroup.gwt -DartifactId=gwt-photo-carousel-with-drawer -Dversion=1.0.0 -Dpackaging=jar -Dfile=carousel.jar

<dependency>
<groupId>com.reveregroup.gwt</groupId>
<artifactId>gwt-photo-carousel-with-drawer</artifactId>
<version>1.0.0</version>
</dependency>

Using Eclipse:


4. Run Ant task "copy_jars" to get jars into the war:

<target name="copy_jars" depends="x_copy_filtered_resources">
<delete dir="${GOOGLE_WAR}\\WEB-INF\\lib" />
<copy todir="${GOOGLE_WAR}\\WEB-INF\\lib">
<fileset dir="${MAVEN_TARGET}\\dependency" />
</copy>
</target>
<target name="x_copy_filtered_resources" depends="x_maven_filter_copy_dependencies">
<copy todir="${GOOGLE_SRC}">
<fileset dir="${MAVEN_TARGET}\\classes" />
</copy>
</target>
<target name="x_maven_filter_copy_dependencies">
<echo>Maven Executable: ${MAVEN_EXEC}</echo>
<exec taskname="mvn war" dir="${basedir}"
executable="${MAVEN_EXEC}">
<arg line="clean resources:resources dependency:copy-dependencies -Dtarget=${TARGET}" />
</exec>
<delete file=".\\target\\csd.war" />
</target>

5. Verify results:

6. Add jars to your project classpath: