Skip exec-maven-plugin from Command Line Argument in Maven

Reddy picture Reddy · Oct 29, 2014 · Viewed 19.6k times · Source

By default in my project POM, exec-maven-plugin, rpm-maven-plugin will be executed, which is not required in local compilation/build.

I want to skip these plugin execution by passing Command Line Arguments I tried below command to skip them like normal plugins, but didn't work though!

mvn install -Dmaven.test.skip=true -Dmaven.exec.skip=true -Dmaven.rpm.skip=true

Answer

Robert Scholte picture Robert Scholte · Oct 29, 2014

This page should tell you that the name of the argument to be passed by cmdline (i.e. the user property) is called skip, which is a poorly chosen name. To fix this do the following:

<properties>
  <maven.exec.skip>false</maven.exec.skip> <!-- default -->
</properties>
...
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.3.2</version>
  <configuration>
    <skip>${maven.exec.skip}</skip>
  </configuration>
</plugin>