SlideShare uma empresa Scribd logo
1 de 18
ANT [email_address]
Cosa è ant ,[object Object],[object Object],[object Object],[object Object]
Vantaggi di ant ,[object Object],[object Object],[object Object],[object Object]
Installazione di ant ,[object Object],[object Object],[object Object]
Un primo programma in ant ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Eseguire ant ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Classpath <classpath> <pathelement   path= &quot;${classpath}&quot; /> <fileset   dir= &quot;lib&quot; > <include   name= &quot;**/*.jar&quot; /> </fileset> <pathelement   location= &quot;classes&quot; /> <dirset   dir= &quot;${build.dir}&quot; > <include   name= &quot;apps/**/classes&quot; /> <exclude   name= &quot;apps/**/*Test*&quot; /> </dirset> <filelist   refid= &quot;third-party_jars&quot; /> </classpath>
Tag java ,[object Object],<java   classname= &quot;test.Main&quot; > <arg   value= &quot;-h&quot; /> <classpath> <pathelement   location= &quot;dist/test.jar&quot; /> <pathelement   path= &quot;${java.class.path}&quot; /> </classpath> </java>
Tag javac <javac   srcdir= &quot;${src}&quot;   destdir= &quot;${build}&quot; /> Il tag javac è usato per compilare una o più classi: Anche con svariati attributi di compilazione: <javac   sourcepath= &quot;&quot;   srcdir= &quot;${src}&quot;  destdir= &quot;${build}&quot; > <include   name= &quot;**/*.java&quot; /> <exclude   name= &quot;**/Example.java&quot; /> </javac>
Tag property the url from which to read properties. <property url=&quot;http://www.mysite.com/bla/foo.properties&quot;/>  url the filename of the property file. <property file=&quot;ant-global.properties&quot;/> <property file=&quot;${user.home}/ant-global.properties&quot;/>  file the resource name of the property file. <property resource=&quot;foo.properties&quot;/> resource Sets the property to the absolute filename of the given file. <property name=&quot;src&quot; location=&quot;src&quot;/> location the value of the property. <property name=&quot;compile&quot; value=&quot;2&quot;/> value the name of the property to set. <property name=&quot;src&quot; … name Description Attribute
Un semplice buildfile <project   name= &quot;MyProject&quot;   default= &quot;dist&quot;   basedir= &quot;.&quot; > <description> simple example build file </description> <!-- set global properties for this build --> <property   name= &quot;src&quot;   location= &quot;src&quot; /> <property   name= &quot;build&quot;   location= &quot;build&quot; /> <property   name= &quot;dist&quot;   location= &quot;dist&quot; /> <target   name= &quot;init&quot; > <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure --> <mkdir   dir= &quot;${build}&quot; /> </target>
Un semplice buildfile <target   name= &quot;compile&quot;   depends= &quot;init&quot;   description= &quot;compile&quot; > <!-- Compile the java code from ${src} into ${build} --> <javac   srcdir= &quot;${src}&quot;   destdir= &quot;${build}&quot; /> </target> <target   name= &quot;dist&quot;   depends= &quot;compile&quot;   description= &quot;generate the distribution&quot;   > <!-- Create the distribution directory --> <mkdir   dir= &quot;${dist}/lib&quot; /> <!– put ${build}into the MyProject-${DSTAMP}.jar file --> <jar   jarfile= &quot;${dist}/lib/MyProject-${DSTAMP}.jar&quot;   basedir= &quot;${build}&quot; /> </target>
Un semplice buildfile <target   name= &quot;clean&quot;   description= &quot;clean up&quot;   > <!-- Delete the ${build} and ${dist} directory --> <delete   dir= &quot;${build}&quot; /> <delete   dir= &quot;${dist}&quot; /> </target> </project>
Diversi target ,[object Object],[object Object],[object Object]
Esempio buildfile con più target <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <project   name= &quot;EJB Mail BottegaVerde Project&quot;   default= &quot;ejb-jar&quot;   basedir= &quot;.&quot; > <target   name= &quot;init&quot; > <!-- Project Directories --> <property   name= &quot;src.dir&quot;   value= &quot;${basedir}/ejbModule&quot;   /> <property   name= &quot;classes.dir&quot;   value= &quot;${basedir}/classes&quot;   /> <property   name= &quot;resources.dir&quot;   value= &quot;${basedir}/resources&quot;   /> <!-- Archive names --> <property   name= &quot;archive.name&quot;   value= &quot;bottegaVerdeMail&quot;   /> <!-- Sets the jboss directory from the local environment --> <property   environment= &quot;env&quot;   /> <!-- Override with your JBoss server dist location if JBOSS_DIST is not set --> <property   name= &quot;jboss.dist&quot;   value= &quot;${env.JBOSS_DIST}&quot;   /> </target> <target   name= &quot;compile&quot;   depends= &quot;init&quot; > <mkdir   dir= &quot;${classes.dir}&quot;   /> <javac   srcdir= &quot;${src.dir}&quot;   destdir= &quot;${classes.dir}&quot;   debug= &quot;on&quot;   deprecation= &quot;on&quot;   optimize= &quot;off&quot; > <classpath> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </javac> </target>
Esempio buildfile con più target <target   name= &quot;ejb-jar&quot;   depends= &quot;compile&quot; > <delete   file= &quot;${classes.dir}/${archive.name}.jar&quot;   /> <jar   jarfile= &quot;${classes.dir}/${archive.name}.jar&quot; > <fileset   dir= &quot;${classes.dir}&quot;   excludes= &quot;**/*Client.class&quot;   /> <zipfileset   dir= &quot;${resources.dir}&quot;   prefix= &quot;META-INF&quot;   includes= &quot;*.xml&quot;   /> </jar> </target> <target   name= &quot;deploy&quot;   depends= &quot;ejb-jar&quot; > <copy   file= &quot;${classes.dir}/${archive.name}.jar&quot;   todir= &quot;${env.JBOSS_DIST}/server/default/deploy&quot;   /> </target> <target   name= &quot;undeploy&quot; > <delete   file= &quot;${env.JBOSS_DIST}/server/default/deploy/${archive.name}.jar&quot;   /> </target> <target   name= &quot;testStateless&quot;   depends= &quot;compile&quot; > <java   classname= “org.ubitek.stateless.TestStatelessClient&quot;   fork= &quot;yes&quot; > <classpath> <pathelement   location= &quot;${classes.dir}&quot;   /> <pathelement   location= &quot;${resources.dir}&quot;   /> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </java> </target>
Esempio buildfile con più target <target   name= &quot;testStateful&quot;   depends= &quot;compile&quot; > <java   classname= “org.ubitek.stateful.TestStatefulClient&quot;   fork= &quot;yes&quot; > <classpath> <pathelement   location= &quot;${classes.dir}&quot;   /> <pathelement   location= &quot;${resources.dir}&quot;   /> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </java> </target> <target   name= &quot;testBMP&quot;   depends= &quot;compile&quot; > <java   classname= &quot;org.ubitek.bmp.CDClient&quot;   fork= &quot;yes&quot; > <classpath> <pathelement   location= &quot;${classes.dir}&quot;   /> <pathelement   location= &quot;${resources.dir}&quot;   /> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </java> </target> <target   name= &quot;testCMP&quot;   depends= &quot;compile&quot; > <java   classname= &quot;com.imolinfo.entity.cmp20.CDClient&quot;   fork= &quot;yes&quot; > <classpath> <pathelement   location= &quot;${classes.dir}&quot;   /> <pathelement   location= &quot;${resources.dir}&quot;   /> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </java> </target>
Esempio buildfile con più target <target   name= &quot;testMD&quot;   depends= &quot;compile&quot; > <java   classname= “org.ubitek.message.TestMDBean&quot;   fork= &quot;yes&quot; > <classpath> <pathelement   location= &quot;${classes.dir}&quot;   /> <pathelement   location= &quot;${resources.dir}&quot;   /> <fileset   dir= &quot;${jboss.dist}/client&quot;   includes= &quot;**/*.jar&quot;   /> </classpath> </java> </target> <target   name= &quot;clean&quot;   depends= &quot;init&quot; > <delete   dir= &quot;${classes.dir}&quot;   /> </target> </project>

