Is there a maven plugin that will verify conflicting versions of transitive dependencies, ensuring that I'm not depending on different versions of the same artifact?
Ideally I would hook into the compile
lifecycle, and it would fail the build if I'm importing both version X and Y of dependency A.
You can do it with maven-enforcer-plugin. Following configuration will cause a build to fail in case of conflicting versions:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
Here are more details:
http://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html