I would like to convince Maven to "continue where it left off". I first do a mvn package
to build the package. At a later time I may want to continue the lifecycle to do the integration test etc. by doing a mvn install
. In this case I would prefer Maven not to start the lifecycle all over again from the start, but to actually resume at the first phase after package
(i.e. pre-integration-test
). Is it possible to start the lifecycle at a phase other than the first one?
AFAIK, there's no built-in functionality that supports this. You can, however do the following:
Overwrite all goal bindings up to (but excluding) the intended starting phase that come from:
default-bindings.xml
<build>/<plugins>/<plugin>
sections of the current and all parent POMs (check with mvn help:effective-pom
)in a profile like:
<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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With