Platinum Partner
css,frameworks,dojo,maven,integration,server-side

Dojo Toolkit Maven Repository

Using maven to build your project is a fantastic for managing your dependencies andavoiding having dependencies (and their dependencies) checked into yourown svn.  The only fly in the ointment, is projects that don't publishmaven 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:

These repositories contain artifacts for:

  • dojo toolkit release as a zip, tar.gz and tar.bz2

  • dojotoolkit packaged as a java war file ready to serve. The war includes afilter 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, atar.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 webapplications on the same server (there is no requirement for js to beserved from the same war as your application). Alternately, this warcan be used as an overlay by the maven war plugin and merged with yourown 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, Iwill deploy a retrospective dojo 1.1.1 release and organize for that tobe mirrored to the central maven repositories.   Until that time, youcan access the dojo repositories directly with the followingincantation in your pom.xml:

 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 projectand it's examples. Feedback on the repositories and the packaging ismost welcome.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}