Axis2, Maven, and java.net woes and why Maven sucks

By | June 15, 2010

I had some interesting problems trying to use the Axis2’s Maven plugin (1.5.1) for generating java code from a WSLD. Here’s what I did to get it working.

First thing’s first I had to define the plugin in my POM:

[xml]
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2code</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.ashlux.myproject</packageName>
<wsdlFile>src/main/wsdl/myproject.wsdl</wsdlFile>
<databindingName>adb</databindingName>
</configuration>
</plugin>
[/xml]

And don’t forget the necessary Axis2 dependencies:

[xml]
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>1.2.8</version>
</dependency>
[/xml]

That’s more dependencies than I’d want to specify (can’t I just get axiom and wsdl4j transitively?) but otherwise so far so good. Here’s were things took a turn for the worst:

$ mvn clean install
[INFO] Scanning for projects…
[INFO] ————————————————————————
[INFO] Building Rally Java API
[INFO] task-segment: [clean, install]
[INFO] ————————————————————————
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/10/maven-plugins-10.pom

Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/7/maven-parent-7.pom

Downloading: http://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.jar

Downloading: http://repo1.maven.org/maven2/org/apache/axis2/axis2-wsdl2code-maven-plugin/1.5.1/axis2-wsdl2code-maven-plugin-1.5.1.pom

Downloading: http://repo1.maven.org/maven2/org/apache/axis2/axis2-parent/1.5.1/axis2-parent-1.5.1.pom

Downloading: http://ws.zones.apache.org/repository2/org/apache/apache/3/apache-3.pom
[INFO] Unable to find resource ‘org.apache:apache:pom:3′ in repository apache-ws-snapshots2 (http://ws.zones.apache.org/repository2)
Downloading: http://tomcat.apache.org/dev/dist/m2-repository/org/apache/apache/3/apache-3.pom
[INFO] Unable to find resource ‘org.apache:apache:pom:3′ in repository tomcat-repository (http://tomcat.apache.org/dev/dist/m2-repository)
Downloading: http://repo1.maven.org/eclipse/org/apache/apache/3/apache-3.pom
[INFO] Unable to find resource ‘org.apache:apache:pom:3′ in repository eclipse-repo (http://repo1.maven.org/eclipse)
Downloading: https://maven-repository.dev.java.net/nonav/repository//org.apache/poms/apache-3.pom
349b downloaded (apache-3.pom)
[WARNING] *** CHECKSUM FAILED – Checksum failed on download: local = ‘0f56ee033ef4b78d33722aceb71a09c7ed68183f'; remote = ‘

Uh oh, clearly org.apache:apache:pom:3 does exist, so what went wrong? This portion of the Maven output is suspicious:

[WARNING] *** CHECKSUM FAILED – Checksum failed on download: local = ‘0f56ee033ef4b78d33722aceb71a09c7ed68183f'; remote = ‘

That is some checksum coming from https://maven-repository.dev.java.net/nonav/repository, definitely can’t be right! The culprit lies in org.apache.axis2:axis2-parent:1.5.1:

[xml]
<repository>
<id>java.net</id>
<url>https://maven-repository.dev.java.net/nonav/repository/</url>
<layout>legacy</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
[/xml]

The problem is Maven does not support permanent redirects (301). There are several workarounds, from modifying your local repository to adding a mirror for java.net for your settings.xml, none of which I find appropriate since builds are unnecessarily broken for new developers. I chose the settings.xml since I think it’s the cleanest out of all of them:

[xml]
<settings>

<mirrors>

<mirror>
<id>java.net.2</id>
<name>java.net Mirror of http://repo1.maven.org/maven2/</name>
<url>http://download.java.net/maven/2/</url>
<mirrorOf>java.net</mirrorOf>
</mirror>
</mirrors>
</settings>
[/xml]

Times like this I think we’d be better off we “all made a big mistake in coming down from the trees in the first place.” I heard some guys on the Java Posse arguing arguing that “even the trees had been a bad move, and that no one should ever have left the oceans.”

One thought on “Axis2, Maven, and java.net woes and why Maven sucks

Leave a Reply

Your email address will not be published. Required fields are marked *