我如何调用Ant竣工图使用Maven [英] How do I call Ant Builts using Maven

查看:128
本文介绍了我如何调用Ant竣工图使用Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在使用运行Ant [它只是拷贝文件并运行SQL。PHP项目的多个子模块

I have many sub modules of php projects which are run using ANT [It just copies files and runs SQL].

现在我需要实现的Maven处理未来的单元测试+ Maven是我们无论如何需要在未来使用的最佳工具。]

Now I need to Implement Maven for handling future Unit Testing + [Maven is the Best tool which we anyway need to use in the future.]

我已经安装的Maven在Eclipse中的PHP。我已在IDE本身使用Maven一个新的项目。我还可以运行项目。
[我是小白到Maven,但用好蚂蚁]

I have installed Maven for php in Eclipse. I have made a new project using Maven in the IDE itself. I can run the Project also. [I am a noob to Maven but good with ANTs]

现在我想打电话给使用Maven项目的子模块ANT的XML。
ANT RUN 这确实对Maven的伎俩,但我不能于:

Now I want to call those submodular ANT's xml using the Maven project. There is ANT RUN which does the trick for maven, but I am not able to:


  • 弄清楚如何引用模块 ANT XML Maven的项目之外。

  • 蚂蚁只知道一味联结XML将做的工作?或者我需要更多的依赖关系?

  • figure out how to reference modules' ANT xml outside the Maven Project.
  • Ant just merely linking the XML would do the job? Or do I need more dependencies?

推荐答案

使用Maven的蚂蚁亚军插件来调用Ant的逻辑,使用Ant的 subant 任务

Use the Maven ant runner plugin to invoke the ANT logic, using ANT's subant task

$ tree
.
|-- pom.xml
`-- src
    `-- main
        `-- ant
            |-- module1
            |   `-- build.xml
            `-- module2
                `-- build.xml

5 directories, 3 files

的pom.xml

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.myspotontheweb.demo</groupId>
    <artifactId>demo</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <configuration>
                            <target>
                                <property name="src.dir" location="${project.build.directory}/../src"/>
                                <subant>
                                    <fileset dir="${src.dir}" includes="**/build.xml"/>
                                </subant>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

ANT配置在Maven构建的编译阶段运行。蚂蚁逻辑使用 subant 任务运行外部ANT逻辑。

ANT is configured to run during the "compile" phase of the Maven build. The ANT logic uses the subant task to run external ANT logic.

$ mvn compile
..    
..
[INFO] --- maven-antrun-plugin:1.7:run (default) @ demo ---
[INFO] Executing tasks

main:

main:
     [echo] module1: hello world

main:
     [echo] module2: hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.394s
[INFO] Finished at: Fri Apr 27 20:25:35 IST 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

这篇关于我如何调用Ant竣工图使用Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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