Can I resume the Maven life cycle from an arbitrary phase?

I would like to convince Maven to "continue where he left off." First I create an mvn package to create the package. Later, I can continue the life cycle to perform an integration test, etc. by Running mvn install . In this case, I would prefer that Maven does not start the life cycle from the very beginning, but actually resumes in the first phase after package (i.e. pre-integration-test ). Is it possible to start the life cycle in a phase other than the first?

+5
source share
1 answer

AFAIK, there are no built-in functions that support this. You can, however, do the following:

Replace all target bindings before (but excluding) the estimated initial phase that comes from:

  • default-bindings.xml
  • <build>/<plugins>/<plugin> sections of the current and all parent POMs (check with mvn help:effective-pom )

in profile , for example:

 <profiles> <profile> <id>resume-at-pre-int-test</id> <build> <plugins> <plugin> <groupId>com.soebes.maven.plugins</groupId> <artifactId>maven-echo-plugin</artifactId> <version>0.1</version> <executions> <execution> <id>skip-process-resources</id> <phase>process-resources</phase> <goals> <goal>echo</goal> </goals> </execution> </executions> <configuration> <echos> <echo>Default plugin:goal binding for process-resources phase overridden</echo> </echos> </configuration> </plugin> <plugin> ... </plugin> ... </plugins> </build> </profile> </profiles> 

Activate it with mvn install -P resume-at-pre-int-test .

+2
source

All Articles