Reputation: 22292
In a project I'm working on, we discovered Oracle coherence product was used by our EAR as a compile
dependency. This triggered weird classpath issues that have been detected and coherence is now a provided
dependency.
However, I would like to make sure nobody ever do again the mistake of using, directly or not, coherence as a compile
. So, is there any maven plugin/solution which, given a set of dependency constraints, will make sure all maven modules enforce these constraints ?
Upvotes: 3
Views: 424
Reputation: 97399
You should take a deep look at the maven-enforcer-plugin which supports exactly such things.
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>com.xyz:abc:*:jar:compile</exclude>
<exclude>com.xyz:abc:*:jar:runtime</exclude>
<exclude>com.xyz:abc:*:jar:test</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>
Upvotes: 5