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

Delete duplicate files using ant?

Is there a way to delete duplicate files using ant? Specifically, if I have the same file name in two different output directories, I want to delete it from the second directory.
Craig P. Motlin
  • 26,452
  • 17
  • 99
  • 126
5
votes
4 answers

Ant debug and ant release failed

I am trying to generate apk on command line using ant. I am able to use ant clean but for ant debug and ant release command I am getting following error. BUILD FAILED C:\Android\sdk\tools\ant\build.xml:649: The following error occurred while…
Ragini
  • 188
  • 2
  • 7
5
votes
2 answers

What ant target does netbeans "Clean & Build" call?

I am trying to automatically copy files after the "dist" directory has been created and populated. The provided ant targets "-post-jar" and "-post-compile" seem to run before the dist directory is created. I can't find the actual build target in…
5
votes
3 answers

How to start and stop jboss server using Ant task?

I need to stop, deploy my ear file and start Jboss server using the Ant tasks. I am able to compile, build and deploy my J2EE application as an ear file into the JBoss server successfully using Ant tasks. We can see the redeployment of my…
Puru
  • 8,913
  • 26
  • 70
  • 91
5
votes
3 answers

eclipse external tools configurations -> referenced library in classpath does not exist: org.eclipse.swt

After updating to the latest eclipse mars release Version: Mars Release Candidate 1 (4.5.0RC1) Build id: 20150521-1252 I am not able to start any Ant Script. It always results in the following error: First I checked if the path is really correct,…
crusam
  • 6,140
  • 6
  • 40
  • 68
5
votes
1 answer

Jmeter remote Execution -- Is there any way to provide global property from ant?

In my Jmeter script I'm using property function i.e. ${__P(varName,2)} to specify variable value at run time. When Executing script from CMD -- I can specify property value using -JvarName (i.e. -JvarName=5) and for remote Execution I can…
Devang
  • 365
  • 2
  • 6
  • 26
5
votes
2 answers

Calling Ant Macrodef from Gradle

I can't seem to find a way to list and/or call an Ant Macrodef from within my Gradle script. The Gradle User Guide talks about Macrodefs but does not provide an example anywehere. Could anyone tell me how to accomplish this? At the moment I import…
HELOX
  • 529
  • 2
  • 13
5
votes
1 answer

http authentication between using ant/ivy retrieving dependency from nexus?

I have an issue when attempting to retrieve a dependency from a nexus repository when running ant with ivy. the dependency is never resolved, when running with verbose output the suspect line is '[ivy:retrieve] authentication: k='@' c='null'. I…
Gareth
  • 61
  • 3
5
votes
3 answers

junit gives error java.lang.NoClassDefFoundError: junit/framework/JUnit4TestAdapterCache

I'm trying to run a simple unit test to my project at https://github.com/cdwijayarathna/oj4j. I added both junit-4.12.jar and ant-junit4.jar to the lib folder. But when I ran "rake run_tests", I'm getting following error at the report location I…
Chamila Wijayarathna
  • 1,815
  • 5
  • 30
  • 54
5
votes
1 answer

How to copy hidden resource files in gradle?

I am using gradle Java plugin. I see that gradle does not copy hidden (starting with .) files from test/resources directory to build/resources/test directory. Ant has an option to use defaultExcludes = 'no' to force copy of all files. How do I do…
codefx
  • 9,872
  • 16
  • 53
  • 81
5
votes
0 answers

Cordova error (ERROR building one of the platforms)

I have been building my phonegap app in node.js without any problem. Suddenly when I tried to build now, it is showing some error and apk is not getting created. Here is the error : C:\testapp\platforms\android\cordova\node_modules\q\q.js:126 …
V.V
  • 107
  • 1
  • 1
  • 10
5
votes
3 answers

ant error "The syntax of the command is incorrect." on running ant.bat

I tried various ant versions and also tried running the command directly from ant_home/bin directory, but no luck only below error: ant error "The syntax of the command is incorrect." on running ant.bat kindly help on this, I am not finding anything…
iRajeev
  • 191
  • 1
  • 6
5
votes
3 answers

Groovy in Ant build.xml (with Java classes)

I have to include Groovy classes into existing Java apps, and include Groovy into Ant's build.xml file. What is the best way to configure Ant's build.xml for it? Update: Are there more specifics in combining Java and Groovy compilations? Sequence…
Tatyana Solovyeva
  • 231
  • 1
  • 5
  • 8
5
votes
1 answer

warning: unmappable character for encoding ASCII

I encounter this error (warning: unmappable character for encoding ASCII) when compiling the files using apache-ant-1.7.0 through hudson build server can anyone advise on how to resolve this? I am able to build successfully using windows machine.
dfdfd
  • 71
  • 2
  • 4
5
votes
2 answers

Can ivy or ivyDE add related jars into JAVA build path library automatically in Eclipse?

For example, when I open a well developed opensource project (like lucene) into Eclipse (with both ant build.xml and ivy ivysetting.xml), I can run ant with build.xml to build the whole project successfully. However, the project is full of errors in…
1 2 3
99
100