Notes | programming
The fourth chapter, using Ant for continuous integration, is a basic introduction to ant, including 1. Ant build file BUILD.XML2. Project <project name= "MyProject" default= "All" basedir= "." >3. Target <target name= "All" depends= "clean, fetch, build, test, docs, deploy" >steve Loughran's Ant in Anger Targets's recommendations are named: test-run JUnit test clean-Empty output directory deploy-deploy files such as jars, wars to the execution environment publish- Output source code and binary files to the publishing site (refers to iis,html?) I don't know) fetch-from CVS get the latest source code docs/javadocs-output document file all-perform all of the above (clean, fetch, build, test, docs, and deploy) main-The default build process (often built or builds & test) internal targets's recommendations are named: init-Initialize properties to perform other initialization tasks. Read in property file init-debug-Initialize debug properties init-release-Initialize publishing properties compile-actual compilation link/jar-create jar files or other equivalent files staging-pre-deployment and test 4. Conditional target <target name= "Setupprodution" if= "production" > <target name= " Setupdevelopment "unless=" production "> ant-build.xml build4.xml-dproduction=true5. File set and path settings <project Name= "Hello" default= "compile" > ;p roperty name= "Lib" value= ". /lib "/> <property name=" OutputDir "value="/tmp "/> <path id= "1" > <pathelement location= "." /> <pathelement location= "${lib}/log4j.jar"/> </path> <path id= "2" > <pathelement path= ".; ${lib}/log4j.jar "/> </path> <path id=" 3 "> <pathelement location= "." /> <fileset dir= "${lib}" > <include name= "**/*.jar"/> </ fileset> </path> <target name= "Compile"; <javac srcdir= "./src" destdir= "${outputdir}/classes" > <classpath refid= "1"/> </javac> <javac srcdir= "./src" destdir= "${outputdir}/classes" > <classpath refid= "2"/> </javac > <javac srcdir= "./src "Destdir=" ${outputdir}/classes > < Classpath refid= "3"/> </javac> <javac srcdir= "./src" destdir= "${outputdir}/classes" > <classpath id= "1" > <pathelement location= "." /> <pathelement location= "${lib}/log4j.jar"/> </ classpath> </javac> </target></ Project>6. Filter <filter token= "Jdbc_url" value= "jdbc::d evelopment" >7. Nested build file <ant antfile= "./hello/ Build.xml "> <property name=" Production value= "true" "/></ant>8.property< Property Name= "OutputDir" value= "/tmp"/>
In general, Ant is a powerful automated build tool that can be handed over to ant to complete after the code has been written. This makes the nightly build possible, using ant, and even generating the results HTML after running the test code, and then emailing it to the developer, so that the developer can see the cause of the build failure the next morning, The next day the developer can quickly know what the first thing is today, and get into the eight-hour working day. This is similar to some of the points in Kent Beck's test-driven Development (Chinese version). After 8 hours of work a day, do not rush to work overtime to get home, but to where, so that the next day to quickly enter the work state, rather than think about, yesterday did what, What should you start doing today? (computers do not shut down at night, you can only turn off the screen, lock the keyboard, or set the computer to sleep, but also to a large extent so that the next day "into the state" process is shorter)
By the way, I don't know if there's any IDE that can be handy when I write Ant's Build.xml file, preferably a graphical interface, without me facing a boring text editor. The previous NetBeans properties file editor was good enough to edit several different language properties at the same time.
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.