Maven,配置具体目标

时间:2010-09-20 10:38:13

标签: java maven-2

我想配置maven-war-plugin的“爆炸”目标:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <executions>
    <execution>
      <goals>
        <goal>exploded</goal>
      </goals>
      <configuration>
        <webappDirectory>war</webappDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>

我需要手动运行“爆炸”目标,并且不希望将执行附加到任何lifycycle阶段。但当我执行“mvn war:explosion”时,maven忽略了我的配置。请告诉我,怎么做:))

1 个答案:

答案 0 :(得分:13)

阅读此页面以供参考:

Guide to Configuring Default Mojo Executions

本质上:

如果您使用标识default-cli

配置执行,它将起作用
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <executions>
    <execution>
      <id>default-cli</id>
      <goals>
        <goal>exploded</goal>
      </goals>
      <configuration>
        <webappDirectory>war</webappDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>