Reputation: 11817
Given a <plugin>
element in a pom.xml
, how do I find the default phase that it binds to?
For example, I'd like to know which phase of the Maven lifecycle does the maven-war-plugin
gets executed.
Upvotes: 6
Views: 1011
Reputation: 596
I'm having a problem with the above-reply.
Here's a simple pom. It uses an annotation processor plugin, which is bound to generate-sources
by-default, since I didn't specify a <phase>
.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test-simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.0.5</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
mvn generate-resources
does indeed invoke the plugin...
$ mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test-simple 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-processor-plugin:2.0.5:process (default) @ test-simple ---
Yet scanning the output of mvn help:effective-pom
doesn't yield any clue to the default binding of this plugin.
$ mvn help:effective-pom |grep generate-sources; echo $?
1
The only way I've so-far found to list default phase binding is by examining plugin source.
Upvotes: 4
Reputation: 128749
The best way to see what's really happening in your project along those lines is with mvn help:effective-pom
. It doesn't just show the defaults; it shows what actually is according to your current pom.
Upvotes: 7