1

So I have a group of modules that are loosely coupled together in various ways to generate a plugin-architecture which changes from one pom to another in order to generate different artifacts.

Some artifacts will share the same dependencies though, so really I only want to run mvn install, and only if the project is out of date then it will rebuild. I'd like the same to be true for tests too. In other words, if the project is not out of date, then there is no reason to run tests because nothing was built. By virtue of it being in the remote repository (or locally in my .m2 because another project caused it to be built), then it would have already been built and had JUnit tests run so there is no reason to run them again.

Is there a way to make JUnits not run when a compilation does not occur?

searchengine27
  • 1,449
  • 11
  • 26
  • would this https://stackoverflow.com/questions/2902322/can-we-start-the-maven-build-from-the-point-where-it-failed suit your case? Mavens advanced reactor options allow to resume a build at a specific module. – wemu Sep 20 '19 at 14:29
  • I think you're thinking that I have a list of things written down somewhere, where I know which projects have already been built. I don't know which projects have been built, and the order that they may or may not be built is non-deterministic, so I cannot start a build from any specific point because I have no knowledge of where to start, or even how long it was since the last build. I will need to build all modules all the time, and I need maven know via my local .m2 and remote whether or not a project needs to be rebuilt - not me knowing. – searchengine27 Sep 20 '19 at 14:55
  • No. I assumed the modules that are rebuild are usually the same ones and you will continue a build more or less at the same modules. If thats not the case the closest I know is using Gradle (as it comes with a more precise caching mechanism - thats maven me telling you this, not to start a war here). The Gradle Enterprise Server also has a Maven Extension that does some caching for you: https://docs.gradle.com/enterprise/maven-extension/ (but this is commercial software) – wemu Sep 20 '19 at 17:13
  • Well the caching part isn't really my problem anyway. If I just run `maven install` and the local target area is up to date, then nothing is built. Which is great - that's what I want for a build. What I don't want is the JUnits to run when it detects a target area is up to date is all. – searchengine27 Sep 23 '19 at 13:20

0 Answers0