Questions tagged [ant]

Apache Ant (formerly Jakarta Ant) is a declarative, XML-based build tool created originally for Java projects. It provides a rich set of standard tasks for performing most common build operations, such as compiling Java source, building archives and running tests. Ant's functionality can be extended through custom tasks and macros.

Ant

Apache Ant is a Java open-source library and command-line tool whose mission is to drive processes described in XML build files as targets and extension points dependent upon each other. Most commonly, Ant is used to build Java applications.

It supplies a number of built-in tasks allowing to compile, assemble, test and run applications. Although primarily aimed at building Java applications, Ant can also be used effectively to build non-Java software, for instance C or C++ applications.

More generally, Ant can be used to pilot any type of process which can be described in terms of targets, tasks, and macros. It's a standard and effective framework which transforms a development structure of project to a deployment structure.

Ant was historically meant as a replacement and Java counterpart for the Unix Make build utility.

References

Extensions

Example

Hello, World!

A build.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project name="HelloWorld" default="world" basedir=".">
  <target name="world" depends="message" description="outputs a friendly message">
    <echo message="World!" />
  </target>
  <target name="message">
    <echo message="Hello, " />
  </target>
</project>

This project can be run from the directory containing the build.xml file by just typing:

  • ant
  • or ant -f build.xml

The list of available self-documenting targets can be viewed with ant -p.

15413 questions
5
votes
1 answer

How to determine the version of a resolved Ivy dependency from Ant?

I have an ivy file with the following dependency: Is there any way to determine the revision that is resolved (for example 1.6.0, 1.6.1, etc) from the ant…
5
votes
1 answer

Ant build fails unnecessarily when JaCoCo determines there are no tests worth running

For a continuous integration build, we use JcCoCo to minimise the number of tests to be run. However, on some commits it determines that there are no tests worth running at all. For example, if only an image was changed. Here is a snippet from the…
WW.
  • 23,793
  • 13
  • 94
  • 121
5
votes
2 answers

Run all unit tests with Ant builder

I have a directory with a bunch of JUnit tests in my project. So far I have used separate target for each unit test. For example:
Artium
  • 5,147
  • 8
  • 39
  • 60
5
votes
3 answers

How can I compare two properties with numeric values?

How can I find out which of two numeric properties is the greatest? Here's how to check wheather two are equal:
Industrial
  • 41,400
  • 69
  • 194
  • 289
5
votes
3 answers

Multiple source folders: Avoid implicit compilation with Ant

Consider the following project layout (assuming A and B depend on each other): . |-- bin1 |-- bin2 |-- src1 | `-- A.java `-- src2 `-- B.java After compilation, I want the classes to reside in their respective folders liike this: . |-- bin1 | …
Michael Piefel
  • 18,660
  • 9
  • 81
  • 112
5
votes
4 answers

Ant failed to build

I have build a Java appliction which is using ant.jar (ant 1.8.2) classes for building android application from it's build.xml file with release as target. My Android project has been built by using android create project command, using sdk…
eyal
  • 2,379
  • 7
  • 40
  • 54
5
votes
0 answers

Setting up SDL2 on Windows Android

I was following this tutorial to setup SDL2 on Windows Android and I am facing some issues: No SDK tools package includes SDK Manager.exe anymore. And SDK Manager.exe is mentioned everywhere on the tutorial (Steps 5, 7, 8 and 12). Regarding step…
Harley Fuagras
  • 499
  • 4
  • 12
5
votes
2 answers

Excluding .git in an Ant task

I'm using Ant 1.7.1 to tar up the contents of a directory, that contains a .git subdirectory. My current task is
Rajarshi Guha
5
votes
3 answers

Why does CDT rebuild my C-project on Ant build in unrelated project?

I have an Eclipse workspace where a CDT project lives together with other unrelated projects. However, when I run "build as Ant build" in one of those projects, CDT insists on rebuilding its projects too. Anyone have any ideas where to look to…
thoni56
  • 3,145
  • 3
  • 31
  • 49
5
votes
1 answer

Finding @Ignore'd tests that are now passing

For a decent sized open source project where developers come and go, someone may fix a bug without realizing that someone else a while back committed a disabled unit test (a la @Ignore). We'd like to find the passing tests that are disabled so we…
IceArdor
  • 1,961
  • 19
  • 20
5
votes
1 answer

AssertionFailedError Forked Java VM exited abnormally for non existing test suite

This may look duplicate to something on SO however I have looked at this, this, this and this but have not found the solution that works. The problem I have is I am getting this error on jenkins for non existing test suite. Below is the error…
madteapot
  • 2,208
  • 2
  • 19
  • 32
5
votes
3 answers

How can I get current PID from within Ant?

I have an ant task, and within it I'd like to get the current process id (a la echo $PPID from command line). I'm running ksh on Solaris, so I thought I could just do this:
akaioi
  • 265
  • 4
  • 13
5
votes
3 answers

Change working directory in ant junit task

I have a ant file that runs JUnits tests. These tests rely on a relative path to certain configuration files. I've tried to set the working directory for the batch test, but fail. I want the working directory to be ${plugins.dir}/${name} The JUnit…
Fredrik
  • 10,626
  • 6
  • 45
  • 81
5
votes
3 answers

Retrieve property value from include'd / import'ed project

I am trying to use ant's include or import tasks to use a common build file. I am stuck at retrieving properties from included file. These are my non-working samples, trying to retrieve "child-property" Using ant import parent file
b10y
  • 839
  • 9
  • 19
5
votes
3 answers

how do I use ant build to execute exportReleaseBuild task in Flash Builder 4

I'm trying to do an Ant build with FlashBuilder 4 for an Export Release Build. There is supposed to be a new (in FB4) ant task fb.exportReleaseBuild that will execute the release build. Reference to the usage is…
Danny
  • 51
  • 1
  • 2