You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brad Szabo <bs...@unicon.net> on 2007/03/07 03:10:18 UTC

[Maven2] xmlbeans-maven-plugin Issue -- StAX transitive dependencies

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [Maven2] xmlbeans-maven-plugin Issue -- StAX transitive dependencies

Posted by Jörg Schaible <jo...@gmx.de>.
Jim Bethancourt wrote:

> Hi Brad,
> I had run into the same issue that you described and added multiple
> dependencies and then StAX 1.2.0 to the dependency list and it the
> XMLBeans
> plugin worked for me as well.  Unfortunately I am only slightly familiar
> with the nearness algorithm, so unfortunately I can't help you there.
> Although I can't be of any help, I wanted to give a +1 to the fact that
> you're not alone in your confusion of what's going on in this case. 
> Perhaps the best solution would be to ask the XMLBeans plugin folks to
> update the XMLBeans plugin to use StAX 1.2.0

The plugin is hosted in teh Mojo project at Codehaus. Vote for it:
http://jira.codehaus.org/browse/MOJO-687

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [Maven2] xmlbeans-maven-plugin Issue -- StAX transitive dependencies

Posted by Jim Bethancourt <ji...@gmail.com>.
Hi Brad,
I had run into the same issue that you described and added multiple
dependencies and then StAX 1.2.0 to the dependency list and it the XMLBeans
plugin worked for me as well.  Unfortunately I am only slightly familiar
with the nearness algorithm, so unfortunately I can't help you there.
Although I can't be of any help, I wanted to give a +1 to the fact that
you're not alone in your confusion of what's going on in this case.  Perhaps
the best solution would be to ask the XMLBeans plugin folks to update the
XMLBeans plugin to use StAX 1.2.0

Cheers,
Jim

On 3/6/07, Brad Szabo <bs...@unicon.net> wrote:
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>