Mais conteúdo relacionado

Destaque

Improving the quality of school and out of-school time nutrition programs
Improving the quality of school and out of-school time nutrition programsImproving the quality of school and out of-school time nutrition programs
Improving the quality of school and out of-school time nutrition programsmambrosefrac
 
Sept 20 2012 ona show me the numbers
Sept 20 2012 ona  show me the numbersSept 20 2012 ona  show me the numbers
Sept 20 2012 ona show me the numbersHack the Hood
 
090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing090309seminar talk about Cloud Computing
090309seminar talk about Cloud ComputingKohei Nishikawa
 
Introduction to PHP 5.3
Introduction to PHP 5.3Introduction to PHP 5.3
Introduction to PHP 5.3guestcc91d4
 
090313seminar Talk About Salesforce For Google Apps
090313seminar Talk About Salesforce For Google Apps090313seminar Talk About Salesforce For Google Apps
090313seminar Talk About Salesforce For Google AppsKohei Nishikawa
 
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...Hack the Hood: Transforming Youth & Local Small Business through Project-Base...
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...Hack the Hood
 
Pavilion N Bbrochure
Pavilion N BbrochurePavilion N Bbrochure
Pavilion N Bbrochureguesta00b88
 
Guideline Sample (Draft Version)
Guideline Sample (Draft Version)Guideline Sample (Draft Version)
Guideline Sample (Draft Version)Ruby Kuo
 
