Changes

Jump to: navigation, search

User:Minooz/RepoSyncProj/Ant

945 bytes added, 13:21, 15 October 2010
CI System Project Related
<echo>Files foo.txt and bar.txt are present.</echo>
</target>
 
<target name="myTarget.check">
</target>
</source>
 
 
:A project can have a set of properties
:A ''property'' has a name and a value; the name is case-sensitive. Properties may be used in the value of task attributes. This is done by placing the property name between "${" and "}" in the attribute value. Example:
::This could be used in an attribute like this: ${builddir}/classes
::This is resolved at run-time as c:/test/classes
==Tips==
:In Cygwin in the ''build'' folder. Just typing <code>ant</code>, will build the default target of the project. But typing <code>ant assign1.test</code> for example, will start from mentioned target.
:Also, option -f will build any files that's not named ''build.xml'' e.g. <code>ant -f buildHudson.xml</code>
:We can create a new ant script e.g. ''buildHudson.xml'' that triggers the target(assign1.test) of main build file(build.xml) of the project. See below:
<source lang=java>
<project name="assign1MyProject" default="init" basedir="." default> <description> simple example build file </description> <!-- set global properties for this build --> <property name="src" location="myTargetsrc"/> <property name="build" location="build"/> <target name="assign1.build.callinit"> <!-- Call Create the target that does everything build directory structure used by compile --> <ant antfilemkdir dir="${build.xml}" /> </target> <target name="compile" depends="init" description="comp-source "> <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="assign1.test${build}"/> </target> <target name="myTarget.checkclean" dependsdescription="assign1.build.callclean up"> <echo!-- Delete the ${build} directory tree -->The assign1. <delete dir="${build was called!<}"/echo>
</target>
</project>
</source>
 
==ANT & Mercurial==
:[http://ant4hg.free.fr/index.html ANT4HG] is an ANT task for HG ( mercurial ).
: How to add ant4hg tasks to ant:
::1- Download binaries. Latest version is ant4hg V0.07. It has been released with ant 1.8.0 and hg 1.5.1. Source code and binaries are available on the [http://sourceforge.net/projects/ant4hg/files/SourceForge download page].
::2- Copy ant4hg-Vx.y.jar to the ant lib directory
::3- Consider using : <code> <taskdef resource="net/sourceforge/ant4hg/taskdefs/antlib.xml"/></code> instead of: <code> <taskdef resource="net/sourceforge/ant4hg/antlib.xml"/> </code>.
::4- Available tasks and the instruction of using them can be found in this [http://ant4hg.free.fr/specifications.html documentation].
 
==Tips==
:In Cygwin in the ''build'' folder. Just typing <code>ant</code>, will build the default target of the project. But typing <code>ant assign1.test</code> for example, will start from mentioned target.
:Also, option -f will build any files that's not named ''build.xml'' e.g. <code>ant -f buildHudson.xml</code>
1
edit

Navigation menu