Wednesday, November 11, 2009

Learning about Maven

I'm taking an opportunity to try to learn a little bit about Maven.

I actually started by first taking an opportunity to try to learn a little bit about jUDDI. I encountered a small problem with jUDDI, which was patched within hours by one of the jUDDI developers (thanks!).

But now I need to learn how to build jUDDI, in order to experiment with the patch. And jUDDI uses Maven as its build environment.

It's somewhat interesting that this is the first project I've worked with that has used Maven for its builds, since my understanding is that Maven is increasingly popular. But until now, I hadn't actually encountered it in my own usage.

I can build almost all of jUDDI using Maven. jUDDI has about half-a-dozen different subsystems, and I can build all but one of them individually. But when I go to build the "Tomcat package", I get a Maven build error:


[INFO] Failed to resolve artifact.

GroupId: org.apache.juddi
ArtifactId: juddi-parent
Version: 3.0.0.SNAPSHOT

Reason: Unable to download the artifact from any repository

org.apache.juddi:juddi-parent:pom:3.0.0.SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
apache (http://people.apache.org/repo/m2-ibiblio-rsync-repository),
maven2-repository.dev.java.net (http://download.java.net/maven/2),
maven-repository.dev.java.net (http://download.java.net/maven/1)


So far, I haven't figured this problem out, except that I know:

  • I get a similar problem on both the trunk, and on the 3.0.0-tagged branch

  • The jUDDI developers don't get this problem when they build

  • The juddi-parent subsystem is built successfully, and exists correctly in my local repository (under the .m2 folder



My current working theory is that the build scripts are expecting that Maven will fetch this already-built object from my local repository, but for some reason Maven is not looking in the local repository, and is only willing to look in remote repositories.

I've learned about running Maven with the -X flag, and I can see that, at what seems to be the critical point, Maven deliberates about where to look for the juddi-parent object:


[DEBUG] Retrieving parent-POM:
org.apache.juddi:juddi-parent:pom:3.0.0.SNAPSHOT
for project: org.apache.juddi.bootstrap:apache-tomcat:pom:6.0.20
from the repository.
[DEBUG] Skipping disabled repository central
[DEBUG] juddi-parent: using locally installed snapshot
[DEBUG] Trying repository maven2-repository.dev.java.net


It seems like "using locally installed snapshot" should mean that it found the built object in my .m2 local repository, but then why does it then proceed to start looking out on the net?

The next step, I guess, is to learn more about Maven's behavior by reading through the Maven docs, and the jUDDI pom.xml files, and trying to correlate them to the output of the -X build.

Slow going, but that's how learning occurs.

2 comments:

  1. Make sure you are using the right dependency XML. You can search a number of public repositories in the public instance of Nexus, here:

    http://repository.sonatype.org/index.html#nexus-search;quick~juddi

    Also, what is your email address?

    ReplyDelete
  2. I think that the only problem that you had was that they did not specify a default action in the pom.xml file.

    I just did a build (from the root of the juddi source directory) by running:

    mvn install

    ReplyDelete