03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente
03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente
03 - Le Chemin de l’Union Européenne vers la Spécialisation IntelligenteMohamed Larbi BEN YOUNES
 
The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.wimvermeulen
 
4.2 My Works About Deliver & Training
4.2 My Works About Deliver & Training4.2 My Works About Deliver & Training
4.2 My Works About Deliver & TrainingRuby Kuo
 
Hello SharePoint 2007!!!
Hello SharePoint 2007!!!Hello SharePoint 2007!!!
Hello SharePoint 2007!!!Marwan Tarek
 
3.3 My Works About Content Create, Copywriting
3.3 My Works About Content Create, Copywriting3.3 My Works About Content Create, Copywriting
3.3 My Works About Content Create, CopywritingRuby Kuo
 
Jaws multimedia class
Jaws multimedia classJaws multimedia class
Jaws multimedia classHack the Hood
 
Salesforce crm over_view_2012_0301
Salesforce crm over_view_2012_0301Salesforce crm over_view_2012_0301
Salesforce crm over_view_2012_0301Kohei Nishikawa
 
Qlubb 101 Webinar Notes
Qlubb 101 Webinar NotesQlubb 101 Webinar Notes
Qlubb 101 Webinar NotesQlubb Info
 

Destaque (20)

Improving the quality of school and out of-school time nutrition programs
Improving the quality of school and out of-school time nutrition programsImproving the quality of school and out of-school time nutrition programs
Improving the quality of school and out of-school time nutrition programs
 
Sept 20 2012 ona show me the numbers
Sept 20 2012 ona  show me the numbersSept 20 2012 ona  show me the numbers
Sept 20 2012 ona show me the numbers
 
090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing090309seminar talk about Cloud Computing
090309seminar talk about Cloud Computing
 
Introduction to PHP 5.3
Introduction to PHP 5.3Introduction to PHP 5.3
Introduction to PHP 5.3
 
090313seminar Talk About Salesforce For Google Apps
090313seminar Talk About Salesforce For Google Apps090313seminar Talk About Salesforce For Google Apps
090313seminar Talk About Salesforce For Google Apps
 
Learning about markets
Learning about marketsLearning about markets
Learning about markets
 
Virussen Pp De Goeie
Virussen Pp De GoeieVirussen Pp De Goeie
Virussen Pp De Goeie
 
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...Hack the Hood: Transforming Youth & Local Small Business through Project-Base...
Hack the Hood: Transforming Youth & Local Small Business through Project-Base...
 
Pavilion N Bbrochure
Pavilion N BbrochurePavilion N Bbrochure
Pavilion N Bbrochure
 
Guideline Sample (Draft Version)
Guideline Sample (Draft Version)Guideline Sample (Draft Version)
Guideline Sample (Draft Version)
 
03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente
03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente
03 - Le Chemin de l’Union Européenne vers la Spécialisation Intelligente
 
The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.The Augmented Reality industry in 15 min.
The Augmented Reality industry in 15 min.
 
