Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fail maven build if newer version of dependency exists in repository?

Well, the problem is that I want maven to check dependency version on build and warn me if there are any newer dependency versions (in fact - notify me if I use an outdated version of some module). My maven module A has the following dependency:

<dependency>
    <groupId>com.example.mycompany</groupId>
    <artifactId>commons</artifactId>
    <version>1.0.3</version>
</dependency>

And com.example.mycompany:commons module in fact can already have 1.0.4 version. Is there any way to check version of the dependency in repo and fail the build if newer version is already available.

I hope that versions-maven-plugin can make it. But I can not find appropriate configuration.

like image 597
revenforv Avatar asked Jul 04 '13 06:07

revenforv


1 Answers

This problem can be solved with the maven-enforcer-plugin. You have to create your own custom rule, because non of the standard rules seem to match your needs.

The notion of the rule you are going to implement should be enforce dependencies are up to date. To implement the check you could get some inspiration by the versions-maven-plugin you mention.

like image 186
SpaceTrucker Avatar answered Sep 27 '22 22:09

SpaceTrucker