亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

如何在maven中使用ant

如何在maven编译时候运行ant脚本?

使用专门的antrun插件,并且在target标签内部加入ant的代码

      <plugin>         <artifactId>maven-antrun-plugin</artifactId>         <version>1.6</version>         <executions>           <execution>             <phase> <!-- 生命周期阶段 --> </phase>             <configuration>               <target>                 <!-- 加入target内部的代码 -->               </target>             </configuration>             <goals>               <goal>run</goal>             </goals>           </execution>         </executions>       </plugin>

如何在ant脚本中引用maven的classpath?

maven给每一个依赖都生成了一个属性,格式为"groupId:artifactId[:classifier]:type",比如,如果一下例子就显示依赖的org.apache.common-util的jar文件路径

<echo message="Dependency JAR Path: ${org.apache:common-util:jar}"/>

另外,maven还预定义了四个classpath的引用,他们是

maven.compile.classpath maven.runtime.classpath maven.test.classpath maven.plugin.classpath

如何使用antrun插件运行外部的build文件?

很简单,直接在antrun里边使用ant指令即可,如下:

<plugin>     <groupId>org.apache.maven.plugins</groupId>     <artifactId>maven-antrun-plugin</artifactId>     <version>1.6</version>     <executions>         <execution>             <id>compile</id>             <phase>compile</phase>             <configuration>                 <target>                     <!-- 同时传递内置的classpath给外部ant文件 -->                     <property name="compile_classpath" refid="maven.compile.classpath"/>                     <property name="runtime_classpath" refid="maven.runtime.classpath"/>                     <property name="test_classpath" refid="maven.test.classpath"/>                     <property name="plugin_classpath" refid="maven.plugin.classpath"/>                          <ant antfile="${basedir}/build.xml">                         <target name="test"/>                     </ant>                 </target>             </configuration>             <goals>                 <goal>run</goal>             </goals>         </execution>     </executions> </plugin>

如何在ant中使用maven的功能?

使用ant的maven task,不过只有ant 1.6以上和jdk 1.5环境才支持。

原文链接:http://outofmemory.cn/maven/FAQ/how-to-interact-with-ant-in-maven

點擊查看更多內容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學習,寫下你的評論
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消