Hey everyone,
I am having a terrible time with xmlbeans-maven-plugin and transitive
StAX issues relating to xmlbeans-jsr173-api.jar.
I am using Maven 2.0.5.
The error Maven is throwing is that it cannot find the
xmlbeans-jsr173-api.jar. I know this jar does not exist in a public
repository and that the stax-api.jar needs to be used instead. I am
trying to do that, but things are not working out.
The start of the problem is that xmlbeans-maven-plugin-2.0 has a
dependency on stax-1.1.1-dev.jar, which has a subsequent dependency on
xmlbeans-jsr173-api.jar. Even though the xmlbeans-maven-plugin-2.0 POM
specifically excludes xmlbeans-jsr173-api.jar from the stax-1.1.1-dev
declaration, my build is still trying to resolve it. This is obviously a
bug in itself, but I am trying to work around it.
I am trying to override the StAX version in the xmlbeans-maven-plugin
dependency section to be 1.2.0, but I am getting inconsistent results on
my box. Somehow, the 1.1.1-dev version is still getting into the
resolution mix and being resolved first. My attempt to override the
version to 1.2.0 does not appear to work. Is this broken, or am I wrong
about the ability to override plugin dependencies? It appears that the
dependency I declare is just being added, not actually overriding the
one declared in the xmlbeans-maven-plugin POM. Can someone please
clarify if this is by design or a bug.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>xmlbeans</goal>
</goals>
</execution>
</executions>
<dependencies>
<!-- Adding version 1.2.0 in attempt to avoid
transitive dependency on xmlbeans-jsr173-api -->
<dependency>
<groupId>stax</groupId>
<artifactId>stax</artifactId>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
Now it would appear that I am getting involved with the nearness
algorithm for determining which version of a dependency
is resolved when two exist at the same depth in the dependency graph.
This was supposed to be fixed for Maven 2.0.5 in MNG-2794 so that the
version encountered first gets resolved.
My next question is, how do you determine or influence which version
gets "encountered" first? Is it based upon declaration order in the POM?
If so, why does it not work if I add the stax-1.2.0.jar dependency to a
plugin declared before xmlbeans-maven-plugin in my pom.xml?
I have also tried to explicitly declare the stax-1.2.0.jar as a direct
dependency in my POM. That does not work either!
Do plugin dependencies trump all others including locally declared
dependencies?
Now for the really funky part... if I add a few dependencies to the POM,
all of a sudden the stax-1.2.0.jar does get resolved first. The jars to
the best of my knowledge do not declare any dependencies on StAX. I
tested it out with several different sets of unrelated jars. I could
consistently get the build to work after adding 5 or 6 more seemingly
random jars to my dependency list.
I am at a loss. How can I avoid a transitive dependency declared in a
plugin aside from modifying the plugin's pom.xml and making it available
locally?
Any help and clarification will be greatly appreciated!
Thanks,
-Brad
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]