mavensvnmaven-3buildnumber-maven-pluginmaven-enforcer-plugin

Maven stop build if svn is out of date


After reading through a lot of SO questions as well as other sites I still haven't been able to exactly address this problem.

We have a long build cycle (10-20 mins) because there are a lot of dependencies. It sometimes happens that you start a build with everything up do date, but while it's being done, someone pushes new changes to the remote svn.

I would like Maven to check on the validate and verify phases if svn is still up to date basically, on all dependent projects.

I've tried using the Enforcer plugin, and the Build number plugin with no success yet. The enforcer seems like it could do the trick, but I haven't figured out which rules to set. The build number plugin on the other hand checks if there are no local modifications, but I don't think it checks the remote changes.

I don't think the POM is very relevant to the question, but if anyone needs it, or some parts please let me know and I'll update with it.


Solution

  • I would try a combination of the maven-scm-plugin's diff goal and Enforcer.

    scm:diff may be configured to write output to a file. Run that when there are no changes and see how big the file is, or, if it generates the file at all if there are no changes. Then, use the Enforcer plugin's requireFilesDontExist and/or requireFileSize rules to make sure the scm:diff output file is the "no changes" size you determined. If it's larger than that, changes were committed during this build.