This is a similar (but opposite) question to Can we start the maven build from the point where it failed: Am wondering if there is an option to stop the build at (or after) a particular project. Something like a --stop-after
option in the same vein as --resume-from
?
Use case: This would sometimes be a useful feature to me, e.g. to create a standalone JAR that is a dependency for other modules but has its own dependent modules that need to be built first:
/------Parent pom------\
| | |
Module 1 -> Module 2 -> Module 3
Here's a simplified example but illustrates the point: Let's say we have a parent pom.xml that lists modules 1, 2 and 3 that are each dependent on the next in that order. So to build Module 2, we need Module 1 to be built first. But we're only interested in building Module 2 and don't want to go any further once this has been done (Module 3 takes ages or does stuff we don't want to do e.g. rebuild the database). So here we'd want to run Maven from the parent director and both resume from and stop after Module 2.