Using Ant Writing A Simple Buildfile: Projects
Using Ant Writing A Simple Buildfile: Projects
Projects
A project has three attributes:
Optionally, a description for the project can be provided as a top-level <description> element
(see the description type).
Each project defines one or more targets. A target is a set of tasks you want to be executed.
When starting Ant, you can select which target(s) you want to have executed. When no target is
given, the project's default is used.
Targets
A target can depend on other targets. You might have a target for compiling, for example, and a
target for creating a distributable. You can only build a distributable when you have compiled
first, so the distribute target depends on the compile target. Ant resolves these dependencies.
It should be noted, however, that Ant's depends attribute only specifies the order in which
targets should be executed - it does not affect whether the target that specifies the dependency(s)
gets executed if the dependent target(s) did not (need to) run.
Ant tries to execute the targets in the depends attribute in the order they appear (from left to
right). Keep in mind that it is possible that a target can get executed earlier when an earlier target
depends on it:
<target name="A"/>
<target name="B" depends="A"/>
<target name="C" depends="B"/>
<target name="D" depends="C,B,A"/>
Suppose we want to execute target D. From its depends attribute, you might think that first
target C, then B and then A is executed. Wrong! C depends on B, and B depends on A, so first A
is executed, then B, then C, and finally D.
In a chain of dependencies stretching back from a given target such as D above, each target gets
executed only once, even when more than one target depends on it. Thus, executing the D target
will first result in C being called, which in turn will first call B, which in turn will first call A.
After A, then B, then C have executed, execution returns to the dependency list of D, which will
not call B and A, since they were already called in process of dependency resolution for C and B
respectively as dependencies of D. Had no such dependencies been discovered in processing C
and B, B and A would have been executed after C in processing D's dependency list.
A target also has the ability to perform its execution if (or unless) a property has been set. This
allows, for example, better control on the building process depending on the state of the system
(java version, OS, command-line property defines, etc.). To make a target sense this property,
you should add the if (or unless) attribute with the name of the property that the target should
react to. Note: Ant will only check whether the property has been set, the value doesn't matter. A
property set to the empty string is still an existing property. For example:
In the first example, if the module-A-present property is set (to any value, e.g. false), the target
will be run. In the second example, if the module-A-present property is set (again, to any
value), the target will not be run.
Only one propertyname can be specified in the if/unless clause. If you want to check multiple
conditions, you can use a dependend target for computing the result for the check:
<target name="myTarget.check">
<condition property="myTarget.run">
<and>
<available file="foo.txt"/>
<available file="bar.txt"/>
</and>
</condition>
</target>
Important: the if and unless attributes only enable or disable the target to which they are
attached. They do not control whether or not targets that a conditional target depends upon get
executed. In fact, they do not even get evaluated until the target is about to be executed, and all
its predecessors have already run.
The optional description attribute can be used to provide a one-line description of this target,
which is printed by the -projecthelp command-line option. Targets without such a description
are deemed internal and will not be listed, unless either the -verbose or -debug option is used.
It is a good practice to place your tstamp tasks in a so-called initialization target, on which all
other targets depend. Make sure that target is always the first one in the depends list of the other
targets. In this manual, most initialization targets have the name "init".
If the depends attribute and the if/unless attribute are set, the depends attribute is executed first.
A target name can be any alphanumeric string valid in the encoding of the XML file. The empty
string "" is in this set, as is comma "," and space " ". Please avoid using these, as they will not be
supported in future Ant versions because of all the confusion they cause. IDE support of unusual
target names, or any target name containing spaces, varies with the IDE.
Targets beginning with a hyphen such as "-restart" are valid, and can be used to name targets
that should not be called directly from the command line.
Tasks
A task is a piece of code that can be executed.
A task can have multiple attributes (or arguments, if you prefer). The value of an attribute might
contain references to a property. These references will be resolved before the task is executed.
where name is the name of the task, attributeN is the attribute name, and valueN is the value for
this attribute.
There is a set of built-in tasks, along with a number of optional tasks, but it is also very easy to
write your own.
All tasks share a task name attribute. The value of this attribute will be used in the logging
messages generated by Ant.
Note1: If "task1" has not been run yet, then it has not been configured (ie., no attributes have
been set), and if it is going to be configured later, anything you've done to the instance may be
overwritten.
Note2: Future versions of Ant will most likely not be backward-compatible with this behaviour,
since there will likely be no task instances at all, only proxies.
Properties
A project can have a set of properties. These might be set in the buildfile by the property task, or
might be set outside Ant. 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. For example, if there is a "builddir" property with
the value "build", then this could be used in an attribute like this: ${builddir}/classes. This is
resolved at run-time as build/classes.
In the event you should need to include this construct literally (i.e. without property
substitutions), simply "escape" the '$' character by doubling it. To continue the previous
example:
<echo>$${builddir}=${builddir}</echo>
will echo this message:
${builddir}=build/classes
In order to maintain backward compatibility with older Ant releases, a single '$' character
encountered apart from a property-like construct (including a matched pair of french braces) will
be interpreted literally; that is, as '$'. The "correct" way to specify this literal character, however,
is by using the escaping mechanism unconditionally, so that "$$" is obtained by specifying "$$$
$". Mixing the two approaches yields unpredictable results, as "$$$" results in "$$".
Built-in Properties
Ant provides access to all system properties as if they had been defined using a <property>
task. For example, ${os.name} expands to the name of the operating system.
There is also another property, but this is set by the launcher script and therefore maybe not set
inside IDEs:
Example Buildfile
<project name="MyProject" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Notice that we are declaring properties outside any target. As of Ant 1.6 all tasks can be declared
outside targets (earlier version only allowed <property>,<typedef> and <taskdef>). When you
do this they are evaluated before any targets are executed. Some tasks will generate build failures
if they are used outside of targets as they may cause infinite loops otherwise (<antcall> for
example).
We have given some targets descriptions; this causes the projecthelp invocation option to list
them as public targets with the descriptions; the other target is internal and not listed.
Finally, for this target to work the source in the src subdirectory should be stored in a directory
tree which matches the package names. Check the <javac> task for details.
Token Filters
A project can have a set of tokens that might be automatically expanded if found when a file is
copied, when the filtering-copy behavior is selected in the tasks that support this. These might be
set in the buildfile by the filter task.
Since this can potentially be a very harmful behavior, the tokens in the files must be of the form
@token@, where token is the token name that is set in the <filter> task. This token syntax
matches the syntax of other build systems that perform such filtering and remains sufficiently
orthogonal to most programming and scripting languages, as well as with documentation
systems.
Note: If a token with the format @token@ is found in a file, but no filter is associated with that
token, no changes take place; therefore, no escaping method is available - but as long as you
choose appropriate names for your tokens, this should not cause problems.
Warning: If you copy binary files with filtering turned on, you can corrupt the files. This feature
should be used with text files only.
Path-like Structures
You can specify PATH- and CLASSPATH-type references using both ":" and ";" as separator
characters. Ant will convert the separator to the correct character of the current operating system.
Wherever path-like values need to be specified, a nested element can be used. This takes the
general form of:
<classpath>
<pathelement path="${classpath}"/>
<pathelement location="lib/helper.jar"/>
</classpath>
The location attribute specifies a single file or directory relative to the project's base directory
(or an absolute filename), while the path attribute accepts colon- or semicolon-separated lists of
locations. The path attribute is intended to be used with predefined paths - in any other case,
multiple elements with location attributes should be preferred.
As a shortcut, the <classpath> tag supports path and location attributes of its own, so:
<classpath>
<pathelement path="${classpath}"/>
</classpath>
<classpath path="${classpath}"/>
In addition, one or more Resource Collections can be specified as nested elements (these must
consist of file-type resources only). Additionally, it should be noted that although resource
collections are processed in the order encountered, certain resource collection types such as
fileset, dirset and files are undefined in terms of order.
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<filelist refid="third-party_jars"/>
</classpath>
This builds a path that holds the value of ${classpath}, followed by all jar files in the lib
directory, the classes directory, all directories named classes under the apps subdirectory of $
{build.dir}, except those that have the text Test in their name, and the files specified in the
referenced FileList.
If you want to use the same path-like structure for several tasks, you can define them with a
<path> element at the same level as targets, and reference them via their id attribute--see
References for an example.
A path-like structure can include a reference to another path-like structure (a path being itself a
resource collection) via nested <path> elements:
<path id="base.path">
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
</path>
<path id="tests.path">
<path refid="base.path"/>
<pathelement location="testclasses"/>
</path>
The shortcuts previously mentioned for <classpath> are also valid for <path>.For example:
<path id="base.path">
<pathelement path="${classpath}"/>
</path>
can be written as:
<path id="base.path" path="${classpath}"/>
Path Shortcut
In Ant 1.6 a shortcut for converting paths to OS specific strings in properties has been added.
One can use the expression ${toString:pathreference} to convert a path element reference to a
string that can be used for a path argument. For example:
<path id="lib.path.ref">
<fileset dir="lib" includes="*.jar"/>
</path>
<javac srcdir="src" destdir="classes">
<compilerarg arg="-Xbootstrap/p:${toString:lib.path.ref}"/>
</javac>
Command-line Arguments
Several tasks take arguments that will be passed to another process on the command line. To
make it easier to specify arguments that contain space characters, nested arg elements can be
used.
It is highly recommended to avoid the line version when possible. Ant will try to split the
command line in a way similar to what a (Unix) shell would do, but may create something that is
very different from what you expect under some circumstances.
Examples
is a single command-line argument containing a space character, not separate commands "-l" and
"-a".
This is a command line with two separate arguments, "-l" and "-a".
<arg path="/dir;/dir2:\dir3"/>
References
Any project element can be assigned an identifier using its id attribute. In most cases the
element can subsequently be referenced by specifying the refid attribute on an element of the
same type. This can be useful if you are going to replicate the same snippet of XML over and
over again--using a <classpath> structure more than once, for example.
All tasks that use nested elements for PatternSets, FileSets, ZipFileSets or path-like structures
accept references to these structures as shown in the examples. Using refid on a task will
ordinarily have the same effect (referencing a task already declared), but the user should be
aware that the interpretation of this attribute is dependent on the implementation of the element
upon which it is specified. Some tasks (the property task is a handy example) deliberately assign
a different meaning to refid.
Don't add anything to the CLASSPATH environment variable - this is often the reason for very
obscure errors. Use Ant's own mechanisms for adding libraries:
The goal
The goal is to write a task, which searchs in a path for a file and saves the location of that file in
a property.
Build environment
We can use the buildfile from the other tutorial and modify it a little bit. That's the advantage of
using properties - we can reuse nearly the whole script. :-)
Property access
Our first step is to set a property to a value and print the value of that property. So our scenario
would be
So what to do? Handling three attributes (property, value, print) and an execute method. Because
this is only an introduction example I don't do much checking:
import org.apache.tools.ant.BuildException;
(by the way: a short word to ants "namespaces" (don't be confused with xml namespaces: an
<antcall> creates a new space for property names. All properties from the caller are passed to
the callee, but the callee can set its own properties without notice by the caller.)
There are some other setter, too (but I haven't used them, so I can't say something to them,
sorry :-)
After putting our two line example from above into a target names use.simple we can call that
from our testcase:
import org.apache.tools.ant.BuildFileTest;
Using filesets
Ant provides a common way of bundling files: the fileset. Because you are reading this tutorial I
think you know them and I don't have to spend more explanations about their usage in buildfiles.
Our goal is to search a file in path. And on this step the path is simply a fileset (or more precise:
a collection of filesets). So our usage would be
What do we need? A task with two attributes (file, location) and nested filesets. Because we had
attribute handling already explained in the example above and the handling of nested elements is
described in the other tutorial the code should be very easy:
In the other tutorial we have reused the already written targets of our buildfile. Now we will
configure most of the testcases via java code (sometimes it's much easier to write a target than
doing it via java coding). What can be tested?
not valid configured task (missing file, missing location, missing fileset)
don't find a present file
behaviour if file can't be found
Maybe you find some more testcases. But this is enough for now.
For each of these points we create a testXX method.
public class FindTest extends BuildFileTest {
If we run this test class all test cases (except testFileNotPresent) fail. Now we can implement our
task, so that these test cases will pass.
Ok, much more easier in this simple case would be to add the file as additional include element
to all filesets. But I wanted to show how to handle complex situations whithout being
complex :-)
The test case uses the ant property ant.home as reference. This property is set by the Launcher
class which starts ant. We can use that property in our buildfiles as a build-in property [3]. But if
we create a new ant environment we have to set that value for our own. And we use the <junit>
task in fork-mode. Therefore we have do modify our buildfile:
On *1 we rename only the vector. It�s just for better reading the source. On *2 we have to
provide the right method: an addName(Type t). Therefore replace the fileset with path here.
Finally we have to modify our buildfile on *3 because our task doesn�t support nested filesets
any longer. So we wrap the fileset inside a path.
And now we modify the testcase. Oh, not very much to do :-) Renaming the
testMissingFileset() (not really a must-be but better it�s named like the think it does) and
update the expected-String in that method (now a path not set message is expected). The more
complex test cases base on the buildscript. So the targets testFileNotPresent and
testFilePresent have to be modified in the manner described above.
The test are finished. Now we have to adapt the task implementation. The easiest modification is
in the validate() method where we change le last line to if (paths.size()<1) throw new
BuildException("path not set");. In the execute() method we have a little more work. ...
mmmh ... in reality it's lesser work, because the Path class does the whole DirectoryScanner-
handling and creating-absolute-paths stuff for us. So the execute method is just:
Of course we have to do the typecase to Path on //1. On //2 and //3 we see that the Path class
does the work for us: no DirectoryScanner (was at 2) and no creating of the absolute path (was at
3).
Returning a list
So far so good. But could a file be on more than one place in the path? - Of course.
And would it be good to get all of them? - It depends on ...
In this section we will extend that task to support returning a list of all files. Lists as property
values are not supported by Ant natively. So we have to see how other tasks use lists. The most
famous task using lists is Ant-Contribs <foreach>. All list elements are concatenated and
separated with a customizable separator (default ',').
So we do the following:
If the delimiter is set we will return all found files as list with that delimiter.
Therefore we have to
So we add as testcase:
in the buildfile:
<target name="test.init">
<mkdir dir="test1/dir11/dir111"/> *1
<mkdir dir="test1/dir11/dir112"/>
...
<touch file="test1/dir11/dir111/test"/>
<touch file="test1/dir11/dir111/not"/>
...
<touch file="test1/dir13/dir131/not2"/>
<touch file="test1/dir13/dir132/test"/>
<touch file="test1/dir13/dir132/not"/>
<touch file="test1/dir13/dir132/not2"/>
<mkdir dir="test2"/>
<copy todir="test2"> *2
<fileset dir="test1"/>
</copy>
</target>
Now we need a directory structure where we CAN find files with the same name in different
directories. Because we can't sure to have one we create one on *1 and *2. And of course we
clean up that on *4. The creation can be done inside our test target or in a separate one, which
will be better for reuse later (*3).
The algorithm does: finding all files, creating the return value depending on the users wish,
returning the value as property. On //1 we eliminates the duplicates. //2 ensures that we create the
return value only if we have found one file. On //3 we iterate over all found files and //4 ensures
that the last entry has no trailing delimiter.
Ok, first searching for all files and then returning only the first one ... You can tune the
performance of your own :-)
Documentation
A task is useless if the only who is able to code the buildfile is the task developer (and he only
the next few weeks :-). So documentation is also very important. In which form you do that
depends on your favourite. But inside Ant there is a common format and it has advantages if you
use that: all task users know that form, this form is requested if you decide to contribute your
task. So we will doc our task in that form.
If you have a look at the manual page of the java [5] task you will see
it is plain html
starts with the name
has sections: description, parameters, nested elements, (maybe return codes) and (most
important :-) examples
parameters are listed in a table with columns for attribute name, its description and whether it's
required (if you add a feature after an Ant release, provide a since Ant xx statement when
it's introduced)
describe the nested elements (since-statement if necessary)
provide one or more useful examples; first code then description
As a template we have:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title> Taskname Task</title>
</head>
<body>
<h2><a name="taskname">Taskname</a></h2>
<h3>Description</h3>
<p> Describe the task.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
</table>
<h3>Examples</h3>
<pre>
A code sample; don't forget to escape the < of the tags with <
</pre>
what should that example do?
</body>
</html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title> Find Task</title>
</head>
<body>
<h2><a name="find">Find</a></h2>
<h3>Description</h3>
<p>Searchs in a given path for a file and returns the absolute to it as
property.
If delimiter is set this task returns all found locations.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">The name of the file to search.</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">location</td>
<td valign="top">The name of the property where to store the location</td>
<td align="center" valign="top">yes</td>
</tr>
<tr>
<td valign="top">delimiter</td>
<td valign="top">A delimiter to use when returning the list</td>
<td align="center" valign="top">only if the list is required</td>
</tr>
</table>
<h4>path</h4>
<p>The path where to search the file.</p>
<h3>Examples</h3>
<pre>
<find file="ant.jar" location="loc">
<path>
<fileset dir="${ant.home}"/>
<path>
</find>
</pre>
Searches in Ants home directory for a file <i>ant.jar</i> and stores its
location in
property <i>loc</i> (should be ANT_HOME/bin/ant.jar).
<pre>
<find file="ant.jar" location="loc" delimiter=";">
<path>
<fileset dir="C:/"/>
<path>
</find>
<echo>ant.jar found in: ${loc}</echo>
</pre>
Searches in Windows C: drive for all <i>ant.jar</i> and stores their locations
in
property <i>loc</i> delimited with <i>';'</i>. (should need a long time :-)
After that it prints out the result (e.g. C:/ant-1.5.4/bin/ant.jar;C:/ant-
1.6/bin/ant.jar).
</body>
</html>
Now we will check the "Checklist before submitting a new task" described in that guideline.
Package / Directories
This task does not depend on any external library. Therefore we can use this as a core task. This
task contains only one class. So we can use the standard package for core tasks:
org.apache.tools.ant.taskdefs. Implementations are in the directory src/main, tests in
src/testcases and buildfiles for tests in src/etc/testcases.
Now we integrate our work into Ants distribution. So first we do an update of our cvs tree. If not
done yet, you have to checkout the ant module from Apaches cvs server as described in Access
the Source Tree (AnonCVS) [8] (password is anoncvs):
cvs -d :pserver:[email protected]:/home/cvspublic
login //1
cvs -d :pserver:[email protected]:/home/cvspublic checkout
ant //2
If you have a local copy of Ants sources just do an update
cvs -d :pserver:[email protected]:/home/cvspublic login
cd
ant //3
cvs -d :pserver:[email protected]:/home/cvspublic
update //4
We use the -d flag on //1 to specifiy the cvs directory. You can specify the environment variable
CVSROOT with that value and after that you haven�t to use that flag any more. On //2 we get
the whole cvs tree of ant. (Sorry, but that uses a lot of time ... 10 up to 30 minutes are not
unusual ... but this has to be done only once :-). A cvs update doesn't use a modulename but you
have to be inside the directory. Therefore we go into that on //3 and do the update on //4.
Now we will build our Ant distribution and do a test. So we can see if there are any tests failing
on our machine. (We can ignore these failing tests on later steps; windows syntax used here-
translate to xNIX if needed):
ANTHOME> build // 1
ANTHOME> set ANT_HOME=%CD%\dist // 2
ANTHOME> ant test -Dtest.haltonfailure=false // 3
First we have to build our Ant distribution (//1). On //2 we set the ANT_HOME environment
variable to the directory where the new created distribution is stored (%CD% is expanded to the
current directory on Windows 2000 and XP, on 9x and NT write it out). On //3 we let Ant do all the
tests (which enforced a compile of all tests) without stopping on first failure.
Next we apply our work onto Ants sources. Because we haven't modified any, this is a relative
simple step. (Because I have a local copy of Ant and usually contribute my work, I work on the
local copy just from the beginning. The advantage: this step isn't necessary and saves a lot of
work if you modify existing source :-).
move the Find.java to ANTHOME/src/main/org/apache/tools/ant/taskdefs/Find.java
move the FindTest.java to
ANTHOME/src/testcases/org/apache/tools/ant/taskdefs/FindTest.java
move the build.xml to ANTHOME/src/etc/testcases/taskdefs/find.xml (!!! renamed !!!)
add a package org.apache.tools.ant.taskdefs; at the beginning of the two java files
delete all stuff from find.xml keeping the targets "testFileNotPresent", "testFilePresent",
"test.init" and "testMultipleFiles"
delete the dependency to "use.init" in the find.xml
in FindTest.java change the line configureProject("build.xml"); to
configureProject("src/etc/testcases/taskdefs/find.xml");
move the find.html to ANTHOME/docs/manual/CoreTasks/find.html
add a <a href="CoreTasks/find.html">Find</a><br> in the
ANTHOME/docs/manual/coretasklist.html
And ... oh, all tests fail: Ant could not find the task or a class this task relies upon.
Ok: in the earlier steps we told Ant to use the Find class for the <find> task (remember the
<taskdef> statement in the "use.init" target). But now we want to introduce that task as a core
task. And nobody wants to taskdef the javac, echo, ... So what to do? The answer is the
src/main/.../taskdefs/default.properties. Here is the mapping between taskname and
implementing class done. So we add a find=org.apache.tools.ant.taskdefs.Find as the
last core task (just before the # optional tasks line). Now a second try:
ANTHOME> build // 1
ANTHOME> ant run-single-test
-Dtestcase=org.apache.tools.ant.taskdefs.FindTest
-Dtest.haltonfailure=false
We have to rebuild (//1) Ant because the test look in the %ANT_HOME%\lib\ant.jar (more precise:
on the classpath) for the properties file. And we have only modified it in the source path. So we have
to rebuild that jar. But now all tests pass and we check whether our class breaks some other tests.
ANTHOME> ant test -Dtest.haltonfailure=false
Because there are a lot of tests this step requires a little bit of time. So use the run-single-test during
development and do the test only at the end (maybe sometimes during development too). We use
the -Dtest.haltonfailure=false here because there could be other tests fail and we have to look into
them.
This test run should show us two things: our test will run and the number of failing tests is the
same as directly after the cvs update (without our modifications).
Clean the ANT_HOME variable, delete the build, bootstrap and dist directory and point
JAVA_HOME to the JDK 1.2 home directory. Then do the build, set ANT_HOME and run ant
test (like above).
Checkstyle
There are many things we have to ensure. Indentation with 4 spaces, blanks here and there, ... (all
described in the Ant Task Guidelines [7] which includes the Sun code style [10]). Because there
are so many things we would be happy to have a tool for do the checks. There is one: checkstyle.
Checkstyle is available at Sourceforge [11] and Ant provides with the check.xml a buildfile
which will do the job for us.
Download it and put the checkstyle-*-all.jar into your %USERPROFILE%\.ant\lib directory. All
jar's stored there are available to Ant so you haven't to add it to you %ANT_HOME%\lib
directory (this feature was added with Ant 1.6).
Hint: start at the buttom of the file so the line numbers in the report will keep up to date and you
will find the next error place much more easier without redoing the checkstyle.
After cleaning up the code according to the messages we delete the reports directory and do a
second checkstyle run. Now our task isn't listed. That's fine :-)
all files needed to Archive containing a patch with the new and modified
attachements
apply the path resources
Sending an email with these information is very easy and I think I haven't to show that. The other
way - BugZilla - is slightly more difficult. But it has the advantage that entries will not be
forgotten (once per week a report is generated). So I will show this way.
You must have a BugZilla account for that. So open the BugZilla Main Page [12] and follow the
link Open a new Bugzilla account [13] and the steps described there if you haven't one.
1. From the BugZilla main page choose Enter a new bug report [14]
2. Choose "Ant" as product
3. Version is the last "Alpha (nightly)" (at this time 1.7)
4. Component is "Core tasks"
5. Plattform and Severity are ok with "Other" and "Normal"
6. Initial State is ok with "New"
7. Same with the empy "Assigned to"
8. It is not required to add yourself as CC, because you are the reporter and therefore will be
informed on changes
9. URL: no url required
10. Summary: add the subject from the table
11. Description: add the body from the table
12. Then press "Commit"
13. After redirecting to the new created bug entry click "Create a New Attachment"
14. Enter the path to your local path file into "File" or choose it via the "File"'s button.
15. Enter a short description into "Description", so that you could guess, what the path file includes.
Here we could add "Initial Patch".
16. The "Content Type" is "auto-detect". You could use the "patch" type, if you only provide a single
path file, but we want do upload more that one, included in our patch.zip.
17. Then press "Commit"
Resources
[1] tutorial-writing-tasks.html
[2] tutorial-tasks-filesets-properties.zip
[3] using.html#built-in-props
[4] http://ant-contrib.sourceforge.net/
[5] CoreTasks/java.html
[6] CoreTasks/find.html
[7] ../ant_task_guidelines.html
[8] http://ant.apache.org/cvs.html
[9] http://java.sun.com/products/archive/index.html
[10] http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
[11] http://checkstyle.sourceforge.net/
[12] http://issues.apache.org/bugzilla/
[13] http://issues.apache.org/bugzilla/createaccount.cgi
[14] http://issues.apache.org/bugzilla/enter_bug.cgi