maven antrun 插件 [英] maven antrun plugin

查看:51
本文介绍了maven antrun 插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 pom 中有以下内容:

<groupId>org.apache.maven.plugins</groupId><artifactId>maven-ant-plugin</artifactId><version>2.3</version><配置><目标><回声message="你好蚂蚁,来自 Maven!"/><echo>也许这行得通?</echo></目标></配置></插件>

然而,当我运行 'mvn antrun:run' 时,我得到了这个:

[INFO] 正在扫描项目...[信息] 正在搜索带有前缀的插件存储库:'antrun'.[信息] ------------------------------------------------------------------------[信息] 构建我的项目[信息] 任务段:[antrun:run][信息] ------------------------------------------------------------------------[信息] [antrun:run {execution: default-cli}][INFO] 执行任务[INFO] 已执行的任务[信息] ------------------------------------------------------------------------[信息] 构建成功[信息] ------------------------------------------------------------------------[INFO]总时间:1秒[信息] 完成时间:2010 年 9 月 24 日星期五 13:33:14 PDT[INFO] 最终内存:16M/28M[信息] ------------------------------------------------------------------------

为什么回声不显示?

TIA

解决方案

因为你应该使用 Maven AntRun Plugin 如果你想执行 Ant 任务,而不是 Maven Ant 插件(用于从 POM 为 Ant 1.6.2 或更高版本生成构建文件).修改您的插件配置如下:

 <插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.5</version><配置><目标><echo message="hello ant, from Maven!"/><echo>也许这行得通?</echo></目标></配置></插件>

并且调用 antrun:run 会起作用:

<前>$ mvn antrun:运行[信息] 正在扫描项目...[信息][信息] ------------------------------------------------------------------------[信息] 楼 Q3790798 1.0-快照[信息] ------------------------------------------------------------------------[信息][信息] --- maven-antrun-plugin:1.5:run (default-cli) @ Q3790798 ---[INFO] 执行任务主要的:[echo] 你好蚂蚁,来自 Maven![回声] 也许这会奏效?[INFO] 已执行的任务[信息] ------------------------------------------------------------------------[信息] 构建成功[信息] ------------------------------------------------------------------------...

I have the following in my pom:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ant-plugin</artifactId>
    <version>2.3</version>
    <configuration>
       <target>
          <echo
            message="hello ant, from Maven!" />
          <echo>Maybe this will work?</echo>
       </target>
    </configuration>
</plugin>

Yet, when I run 'mvn antrun:run' I get this:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'antrun'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject
[INFO]    task-segment: [antrun:run]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run {execution: default-cli}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Sep 24 13:33:14 PDT 2010
[INFO] Final Memory: 16M/28M
[INFO] ------------------------------------------------------------------------

How come the echo's don't show up?

TIA

解决方案

Because you are supposed to use the Maven AntRun Plugin if you want to execute Ant tasks, not the Maven Ant Plugin (which is used to generate build files for Ant 1.6.2 or above from the POM). Modify your plugin configuration as below:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.5</version>
    <configuration>
      <target>
        <echo message="hello ant, from Maven!"/>
        <echo>Maybe this will work?</echo>
      </target>
    </configuration>
  </plugin>

And invoking antrun:run will work:

$ mvn antrun:run 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3790798 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-antrun-plugin:1.5:run (default-cli) @ Q3790798 ---
[INFO] Executing tasks

main:
     [echo] hello ant, from Maven!
     [echo] Maybe this will work?
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
...

这篇关于maven antrun 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