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

Changing location of Clover instrumented classes

I'm using Clover 2.5 and I've got a target that will package up the binary files. However, at the moment, it seems that the Clover instrumented classes are being generated in the same output directory as the un-instrumented classes that I wish to…
digiarnie
  • 22,305
  • 31
  • 78
  • 126
5
votes
1 answer

Ant; how to specify a file is executable so I don't have to chmod+x each time

When build my application with Ant, it produces a ZIP file. I have a sh file inside this zip, that is included as part of the build process. After each build I have to do chmod +x myFile.sh as ant fails to retain its original executable…
Jimmy
  • 16,123
  • 39
  • 133
  • 213
5
votes
1 answer

Run android manifest merger as a stand-alone application

I have Ant project with many modules. I'm trying to merge some modules into bigger ones and reduce their numbers. Can I run android manifest merger as a stand-alone application and merge manifests specified as arguments? For example i have…
Bresiu
  • 2,123
  • 2
  • 19
  • 31
5
votes
1 answer

Ant command not found in bash (windows 32bit)

I installed Apache ant using the link http://www.mkyong.com/ant/how-to-install-apache-ant-on-windows/ I am trying to build my files in git bash. It shows the following error when I type ant: bash:ant:command not found I want to use cd build…
Sheena Agrawal
  • 700
  • 1
  • 7
  • 15
5
votes
1 answer

JAXB Ant Task Error: xjc2 [ERROR] null unknown location

When binding on some valid XML documents using Ant's xjc2 task, I get the following failure message: [xjc2] [ERROR] null [xjc2] unknown location The documents are very similar to other files which have bound successfully, all imported schemas…
Tom Tresansky
  • 19,364
  • 17
  • 93
  • 129
5
votes
3 answers

JBoss Arquillian integration with Apache Ant and Junit

Has anyone managed to integrate Arquillian with Ant and JUnit? If so, could you provide an example?
user418593
  • 51
  • 1
  • 3
5
votes
2 answers

running applet via ant from eclipse

i would like to launch an applet in an build.xml like this: (at least that is how it works in netbeans) but i get the error message: [java] JVM args ignored when same JVM…
clamp
  • 33,000
  • 75
  • 203
  • 299
5
votes
2 answers

Android library projects custom builds

I have a legacy application and need to split it into a library project (common code) and two application projects (paid and free applications). I don't use Eclipse for development, and also don't use Ant builds provided (generated) by Android SDK…
5
votes
3 answers

Using Ant tasks with Flash Builder 4

Can someone help me get started with using ant in Flash Builder 4. I have never used ant before so I'm a complete novice. I will need to know how to get it installed in the first place, and how to do the basics. Any help is appreciated.
Neil
  • 7,861
  • 4
  • 53
  • 74
5
votes
1 answer

assertNotEquals static import causing compile error

I have a file Foo.java which compiles with no errors. But when I add the single line import static org.junit.Assert.assertNotEquals; This causes the following error from my ant build: compileTests: [javac] Compiling 27 source files to…
MatTheWhale
  • 967
  • 6
  • 16
5
votes
1 answer

How to include http library in Android Project using M preview in Eclipse ant build

With Android M Google has deprecated support for http library. To support existing applications use this library they have documented that using GRADLE build we can add support to http library by using following parameter. android{ useLibrary…
sundeep
  • 601
  • 1
  • 8
  • 21
5
votes
1 answer

Why JUnit 4.11 is not working in Ant build file, but JUnit 4.8.2 is working fine?

I am using IntelliJ for the Java Projects. As I am new to Java, I tried Ant as a build tool in my project. When I am using Junit 4.11 in my Ant build file, I am getting the following errors: [javac]…
Rajat Gupta
  • 1,909
  • 2
  • 18
  • 30
5
votes
2 answers

Cannot Upload a file using Jax-RS

I want to use jersey framework. I´m running a web Service, using an ant app, on Java EE7. My application server is Glassfish My method look like this: package mypackage.service; ... import…
Goldbones
  • 1,407
  • 3
  • 21
  • 55
5
votes
3 answers

In Ant, does the order of tasks inside a target matter?

I want to make a target to restart tomcat6. Right now, I have something like this: ...
Matthew
  • 28,056
  • 26
  • 104
  • 170
5
votes
1 answer

javalangClassFormatError: Invalid Constant Pool entry Type 18

i just comitted a new version of my code into my git repository and pushed it to the server. jenkins started to build my tests as expected but suddenly failed with the following stack trace: java.lang.ClassFormatError: Invalid Constant Pool entry…
Nico Krebs
  • 111
  • 1
  • 4
1 2 3
99
100