So I’m finding that the more I use Maven, the buggier I’m finding it to be, especially when building the same project using different Maven versions. Is this to be expected?
A couple of examples:
I have a .ear I’m deploying to JBoss. As I’m bringing in wsdls, xsds and generated classes brought in on the class path, I’m bring the .jar in as a dependency then unpacking it into the .ear. To do this I’m using the unpack dependencies goal. Looks something like this…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>unpack-wsimport</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>url.projectName</includeGroupIds>
<includeArtifactIds>projectName-wsimport</includeArtifactIds>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Using Maven 3.0.3 (Which is what the project was originally built in), this works fine. Switch over to Maven 2.0.9 and all of a sudden it doesn’t. On the Maven site it says this plugin has been supported since version 1.0, so why isn’t it working?
In the same vein, but vice versa, when I’m trying to do a maven release of this project, using Maven 2.0.9 will prepare and perform correctly, however 3.0.3 doesn’t copy across certain files when tagging a version in SVN.
Anyone else finding errors like this when switching between versions of Maven to build projects?
First it looks like you didn’t understand the maven way of doing things like an ear, cause within a EAR you have to add the dependencies which should be put into the EAR not via the dependency-plugin you have to use them as dependencies instead.
for Example:
but the better approach is to use the correct configuration for the maven-ear-plugin.
Based on the information you gave i would have expected to have a multi-module build which contains your different modules (like web-part, wsdl-part etc.) which will be packaged into an EAR. This would have resulted into a structure like the following:
Furthermore it looks like you need to look into the orginization of projects like multi-module projects. Here is an example of such kind. The documentation about Maven is a good way to start with and last but not least Maven by Example.
About your point of buggines i can’t acknowledge this, cause i’m working a long time with Maven in really large project (100 modules +)…Furthermore i would like to know where it’s stated that this plugin works with version 1.0.
Despite the fact that it doesn’t looke like that you read the release notes. There is large number of differences between the Maven versions in particular between Maven 2.0.X, 2.2.X and 3.0.X ..If you really need to run your build with differernt Maven version like 2.0, 2.2, and 3.0. This can be done and is working, but there are some drawbacks based on the technical detail in particular between 2.2.X and 3.0.X (reporting are). I would suggest to use only one Maven version to build your artifacts (currently 3.0.3/3.0.4). An other hint is that a Maven build which works for Maven 2/3 never will run with Maven 1, cause the POM has been changed dramatically.