In general, when you want the build to fail for some reason, a good plugin will consider the Maven Enforcer Plugin . This plugin can be configured with a set of rules that, during verification, will not be able to complete the assembly.
In this case, it should be a rule that checks for dependencies duplicates, and there are built-in rule: <banDuplicatePomDependencyVersions>. So you could
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-no-duplicate-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<banDuplicatePomDependencyVersions/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
Unfortunately, this rule is not documented (but it will be in the next version, see MENFORCER-259 ), but it has existed since version 1.3 of the plugin ( MENFORCER-152 ).
, , , 'dependencies.dependency.(groupId:artifactId:type:classifier)'; , POM, / .