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:

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 dojocd dojo/util/mavenmvn
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.
Dojo Toolkit Maven Repository

10 thoughts on “Dojo Toolkit Maven Repository

  • July 10, 2008 at 6:27 pm
    Permalink

    Nice, I was looking into this too and didn’t know you were a dojo committer 😉 i uploaded the last zip releases to central.
    is there rsync over ssh available at the server to sync the releases to maven central?

  • July 10, 2008 at 10:12 pm
    Permalink

    Hey Carlos,
    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

  • July 11, 2008 at 9:24 am
    Permalink

    Since published, the group/artifact ID for the war has changes from org.dojotoolkit.java/dojo to org.dojotoolkit/dojo-war

  • July 12, 2008 at 2:08 pm
    Permalink

    Cool, this will ease the build process for Apache Sling a bit. Currently we are pulling the ZIP files via Ant and verify the MD5 sum, but being able to use Maven is much easier. Thank you very much.

  • July 13, 2008 at 2:59 am
    Permalink

    Thanks for the great work – I’m using the war overlay of dojo, and it appears to work as advertised.

  • August 6, 2008 at 3:05 pm
    Permalink

    Hi Greg,
    Thank you for the great work.
    I have a question which is slightly different from the topic in this post.
    In Jetty 6.1.9, I find out that the bayeux load generator and org.mortbay.jetty.client are not included in the package. i’m now performing some tests with jetty and bayeux and will be very glad if i can find the missing files.

  • December 19, 2008 at 8:06 pm
    Permalink

    Thanks for making Dojo available via a Maven repo!
    It looks like the latest release available in the repo is 1.2.0, while the latest official Dojo release is 1.2.3. Is it possible a cron job that copies releases over to the repo broke?

  • July 13, 2010 at 1:36 am
    Permalink

    Hi,
    I cannot find the maven folder in dojo/util after checking out dojo with: svn co http://svn.dojotoolkit.org/src/view/anon/all/trunk dojo
    Did a search for “maven” in the download folder, and did not find anything. Is it me that is blind? 🙂
    Kindly regards,
    Lars Schlanbusch

Comments are closed.