Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a single Maven plugin execution?

People also ask

What is the difference between plugin and pluginManagement tags?

pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.

What is execution ID?

An Execution Id is a valid user ID that is used to connect to the Reporting Server, FTP server or web server to run a schedule task. When an Execution Id is created, changed, or deleted on a server, it must also be created, changed, or deleted in the Repository table that stores Execution Id credentials.


As noted in How to execute maven plugin execution directly from command line?, this functionality has been implemented as MNG-5768, and is available in Maven 3.3.1.

The change will:

extend direct plugin invocation syntax to allow optional @execution-id parameter, e.g., org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId.

So, as long as you give your execution an id:

mvn sql:execute@specific-execution-id

uses the execution configured in your pom.


But is there a way to run one of these executions from the command line by using the execution ID perhaps?

No, not possible. What is possible though is to define "a" configuration to be used when the plugin is invoked from the command line using the "special" default-cli execution id:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>sql-maven-plugin</artifactId>
  <version>1.4</version>
  ...
  <executions>
    <execution>
      <id>default-cli</id>
      <configuration>
        ...
      </configuration>
    </execution>
    ...
  </executions>
</plugin>

And simply call mvn sql:execute.

See below for the details (from the Maven 2.2.0 Release Notes):

  • MNG-3401 - Starting in Maven 2.2.0, goals invoked directly from the command line can be configured in the POM separately from other plugin invocations using a special executionId called default-cli. Where previously, all configurations for command-line goals had to go in the plugin-level configuration, Maven 2.2.0 allows command-line-specific configurations to be separated into their own <execution>. For more information, see the Guide to Default Execution IDs.