Maven exec plugin execution conundrum -
sample maven build file:
<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/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>test</groupid> <artifactid>test</artifactid> <version>1.0.0</version> <build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <executions> <execution> <id>my-validation-one</id> <phase>validate</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>echo</executable> <arguments> <argument>"my validation one"</argument> </arguments> </configuration> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <executions> <execution> <id>my-validation-two</id> <phase>validate</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>echo</executable> <arguments> <argument>"my validation two"</argument> </arguments> </configuration> </plugin> </plugins> </build> <dependencies> </dependencies> </project> sample maven output:
$ mvn install /cygdrive/c/program files/java/jdk1.5.0_20/bin/java -classpath c:\program files\apache software foundation\apache-maven-2.2.1/boot/classworlds-1.1.jar -dclassworlds.conf=c:\program files\apache software foundation\apache-maven-2.2.1/bin/m2.conf -dmaven.home=c:\program files\apache software foundation\apache-maven-2.2.1 org.codehaus.classworlds.launcher "install" [info] scanning projects... [info] ------------------------------------------------------------------------ [info] building unnamed - test:test:jar:1.0.0 [info] task-segment: [install] [info] ------------------------------------------------------------------------ [info] [exec:exec {execution: my-validation-one}] [info] "my validation two" [info] [exec:exec {execution: my-validation-two}] [info] "my validation two" [info] [resources:resources {execution: default-resources}] <snip> shouldn't my-validation-one echo "my validation one" console? why seem maven getting wires crossed?
thanks, steven
you should put configuration specific execution within execution block. should work correctly.
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <executions> <execution> <id>my-validation-two</id> <phase>validate</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>echo</executable> <arguments> <argument>"my validation two"</argument> </arguments> </configuration> </execution> </executions> </plugin> also, if both executions bound same phase , goal, can combine within executions block instead of declaring plugin twice.
Comments
Post a Comment