Apache Maven项目提供的AntRun插件详解

来源:互联网 发布:几何网络是什么意思 编辑:程序博客网 时间:2024/06/07 03:11

AntRun插件是为了便于从Ant项目迁移到Maven而设计的,提供了在Maven中运行Ant target的能力。当前最新版本是2014.12发布的1.8。

甚至,可以将Ant脚本直接嵌入到POM中执行。当然,并不建议将Ant脚本嵌入到POM中执行,而是采用在POM中调用<ant/>target方式。


AntRun插件的基本信息:

[html] view plain copy
print?
  1. <groupId>org.apache.maven.plugins</groupId>  
  2. <artifactId>maven-antrun-plugin</artifactId>  
  3. <version>1.8</version>  
<groupId>org.apache.maven.plugins</groupId><artifactId>maven-antrun-plugin</artifactId><version>1.8</version>


AntRun插件只有一个goal:

  • antrun:run,在Maven中运行Ant target

AntRun插件在POM中的基本配置:

[html] view plain copy
print?
  1. <plugin>  
  2.   <groupId>org.apache.maven.plugins</groupId>  
  3.   <artifactId>maven-antrun-plugin</artifactId>  
  4.   <version>1.8</version>  
  5.   <executions>  
  6.     <execution>  
  7.       <phase> <!– a lifecycle phase –> </phase>  
  8.       <configuration>  
  9.         <target>  
  10.           <!–  
  11.             Place any Ant task here. You can add anything  
  12.             you can add between <target> and </target> in a  
  13.             build.xml.  
  14.           –>  
  15.         </target>  
  16.       </configuration>  
  17.       <goals>  
  18.         <goal>run</goal>  
  19.       </goals>  
  20.     </execution>  
  21.     <execution>  
  22.         …  
  23.     </execution>  
  24.     …  
  25.   </executions>  
  26. </plugin>  
      <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-antrun-plugin</artifactId>        <version>1.8</version>        <executions>          <execution>            <phase> <!-- a lifecycle phase --> </phase>            <configuration>              <target>                <!--                  Place any Ant task here. You can add anything                  you can add between <target> and </target> in a                  build.xml.                -->              </target>            </configuration>            <goals>              <goal>run</goal>            </goals>          </execution>          <execution>              …          </execution>          …        </executions>      </plugin>


参考文献:

http://maven.apache.org/plugins/maven-antrun-plugin/


阅读全文
0 0
原创粉丝点击