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
24
votes
9 answers

Running "pure" JUnit 4 tests using ant

We have migrated to both JUnit 4 and ant 1.7 The tests runs fine in eclipse, but the annotations are ignored when running the tests using ant. According to the Ant junit task documentation: It also works with JUnit 4.0, including "pure" JUnit 4…
LiorH
  • 18,524
  • 17
  • 70
  • 98
24
votes
4 answers

How to determine the Ant version when using Ant inside Eclipse?

How can I determine the version of Ant coming with Eclipse?
user496949
  • 83,087
  • 147
  • 309
  • 426
24
votes
5 answers

Eclipse ==> Ant plugin?

Can anybody please tell me how i can add the ant plugin to eclipse? Thanks
aryaxt
  • 76,198
  • 92
  • 293
  • 442
24
votes
2 answers

what can Phing do that Ant can't?

I'm doing PHP development and I'm thinking of using one of these. I have both PHP and Java installed on my machine. In theory I could use any of the two. What are the compelling arguments to pick Phing over Ant?
Michael Ekoka
  • 19,050
  • 12
  • 78
  • 79
24
votes
4 answers

Printing Ant target execution time

I want to print the execution time taken for each individual Ant target and its dependent targets. .... When run should show following output Target 2 - x seconds Target 3 - y…
Nirmal Patel
  • 5,128
  • 8
  • 41
  • 52
23
votes
8 answers

URLConnection FileNotFoundException for non-standard HTTP port sources

I was trying to use the Apache Ant Get task to get a list of WSDLs generated by another team in our company. They have them hosted on a weblogic 9.x server on http://....com:7925/services/. I am able to get to the page through a browser, but the…
jeffl8n
  • 916
  • 2
  • 8
  • 20
23
votes
4 answers

"Unknown Source" in java stack trace, yet line numbers are in the class file

I've written a super simple java class that is throwing exceptions as it should. However the stack trace I'm getting looks like this: java.lang.RuntimeException: hello at Main.go(Unknown Source) at Main.main(Unknown Source) Note:…
andersonbd1
  • 5,266
  • 14
  • 44
  • 62
23
votes
15 answers

Ant is not able to delete some files on windows

I have an ant build that makes directories, calls javac and all the regular stuff. The issue I am having is that when I try to do a clean (delete all the stuff that was generated) the delete task reports that is was unable to delete some files. When…
Honza
  • 4,349
  • 2
  • 24
  • 40
23
votes
2 answers

Android NDK build with ANT script

Can we use the ANT script for Android NDK builds ? If Yes how? And if no, then why Not ? I don't have any idea about it
Sachchidanand
  • 1,291
  • 2
  • 18
  • 35
23
votes
3 answers

running junits and cobertura with maven

In our project, we run both junits and cobertura using maven. The problem I am facing is that, junit test cases are running twice, once before the jar creation process and then once again for generating cobertura coverage reports. When running…
Ajay
  • 977
  • 2
  • 11
  • 23
23
votes
3 answers

how to increase ant permgen size?

how to increase ant permgen size? I have given in ANT_OPTS as -Xms768m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=128m question 1)After specifying above setting in system environment, still i am getting outof memeory error for ant target for…
TechFind
  • 3,696
  • 18
  • 47
  • 62
23
votes
3 answers

Test for floating point equality. (FE_FLOATING_POINT_EQUALITY)

I am using a findbugs in an ANT script and I can't figure out how to fix two of my errors. I have read the documentation, but don't understand. Here are my errors and the code that goes with them: Error 1: Test for floating point equality.…
taraloca
  • 9,077
  • 9
  • 44
  • 77
23
votes
4 answers

How can I develop for Android in Emacs?

I have gone through the Android guide for other IDEs, and I've got the basic build and install working fine using ant and a simple Emacs compile command. I'm aware of some of the existing tools for developing Java and XML in Emacs. I've also seen…
Matthew Flaschen
  • 278,309
  • 50
  • 514
  • 539
23
votes
6 answers

ant debugging in eclipse

I would like to know about the debugging capabilities of ANT using eclipse. Basically I have an ANT build script written by a colleague and I wanted to step through each target to see what are the various tasks that are beings called.
Jony
  • 6,694
  • 20
  • 61
  • 71
23
votes
3 answers

What is the best way to deploy JavaFX application, create JAR and self-contained applications and native installers

I'm using IntelliJ IDEA, and I have my JavaFX application ready for deployment. The problem is that when I generate the JAR file, it won't run, when I run it in the command line, I get an Exception, FXMLLoadException, although the project is working…
Jean-Baptiste-B
  • 325
  • 1
  • 3
  • 9