Ant multi-Project packaging, ant multiple Project Bulk Packaging method

Source: Internet
Author: User

1. Download Ant-contrib, decompression put Ant-contrib.jar in%ant_home%\lib directory

There is no task for the for loop in Ant's Core package to download the corresponding expansion pack. You can use an open source Ant-contrib package. Download Address: http://ant-contrib.sourceforge.net/

2.build.xml (the key is foreach and taskdef tags)

<?xml version= "1.0" encoding= "UTF-8"?> <project default= "foreach_p" basedir= "." > <taskdef resource= "net/sf/antcontrib/antlib.xml"/> <property file= "ant.properties"/> <!--< Target Name= "loop" > <echo>${file.full.name}</echo> </target>--> <! --Pass the properties filename loop in input.deploy.property.paths to loop--> <!--<target name= "Install_package_deploy.s Tart "> <foreach list=" "target=" Loop "param=" File.full.name "delimiter=", "> <fileset dir=" ." > <exclude name= "*.properties"/> </fileset> </foreach> </t Arget>--> <!--loop The numbers in the list to screen_number--> <target name= "Foreach_p" > < foreach list= "${packlist}" target= "Screen_number" param= "SERVER_NAME" delimiter= "," > </ foreach> </target> <target Name= "Screen_number" > <!--<echo>${number}</echo>--> <mkdir dir= "Temp${server _name} "/> <copy todir=" Temp${server_name} "> <fileset dir=".
    		/${server_name}/webroot/web-inf/classes "> <exclude name=" **/*.properties "/> </fileset> </copy> <jar jarfile= "${server_name}.jar" basedir= "Temp${server_name}"/> <copy file= "${serv" Er_name}.jar "Todir=". /mydist "/> <!--<copy file=" ${server_name}.jar "todir=".
/user_server/web-inf/lib "/>--> <delete dir=" Temp${server_name} "/> </target> </project> <!--<project name= "Xxwan-user" default= "Build" basedir= "." > <target name= "Build" > <mkdir dir= "temp"/> <copy todir= "temp" > <fileset dir= "webroot/web-" Inf/classes "> <exclude name=" **/*.properties "/> </fileset> </copy> <jar jarfile=" Xxx.jar
  	"Basedir=" temp "/><copy file= "Xxxx.jar" todir= ". /dist "/> <copy file=" Xxxx.jar "todir=". /xxxx/web-inf/lib "/> <delete dir=" temp "/> </target> </project>-->

3.ant.properties


<span style= "FONT-SIZE:18PX;" >packlist = xxxx1,xxx2,xxxx3</span>

Reference: http://www.cnblogs.com/100fighting/p/3160505.html

Http://www.tuicool.com/articles/E7nyAbI


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.