Reputation: 92120
I'm trying to fix the issue described here: http://www.jayway.com/2013/04/12/solving-asm-conflicts-after-upgrading-to-groovy-2-1/
I have one dependency (Swagger->Jersey) that uses ASM 3.2 and one RestAssured that requires Groovy that requires ASM 4.0.
The idea is to replace the dependency to groovy to a dependency groovy-all which does not depend on ASM 4.0 (the class packages seems here but have been renamed using jarjar).
Is it possible to tell maven, in dependency management of a parent pom, that whenever a child depends on RestAssured, it will thus load transitively the groovy-all dependency instead of the normal groovy dependency?
Thanks
The aim is that all childs only need:
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
</dependency>
Which retrieve groovy-all instead of groovy
And not
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>
Upvotes: 1
Views: 579
Reputation: 32597
No, it's not possible. However, you can use dependency <exclusions/>
. 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>
Upvotes: 1