Ecopals bg part 5
Ecopals bg part 5Ecopals bg part 5
Ecopals bg part 5
 
Designstudionotes
DesignstudionotesDesignstudionotes
Designstudionotes
 
4.2 My Works About Deliver & Training
4.2 My Works About Deliver & Training4.2 My Works About Deliver & Training
4.2 My Works About Deliver & Training
 
Hello SharePoint 2007!!!
Hello SharePoint 2007!!!Hello SharePoint 2007!!!
Hello SharePoint 2007!!!
 
3.3 My Works About Content Create, Copywriting
3.3 My Works About Content Create, Copywriting3.3 My Works About Content Create, Copywriting
3.3 My Works About Content Create, Copywriting
 
Jaws multimedia class
Jaws multimedia classJaws multimedia class
Jaws multimedia class
 
Salesforce crm over_view_2012_0301
Salesforce crm over_view_2012_0301Salesforce crm over_view_2012_0301
Salesforce crm over_view_2012_0301
 
Qlubb 101 Webinar Notes
Qlubb 101 Webinar NotesQlubb 101 Webinar Notes
Qlubb 101 Webinar Notes
 

ANT

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Classpath <classpath> <pathelement path= &quot;${classpath}&quot; /> <fileset dir= &quot;lib&quot; > <include name= &quot;**/*.jar&quot; /> </fileset> <pathelement location= &quot;classes&quot; /> <dirset dir= &quot;${build.dir}&quot; > <include name= &quot;apps/**/classes&quot; /> <exclude name= &quot;apps/**/*Test*&quot; /> </dirset> <filelist refid= &quot;third-party_jars&quot; /> </classpath>
  • 8.
  • 9. Tag javac <javac srcdir= &quot;${src}&quot; destdir= &quot;${build}&quot; /> Il tag javac è usato per compilare una o più classi: Anche con svariati attributi di compilazione: <javac sourcepath= &quot;&quot; srcdir= &quot;${src}&quot; destdir= &quot;${build}&quot; > <include name= &quot;**/*.java&quot; /> <exclude name= &quot;**/Example.java&quot; /> </javac>
  • 10. Tag property the url from which to read properties. <property url=&quot;http://www.mysite.com/bla/foo.properties&quot;/> url the filename of the property file. <property file=&quot;ant-global.properties&quot;/> <property file=&quot;${user.home}/ant-global.properties&quot;/> file the resource name of the property file. <property resource=&quot;foo.properties&quot;/> resource Sets the property to the absolute filename of the given file. <property name=&quot;src&quot; location=&quot;src&quot;/> location the value of the property. <property name=&quot;compile&quot; value=&quot;2&quot;/> value the name of the property to set. <property name=&quot;src&quot; … name Description Attribute
  • 11. Un semplice buildfile <project name= &quot;MyProject&quot; default= &quot;dist&quot; basedir= &quot;.&quot; > <description> simple example build file </description> <!-- set global properties for this build --> <property name= &quot;src&quot; location= &quot;src&quot; /> <property name= &quot;build&quot; location= &quot;build&quot; /> <property name= &quot;dist&quot; location= &quot;dist&quot; /> <target name= &quot;init&quot; > <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure --> <mkdir dir= &quot;${build}&quot; /> </target>
  • 12. Un semplice buildfile <target name= &quot;compile&quot; depends= &quot;init&quot; description= &quot;compile&quot; > <!-- Compile the java code from ${src} into ${build} --> <javac srcdir= &quot;${src}&quot; destdir= &quot;${build}&quot; /> </target> <target name= &quot;dist&quot; depends= &quot;compile&quot; description= &quot;generate the distribution&quot; > <!-- Create the distribution directory --> <mkdir dir= &quot;${dist}/lib&quot; /> <!– put ${build}into the MyProject-${DSTAMP}.jar file --> <jar jarfile= &quot;${dist}/lib/MyProject-${DSTAMP}.jar&quot; basedir= &quot;${build}&quot; /> </target>
  • 13. Un semplice buildfile <target name= &quot;clean&quot; description= &quot;clean up&quot; > <!-- Delete the ${build} and ${dist} directory --> <delete dir= &quot;${build}&quot; /> <delete dir= &quot;${dist}&quot; /> </target> </project>
  • 14.
  • 15. Esempio buildfile con più target <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <project name= &quot;EJB Mail BottegaVerde Project&quot; default= &quot;ejb-jar&quot; basedir= &quot;.&quot; > <target name= &quot;init&quot; > <!-- Project Directories --> <property name= &quot;src.dir&quot; value= &quot;${basedir}/ejbModule&quot; /> <property name= &quot;classes.dir&quot; value= &quot;${basedir}/classes&quot; /> <property name= &quot;resources.dir&quot; value= &quot;${basedir}/resources&quot; /> <!-- Archive names --> <property name= &quot;archive.name&quot; value= &quot;bottegaVerdeMail&quot; /> <!-- Sets the jboss directory from the local environment --> <property environment= &quot;env&quot; /> <!-- Override with your JBoss server dist location if JBOSS_DIST is not set --> <property name= &quot;jboss.dist&quot; value= &quot;${env.JBOSS_DIST}&quot; /> </target> <target name= &quot;compile&quot; depends= &quot;init&quot; > <mkdir dir= &quot;${classes.dir}&quot; /> <javac srcdir= &quot;${src.dir}&quot; destdir= &quot;${classes.dir}&quot; debug= &quot;on&quot; deprecation= &quot;on&quot; optimize= &quot;off&quot; > <classpath> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </javac> </target>
  • 16. Esempio buildfile con più target <target name= &quot;ejb-jar&quot; depends= &quot;compile&quot; > <delete file= &quot;${classes.dir}/${archive.name}.jar&quot; /> <jar jarfile= &quot;${classes.dir}/${archive.name}.jar&quot; > <fileset dir= &quot;${classes.dir}&quot; excludes= &quot;**/*Client.class&quot; /> <zipfileset dir= &quot;${resources.dir}&quot; prefix= &quot;META-INF&quot; includes= &quot;*.xml&quot; /> </jar> </target> <target name= &quot;deploy&quot; depends= &quot;ejb-jar&quot; > <copy file= &quot;${classes.dir}/${archive.name}.jar&quot; todir= &quot;${env.JBOSS_DIST}/server/default/deploy&quot; /> </target> <target name= &quot;undeploy&quot; > <delete file= &quot;${env.JBOSS_DIST}/server/default/deploy/${archive.name}.jar&quot; /> </target> <target name= &quot;testStateless&quot; depends= &quot;compile&quot; > <java classname= “org.ubitek.stateless.TestStatelessClient&quot; fork= &quot;yes&quot; > <classpath> <pathelement location= &quot;${classes.dir}&quot; /> <pathelement location= &quot;${resources.dir}&quot; /> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </java> </target>
  • 17. Esempio buildfile con più target <target name= &quot;testStateful&quot; depends= &quot;compile&quot; > <java classname= “org.ubitek.stateful.TestStatefulClient&quot; fork= &quot;yes&quot; > <classpath> <pathelement location= &quot;${classes.dir}&quot; /> <pathelement location= &quot;${resources.dir}&quot; /> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </java> </target> <target name= &quot;testBMP&quot; depends= &quot;compile&quot; > <java classname= &quot;org.ubitek.bmp.CDClient&quot; fork= &quot;yes&quot; > <classpath> <pathelement location= &quot;${classes.dir}&quot; /> <pathelement location= &quot;${resources.dir}&quot; /> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </java> </target> <target name= &quot;testCMP&quot; depends= &quot;compile&quot; > <java classname= &quot;com.imolinfo.entity.cmp20.CDClient&quot; fork= &quot;yes&quot; > <classpath> <pathelement location= &quot;${classes.dir}&quot; /> <pathelement location= &quot;${resources.dir}&quot; /> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </java> </target>
  • 18. Esempio buildfile con più target <target name= &quot;testMD&quot; depends= &quot;compile&quot; > <java classname= “org.ubitek.message.TestMDBean&quot; fork= &quot;yes&quot; > <classpath> <pathelement location= &quot;${classes.dir}&quot; /> <pathelement location= &quot;${resources.dir}&quot; /> <fileset dir= &quot;${jboss.dist}/client&quot; includes= &quot;**/*.jar&quot; /> </classpath> </java> </target> <target name= &quot;clean&quot; depends= &quot;init&quot; > <delete dir= &quot;${classes.dir}&quot; /> </target> </project>