小编Gon*_*alo的帖子

使用Maven执行Ant任务

我正在尝试用Maven执行一些使用Ant任务编写的测试.我生成了将任务导入Maven所需的文件,但我无法执行它们.

我的POM是这样定义的:

<build>
  <plugins>
      <plugin>
        <artifactId>maven-ant-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>
                <echo message="Hello, maven"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
Run Code Online (Sandbox Code Playgroud)

我尝试执行该消息,但运行时出错:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] 'run' was specified in an execution, but not found in the plugin
Run Code Online (Sandbox Code Playgroud)

但是,如果我运行:"mvn antrun:run",我知道这不能运行任务.

如果我有不同的目标,我如何从Maven中调用它们?我有pom.xml,以及带有ant任务的build.xml.

谢谢.

贡萨洛

ant maven-2 task

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

ant ×1

maven-2 ×1

task ×1