如何在 Ant 脚本中调用 Maven 目标? [英] How to call for a Maven goal within an Ant script?

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

问题描述

是否可以在 Ant 脚本中调用或执行 Maven 目标?

Is it possible to call or execute a Maven goal within an Ant script?

假设我有一个名为 'distribute' 的 ant 目标,我需要在其中从另一个 pom.xml 调用一个 maven 'compile' 目标.

Say I have an ant target called 'distribute' and inside which I need to call a maven 'compile' goal from another pom.xml.

推荐答案

从 Windows CLI 使用 Maven 运行的 exec 任务的使用示例是:

An example of use of exec task utilizing Maven run from the Windows CLI would be:

<target name="buildProject" description="Builds the individual project">
    <exec dir="${source.dir}\${projectName}" executable="cmd">
        <arg value="/C"/>
        <arg value="${env.MAVEN_HOME}\bin\mvn.bat"/>
        <arg line="clean install" />
</exec>
</target>

这篇关于如何在 Ant 脚本中调用 Maven 目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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