You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rimvydas Vaidelis <ri...@gmail.com> on 2022/04/12 10:59:50 UTC
Compile classpath in case of dependency conflict
Hello,
I have 2 dependencies org.reflections:reflections:jar:0.9.8:test and
com.google.inject:guice:jar:5.1.0:compile.
org.reflections:reflections:jar:0.9.8 uses
com.google.guava:guava:jar:11.0.2:compile
com.google.inject:guice:jar:5.1.0 uses
com.google.guava:guava:30.1-jre:compile
During compiling of the module (mvn compile) the compile classpath contains
guava-11.0.2.jar. Why? It seems
that occurrence of version conflict changes the scope of the transitive
dependency com.google.guava:guava:jar:11.0.2 to compile.
Is this an expected behavior?
Dependency tree:
org.example:dependency-conflict-example:jar:1.0-SNAPSHOT
+- org.reflections:reflections:jar:0.9.8:test
| +- com.google.guava:guava:jar:11.0.2:compile
| | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
| +- javassist:javassist:jar:3.12.1.GA:test
| \- dom4j:dom4j:jar:1.6.1:test
\- com.google.inject:guice:jar:5.1.0:compile
+- javax.inject:javax.inject:jar:1:compile
\- aopalliance:aopalliance:jar:1.0:compile
pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>dependency-conflict-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>5.1.0</version>
</dependency>
</dependencies>
</project>
--
Rimvydas
Re: Compile classpath in case of dependency conflict
Posted by Alexander Kriegisch <Al...@Kriegisch.name>.
I recommend taking control of the situation by yourself, specifying the desired version in your *dependencyManagement* section.-- Alexander Kriegisch
-------- Ursprüngliche Nachricht --------Von: Rimvydas Vaidelis <ri...@gmail.com> Datum: 12.04.22 21:20 (GMT+07:00) An: Maven Users List <us...@maven.apache.org> Betreff: Re: Compile classpath in case of dependency conflict Hello Tamas,Thank you for the reply.Reordering of dependencies includes guava-30.1-jre.jar into compileclasspath.Dependency tree:org.example:dependency-conflict-example:jar:1.0-SNAPSHOT+- com.google.inject:guice:jar:5.1.0:compile| +- javax.inject:javax.inject:jar:1:compile| +- aopalliance:aopalliance:jar:1.0:compile| \- com.google.guava:guava:jar:30.1-jre:compile| +- com.google.guava:failureaccess:jar:1.0.1:compile| +-com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile| +- com.google.code.findbugs:jsr305:jar:3.0.2:compile| +- org.checkerframework:checker-qual:jar:3.5.0:compile| +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile| \- com.google.j2objc:j2objc-annotations:jar:1.3:compile\- org.reflections:reflections:jar:0.9.8:test +- javassist:javassist:jar:3.12.1.GA:test \- dom4j:dom4j:jar:1.6.1:test--RimvydasOn Tue, Apr 12, 2022 at 3:11 PM Tamás Cservenák <ta...@cservenak.net> wrote:> Howdy,>> seems is "known issue" https://issues.apache.org/jira/browse/MNG-6224>> what happens if you reorder your dependencies in pom, first compile and> then test scoped ones?>> HTH> T>> On Tue, Apr 12, 2022 at 1:00 PM Rimvydas Vaidelis <> rimvydas.vaidelis@gmail.com> wrote:>> > Hello,> >> > I have 2 dependencies org.reflections:reflections:jar:0.9.8:test and> > com.google.inject:guice:jar:5.1.0:compile.> > org.reflections:reflections:jar:0.9.8 uses> > com.google.guava:guava:jar:11.0.2:compile> > com.google.inject:guice:jar:5.1.0 uses> > com.google.guava:guava:30.1-jre:compile> >> > During compiling of the module (mvn compile) the compile classpath> contains> > guava-11.0.2.jar. Why? It seems> > that occurrence of version conflict changes the scope of the transitive> > dependency com.google.guava:guava:jar:11.0.2 to compile.> > Is this an expected behavior?> >> > Dependency tree:> >> > org.example:dependency-conflict-example:jar:1.0-SNAPSHOT> > +- org.reflections:reflections:jar:0.9.8:test> > | +- com.google.guava:guava:jar:11.0.2:compile> > | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile> > | +- javassist:javassist:jar:3.12.1.GA:test> > | \- dom4j:dom4j:jar:1.6.1:test> > \- com.google.inject:guice:jar:5.1.0:compile> > +- javax.inject:javax.inject:jar:1:compile> > \- aopalliance:aopalliance:jar:1.0:compile> >> > pom.xml file:> >> > <?xml version="1.0" encoding="UTF-8"?>> > <project xmlns="http://maven.apache.org/POM/4.0.0"> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0> > http://maven.apache.org/xsd/maven-4.0.0.xsd">> > <modelVersion>4.0.0</modelVersion>> >> > <groupId>org.example</groupId>> > <artifactId>dependency-conflict-example</artifactId>> > <version>1.0-SNAPSHOT</version>> >> > <properties>> > <maven.compiler.source>11</maven.compiler.source>> > <maven.compiler.target>11</maven.compiler.target>> > </properties>> >> > <dependencies>> > <dependency>> > <groupId>org.reflections</groupId>> > <artifactId>reflections</artifactId>> > <version>0.9.8</version>> > <scope>test</scope>> > </dependency>> > <dependency>> > <groupId>com.google.inject</groupId>> > <artifactId>guice</artifactId>> > <version>5.1.0</version>> > </dependency>> > </dependencies>> > </project>> >> > --> > Rimvydas> >>
Re: Compile classpath in case of dependency conflict
Posted by Rimvydas Vaidelis <ri...@gmail.com>.
Hello Tamas,
Thank you for the reply.
Reordering of dependencies includes guava-30.1-jre.jar into compile
classpath.
Dependency tree:
org.example:dependency-conflict-example:jar:1.0-SNAPSHOT
+- com.google.inject:guice:jar:5.1.0:compile
| +- javax.inject:javax.inject:jar:1:compile
| +- aopalliance:aopalliance:jar:1.0:compile
| \- com.google.guava:guava:jar:30.1-jre:compile
| +- com.google.guava:failureaccess:jar:1.0.1:compile
| +-
com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile
| +- com.google.code.findbugs:jsr305:jar:3.0.2:compile
| +- org.checkerframework:checker-qual:jar:3.5.0:compile
| +- com.google.errorprone:error_prone_annotations:jar:2.3.4:compile
| \- com.google.j2objc:j2objc-annotations:jar:1.3:compile
\- org.reflections:reflections:jar:0.9.8:test
+- javassist:javassist:jar:3.12.1.GA:test
\- dom4j:dom4j:jar:1.6.1:test
--
Rimvydas
On Tue, Apr 12, 2022 at 3:11 PM Tamás Cservenák <ta...@cservenak.net> wrote:
> Howdy,
>
> seems is "known issue" https://issues.apache.org/jira/browse/MNG-6224
>
> what happens if you reorder your dependencies in pom, first compile and
> then test scoped ones?
>
> HTH
> T
>
> On Tue, Apr 12, 2022 at 1:00 PM Rimvydas Vaidelis <
> rimvydas.vaidelis@gmail.com> wrote:
>
> > Hello,
> >
> > I have 2 dependencies org.reflections:reflections:jar:0.9.8:test and
> > com.google.inject:guice:jar:5.1.0:compile.
> > org.reflections:reflections:jar:0.9.8 uses
> > com.google.guava:guava:jar:11.0.2:compile
> > com.google.inject:guice:jar:5.1.0 uses
> > com.google.guava:guava:30.1-jre:compile
> >
> > During compiling of the module (mvn compile) the compile classpath
> contains
> > guava-11.0.2.jar. Why? It seems
> > that occurrence of version conflict changes the scope of the transitive
> > dependency com.google.guava:guava:jar:11.0.2 to compile.
> > Is this an expected behavior?
> >
> > Dependency tree:
> >
> > org.example:dependency-conflict-example:jar:1.0-SNAPSHOT
> > +- org.reflections:reflections:jar:0.9.8:test
> > | +- com.google.guava:guava:jar:11.0.2:compile
> > | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
> > | +- javassist:javassist:jar:3.12.1.GA:test
> > | \- dom4j:dom4j:jar:1.6.1:test
> > \- com.google.inject:guice:jar:5.1.0:compile
> > +- javax.inject:javax.inject:jar:1:compile
> > \- aopalliance:aopalliance:jar:1.0:compile
> >
> > pom.xml file:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/xsd/maven-4.0.0.xsd">
> > <modelVersion>4.0.0</modelVersion>
> >
> > <groupId>org.example</groupId>
> > <artifactId>dependency-conflict-example</artifactId>
> > <version>1.0-SNAPSHOT</version>
> >
> > <properties>
> > <maven.compiler.source>11</maven.compiler.source>
> > <maven.compiler.target>11</maven.compiler.target>
> > </properties>
> >
> > <dependencies>
> > <dependency>
> > <groupId>org.reflections</groupId>
> > <artifactId>reflections</artifactId>
> > <version>0.9.8</version>
> > <scope>test</scope>
> > </dependency>
> > <dependency>
> > <groupId>com.google.inject</groupId>
> > <artifactId>guice</artifactId>
> > <version>5.1.0</version>
> > </dependency>
> > </dependencies>
> > </project>
> >
> > --
> > Rimvydas
> >
>
Re: Compile classpath in case of dependency conflict
Posted by Tamás Cservenák <ta...@cservenak.net>.
Howdy,
seems is "known issue" https://issues.apache.org/jira/browse/MNG-6224
what happens if you reorder your dependencies in pom, first compile and
then test scoped ones?
HTH
T
On Tue, Apr 12, 2022 at 1:00 PM Rimvydas Vaidelis <
rimvydas.vaidelis@gmail.com> wrote:
> Hello,
>
> I have 2 dependencies org.reflections:reflections:jar:0.9.8:test and
> com.google.inject:guice:jar:5.1.0:compile.
> org.reflections:reflections:jar:0.9.8 uses
> com.google.guava:guava:jar:11.0.2:compile
> com.google.inject:guice:jar:5.1.0 uses
> com.google.guava:guava:30.1-jre:compile
>
> During compiling of the module (mvn compile) the compile classpath contains
> guava-11.0.2.jar. Why? It seems
> that occurrence of version conflict changes the scope of the transitive
> dependency com.google.guava:guava:jar:11.0.2 to compile.
> Is this an expected behavior?
>
> Dependency tree:
>
> org.example:dependency-conflict-example:jar:1.0-SNAPSHOT
> +- org.reflections:reflections:jar:0.9.8:test
> | +- com.google.guava:guava:jar:11.0.2:compile
> | | \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
> | +- javassist:javassist:jar:3.12.1.GA:test
> | \- dom4j:dom4j:jar:1.6.1:test
> \- com.google.inject:guice:jar:5.1.0:compile
> +- javax.inject:javax.inject:jar:1:compile
> \- aopalliance:aopalliance:jar:1.0:compile
>
> pom.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>org.example</groupId>
> <artifactId>dependency-conflict-example</artifactId>
> <version>1.0-SNAPSHOT</version>
>
> <properties>
> <maven.compiler.source>11</maven.compiler.source>
> <maven.compiler.target>11</maven.compiler.target>
> </properties>
>
> <dependencies>
> <dependency>
> <groupId>org.reflections</groupId>
> <artifactId>reflections</artifactId>
> <version>0.9.8</version>
> <scope>test</scope>
> </dependency>
> <dependency>
> <groupId>com.google.inject</groupId>
> <artifactId>guice</artifactId>
> <version>5.1.0</version>
> </dependency>
> </dependencies>
> </project>
>
> --
> Rimvydas
>