maven antrun 插件
我的 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>
然而,当我运行 'mvn antrun:run' 时,我得到这个:
[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] ------------------------------------------------------------------------
为什么回声没有出现?
TIA
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因为如果你想执行Ant,你应该使用 Maven AntRun Plugin任务,而不是 Maven Ant 插件(它用于生成从 POM 构建 Ant 1.6.2 或更高版本的文件)。修改您的插件配置如下:
调用
antrun:run
将起作用: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:
And invoking
antrun:run
will work:确保 maven-antrun-plugin 使用足够新的版本。
我的项目中一个不相关的 BOM 将其锁定为 1.3,并且
被忽略。删除 BOM 并为 antrun 指定 1.7 后,回显起作用了。Make sure
maven-antrun-plugin
is using a recent enough version.An unrelated BOM in my project was locking it to 1.3, and
<echo>
was being ignored. After removing the BOM and specifying 1.7 for antrun, the echoes worked.