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?
Asked
Active
Viewed 1,658 times
10

Rinke
- 6,095
- 4
- 38
- 55
-
1I don't think you can do that. [See also this mail](http://maven.40175.n5.nabble.com/Execute-only-a-specific-phase-td103134.html). – Tunaki Jun 30 '16 at 10:20
-
i know that mvn install do: "validate", "compile", "package" and "verify" before doing the "install", so, actually i don't know if is possible tho override this, cause overwrite this setting should be the only way – RudiDudi Jun 30 '16 at 10:27
1 Answers
2
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 withmvn 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
.

Gerold Broser
- 14,080
- 5
- 48
- 107
-
-
-
@Rinke Just an idea: According to [this answer](http://stackoverflow.com/a/30953905/1744774) you can try to tweak `
/lib/maven-core-x.y.z.jar/META-INF/plexus/default-bindings.xml` accordingly, but I haven't tried this myself yet. – Gerold Broser Jun 30 '16 at 12:55