<profile> <id>integration-tests</id> <activation> <property> <name>integrations</name> <value>true</value> </property> </activation> <build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.4.0</version> <executions> <execution> <id>script-chmod</id> <phase>integration-test</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>chmod</executable> <arguments> <argument>+x</argument> <argument>integration-test-docker/integrations.sh</argument> </arguments> </configuration> </execution> <execution> <id>script-exec</id> <phase>integration-test</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>integration-test-docker/integrations.sh</executable> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile>
this profile has more things in it, included want run. how can execute particular goal, of particular plugin?
i tried mvn exec:exec
this
[error] failed execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (default-cli) on project ando: parameters 'executable' goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec missing or invalid -> [help 1]
moreover, error output indicates version 1.3.2
, i'm using 1.4.0
.
you error on invoking exec
goal of the exec-maven-plugin
because configuration (the 1 meant) part of profile not active default , not activated execution mvn exec:exec
.
if try activate profile via property activation (as per configuration) or explicitly (via -p
option), maven know exec maven plugin mentioned:
mvn exec:exec -pintegration-tests
or
mvn exec:exec -dintegrations=true
as such, profile active , exec maven plugin configuration part of build.
however, configuring 2 executions of plugin , there no global configuration, hence fail again.
there difference between configuration
element plugin
section in or out of execution
sub-section: out, applied default executions , command line executions; in, applied specific execution applied (overriding or getting merged default one, if provided).
if want run both executions, can activate profile:
mvn clean verify -pintegration-tests
or
mvn clean verify -dintegrations=true
however, execute whole content of profile plus whole build till specified phase
.
if want execute plugin goal (exec
) command line, need specify default configuration (but one) following:
<profile> <id>integration-tests</id> <activation> <property> <name>integrations</name> <value>true</value> </property> </activation> <build> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.4.0</version> <configuration> <!-- here default configuration --> </configuration> </plugin> </plugins> </build> </profile>
the default configuration applied command line execution.
alternatively, override default execution id (default-cli
) used every plugin execution command line , can see part of mentioned error in question. such, provide specific configuration execution , not other (if any) executions (given not provide own configuration). here example:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.4.0</version> <executions> <execution> <id>default-cli</id> <configuration> <!-- here specific command line execution --> </configuration> </execution> </executions> </plugin>
if want execute both executions command line , these executions (hence, not part of maven phase), can check this answer on topic (in short: possible since maven 3.3.1, otherwise suggestion provided earlier versions).
as such, execution following:
mvn org.codehaus.mojo:exec-maven-plugin:1.4.0:exec@script-chmod -dintegrations=true
note:
- i'm again activating profile have execution part of build
- this time i'm not passing plugin alias,
exec
, , desired goal,exec
, full maven gav (groupid, artifactid, version) in common maven pattern dependencies (:
separated),org.codehaus.mojo:exec-maven-plugin:1.4.0
, passing goal, additional:exec
, using new feature mentioned above , new@
operator pass desired execution id (defined in pom).
Comments
Post a Comment