Maven調用Ant腳本的最佳實踐

Maven工程改造中如果實在脫離不開對於Ant 的依賴,這樣做:
view plaincopy to clipboardprint?
<build> 
<plugins> 
      <plugin> 
        <artifactId>maven-antrun-plugin</artifactId> 
        <version>2.1</version> 
        <dependencies> 
          <dependency> 
            <groupId>ant</groupId> 
            <artifactId>ant-junit</artifactId> 
            <version>1.7.1</version> 
          </dependency> 
          <!-- ...其它包依賴 --> 
        </dependencies> 
        <executions> 
          <execution> 
            <id>ant-test</id> 
            <phase>package</phase> 
            <configuration> 
              <tasks> 
                <!-- 下面可以傳入一些Maven變量 --> 
                <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"/> 
              </tasks> 
            </configuration> 
            <goals> 
              <goal>run</goal> 
            </goals> 
          </execution> 
        </executions> 
      </plugin> 
      <!-- ... --> 
<plugins> 
</build> 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章