Maven3: replace transitive dependency of a direct dependency in dependency management
Tag : java , By : Keonne Rodriguez
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further No, it's not possible. However, you can use dependency . Furthermore, as a top-level dependency, you can define groovy-all. The article you linked to illustrates the following as a solution: <dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>1.8.0</version>
<exclusions>
<!-- Exclude Groovy because of classpath issue -->
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<!-- Needs to be the same version that
REST Assured depends on -->
<version>2.1.2</version>
<scope>test</scope>
</dependency>
|
Gradle cannot resolve transitive dependency, but direct dependency works
Date : March 29 2020, 07:55 AM
To fix this issue While Peter provided useful insight and the final hint ( RTFM), he did not post the solution, so here it comes: dependencies {
testCompile "com.foo:lib-foo:2.0.0-SNAPSHOT"
testCompile("com.foo:lib-bar:2.0.2-SNAPSHOT") {
transitive = false
}
}
|
Maven transitive dependency has scope compile while when dependency has provided scope
Date : March 29 2020, 07:55 AM
To fix this issue In my project I have openejb-core dependency with scope provided. However it has transitive dependency of slf4j and its scope is compile (see screenshot). All other transitive dependencies are provided as expected. , In a sample pom I added: <dependencies>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
mvn dependency:tree -Dincludes=org.slf4j
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test-junit ---
[INFO] com.sample:test-sample:jar:0.0.1-SNAPSHOT
[INFO] \- org.apache.openejb:openejb-core:jar:4.7.0:provided
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.7.7:provided
[INFO] \- org.slf4j:slf4j-api:jar:1.7.7:provided
<dependencies>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>4.7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
</dependencies>
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test-junit ---
[INFO] com.sample:test-sample:jar:0.0.1-SNAPSHOT
[INFO] +- org.apache.openejb:openejb-core:jar:4.7.0:provided
[INFO] | \- org.slf4j:slf4j-jdk14:jar:1.7.7:provided
[INFO] \- org.slf4j:slf4j-api:jar:1.7.7:compile
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test-junit ---
[INFO] com.sample:test-sample:jar:0.0.1-SNAPSHOT
[INFO] \- org.apache.openejb:openejb-core:jar:4.7.0:provided
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.7.7:provided
[INFO] \- org.slf4j:slf4j-api:jar:1.7.7:compile
|
Maven dependency scope vs Transitive dependency
Date : March 29 2020, 07:55 AM
may help you . They are not "present in the jar". Transitive dependencies of a jar are not bundled into the jar, unless you explicitly build a fat jar, e.g. with the assembly plugin or shade plugin. Fat jars, though, are not meant to be dependencies of other artifacts, they are only meant to be run standalone.
|
How to let maven resolve transitive dependency for local dependency
Date : March 29 2020, 07:55 AM
|