8

「mvn antrun:run」を実行すると、タスクが実行されません..echo タスクがありますが、出力が表示されません..タスクがバインドされているフェーズを実行すると、実行されます..

コマンドラインから具体的にタスクを実行するにはどうすればよいですか?

4

1 に答える 1

7

このようなものが pom.xml に追加されていると仮定します

<build>
   <plugins>
       <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <phase>package</phase><!--Change this to control when it runs -->
              <configuration>
                <tasks>
            <echo  message="Hello, maven"/>
                </tasks>
              </configuration>
              <goals>
                <goal>run</goal><!-- this is to call antrun:run -->
              </goals>
            </execution>
          </executions>
        </plugin>
     </plugins>
  </build>

実行mvn packageすると、コンソールで次のようになります

[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] Hello, maven
[INFO] Executed tasks

を変更phaseして、必要な時点で Ant スクリプトを実行することができます。

于 2009-05-26T19:51:39.193 に答える