0

If I configure a maven plugin with a number of executions:

    <plugin>
      <groupId>...</groupId>
      <artifactId>...</artifactId>
      <version>...</version>
      <executions>
        <execution>
          <id>execution-1</id>
          <goals>
            <goal>...</goal>
          </goals>
          <configuration>
                 ...
          </configuration>
          <phase>...</phase>
        </execution>
        <execution>
          <id>execution-2</id>
          <goals>
            <goal>...</goal>
          </goals>
          <configuration>
                 ...
          </configuration>
          <phase>...</phase>
        </execution>
       </executions>
      <configuration>
            ...
      </configuration>
    </plugin>

can I specify one of these executions to run on the command line (without changing the id to default-cli)?

natke
  • 743
  • 1
  • 9
  • 21

2 Answers2

1

No this is not possible. See for instance a related Maven mailing list thread Basically, executions are to be used inside the lifecycle, not for a single execution.

You should use profiles to achieve what you need.

Tome
  • 3,234
  • 3
  • 33
  • 36
  • Can you give some more detail on how I would use profiles to do this? – natke Sep 11 '13 at 19:26
  • It highly depends on the changes that your different plugin executions require. It might vary from changing a single property inside the different profiles to having a full plugin configuration inside each profile. For the profile usage itself, see the Sonatype Book chapter that explains the concept: http://books.sonatype.com/mvnref-book/reference/profiles-sect-maven-profiles.html – Tome Sep 12 '13 at 08:09
  • Thanks, I will try it out. I mostly want to do this when I am debugging some new functionality that has been added to a POM, and I want to run just that execution. Profiles might be overkill for this, but I will check it out. – natke Sep 16 '13 at 18:31
0

You should use profiles to do this.

Marcin Szymczak
  • 11,199
  • 5
  • 55
  • 63