ant学习(存档)

来源:互联网 发布:qq变声器女变男软件 编辑:程序博客网 时间:2024/06/04 18:50

ANT = [A]nother [N]eat [T]ool 
在maven中经常需要用到Maven Antrun plugin(http://maven.apache.org/plugins/maven-antrun-plugin/) 插件.
This plugin provides the ability to run Ant tasks from within Maven. You can even embed your Ant scripts in the POM
需要经常编写ant脚本,为此需要学习下ant的脚本。
官方的资料为:
http://ant.apache.org/manual/index.html
ant helloworldwithAnt:http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html
ant的命令集合:http://ant.apache.org/manual/tasksoverview.html

在maven项目中最常见的用法:
     <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <executions>
                         <execution>
                              <phase>process-test-resources</phase>
                              <goals>
                                   <goal>run</goal>
                              </goals>
                              <configuration>
                                   <target>
                                        <delete dir="${basedir}/src/java.test/spring/conf" />
                                        <mkdir dir="${basedir}/src/java.test/spring/conf" />
                                        <copy todir="${basedir}/src/java.test/spring/conf">
                                             <fileset dir="${basedir}/target/conf/webroot/WEB-INF/bean/">
                                                  <include name="**" />
                                             </fileset>
                                        </copy>
                                        <move file="${basedir}/target/conf/java/sqlmap-config.xml"
                                             tofile="${basedir}/src/java.test/spring/web.sqlmap-config.xml"
                                             overwrite="true" />
                                   </target>
                              </configuration>
                         </execution>
                    </executions>
       </plugin>
原创粉丝点击