Thursday Jul 10, 2008
Using maven to build your project is a fantastic for managing your dependencies and avoiding having dependencies (and their dependencies) checked into your own svn. The only fly in the ointment, is projects that don't publish maven artifacts, and the Ajax dojo toolkit has been one of these. Until now that is !
I have added a maven build to dojo and created maven repositories for snapshots and releases at:
I have added a maven build to dojo and created maven repositories for snapshots and releases at:
These repositories contain artifacts for:
- dojo toolkit release as a zip, tar.gz and tar.bz2
- dojo toolkit packaged as a java war file ready to serve. The war includes a filter that sets the Cache-Control header to encourage browser caching.
- cometd artifacts for java API and cometd example war
However, if you are a "from first principals" type, then to checkout and build dojo is now as simple as:
svn co http://svn.dojotoolkit.org/src/view/anon/all/trunk dojo
cd dojo/util/maven
mvn
This will build the standard dojo release and package it as a zip, a tar.gz and tar.gz2 and make them available in your local repository. The groupId is org.dojotoolkit and the artifactId is dojo. The following incantation of the maven dependency plugin will download and unpack these artifacts into your maven project:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack dojo</id>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/dojo</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Along with the build of the dojo release artifacts, dojo is also packaged as a war file with groupId org.dojotoolkit and artifactId dojo-war. The war produced by this can be directly deployed and used by other web applications on the same server (there is no requirement for js to be served from the same war as your application). Alternately, this war can be used as an overlay by the maven war plugin and merged with your own war project:
<project xmlns="...">
<modelVersion>4.0.0</modelVersion>
<groupId>vom.acme</groupId>
<artifactId>myproject</artifactId>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay></overlay>
<overlay>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo-war</artifactId>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.dojotoolkit</groupId>
<artifactId>dojo-war</artifactId>
<version>1.2-SNAPSHOT</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Currently only snapshot releases have been deployed to the repository (1.2-SNAPSHOT). Once we have some feedback that this is working OK, I will deploy a retrospective dojo 1.1.1 release and organize for that to be mirrored to the central maven repositories. Until that time, you can access the dojo repositories directly with the following incantation in your pom.xml:
<repositories>
<repository>
<id>dojo</id>
<name>Dojo Maven2 Repository</name>
<url>http://download.dojotoolkit.org/maven2</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<layout>default</layout>
</repository>
<repository>
<id>dojoSnapshots</id>
<name>Dojo Maven2 Snapshot Repository</name>
<url>http://download.dojotoolkit.org/maven2-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<layout>default</layout>
</repository>
</repositories>
I am now using these artifacts to better mavenize the cometd project and it's examples. Feedback on the repositories and the packaging is most welcome.
Posted at 10:42PM Jul 10, 2008 by gregw in General | Comments[9]
is there rsync over ssh available at the server to sync the releases to maven central?
Posted by Carlos Sanchez on July 11, 2008 at 09:27 AM EST #
The machine is definitely capable, but I'll have to check with the dojo infrastructure guys if it is permissible to setup an rsync account.
cheers
Posted by Greg Wilkins on July 11, 2008 at 01:12 PM EST #
Posted by Brett Porter on July 11, 2008 at 08:34 PM EST #
Posted by Greg Wilkins on July 12, 2008 at 12:24 AM EST #
Posted by Lars Trieloff on July 13, 2008 at 05:08 AM EST #
Posted by Brian DUpras on July 13, 2008 at 05:59 PM EST #
Posted by Mikael FS on August 07, 2008 at 06:05 AM EST #
Don't know if you've found it yet, but the cometd package is available here:
http://svn.codehaus.org/jetty-contrib/branches/jetty-6.1.x/contrib/
That should also be available in the jetty6 distribution zip, or pulled in automatically (as an external module) if you did an svn checkout of http://svn.codehaus.org/jetty/jetty/branches/jetty-6.1/.
Posted by Athena on August 11, 2008 at 06:36 PM EST #
Posted by Joel on December 20, 2008 at 01:06 PM EST #