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

Error creating jar archive contains more than 65535 entries

I am trying to build a jar file and getting error Build Failed. Problem creating jar: archive contains more than 65535 entries. (and the archive is probably corrupt but I could not delete it) I am using Eclipse Neon Release 1 with JDK 1.8.0_101 and…
Varun J
  • 51
  • 1
  • 4
5
votes
1 answer

Junit test fails but build is successful (Ant)

Hi i'm quite new to using ant, my instructor wanted us to use it to do some tasks like build the class, run tests..etc and i am really confused since i cant make the junit work. i have read several other posts and sources but it makes me even more…
Paul
  • 51
  • 1
  • 3
5
votes
4 answers

BuildException when executing Ant task

I have installed Apache Ant and set the correctly the Path, CLASS_PATH and ANT_PATH variables. When I run a jar task in a command line within my project folder where the build.xml file is, I get the following error: BUILD FAILED C:\Documents and…
Anto
  • 4,265
  • 14
  • 63
  • 113
5
votes
1 answer

Can I use Travis CI with Java without using ANT or Maven?

I have a very simple project, with just 8 Java files and a few images. No build tools, I just do javac in terminal. Is it possible to just build those? Otherwise, how would I convert my project to ANT or Maven? I'm confused, thanks.
HiWorld
  • 73
  • 3
5
votes
3 answers

Writing an Eclipse-aware Ant task

I would like to write a simple Ant task that would interact with an Eclipse workspace to get some information from it. I would like to be able to use the various Eclipse API's (for example, IWorkspace). My question is what would be the simplest way…
Isaac
  • 16,458
  • 5
  • 57
  • 81
5
votes
1 answer

How to invoke Ant in Jenkins pipeline job using groovy script?

I am changing my Freestyle Jenkins job configuration to Pipeline. I need to Invoke Ant to perform LogPublisherTask and ArtifactFilePublisherTask. How is it performed using Groovy scripting?
Shruthi
  • 61
  • 1
  • 1
  • 5
5
votes
3 answers

Eclipse Neon with JDK 7 or below

When I compile / run the build on ant with eclipse neon on JDK 7 and below I got error message saying Unsupported must run on 1.8 or higher. If I changed my ant and jdk to 8 on ant I got unsupported minior/major version.... Is there a way to build…
logger
  • 1,983
  • 5
  • 31
  • 57
5
votes
2 answers

Beginning Hibernate 3.5 - Problems with ant task

I'm trying to work through "Beginning Hibernate 3.5", and I've hit an initial snag. When I run ant exportDDL, I get the following error: exportDDL: [htools] Executing Hibernate Tool with a Hibernate Annotation/EJB3 Configuration [htools] 1.…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
5
votes
2 answers

Ant exec task: How to break one long argument into multiple lines

In my Ant skript, i'm executing a program, passing some arguments, of which one is a very long argument:
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
5
votes
5 answers

Error when building a Cordova Android project

Hi i'm trying to build a cordova project with android plugin in windows 7 with the following environment ANDROID_HOME=D:\DevTools\Android\Android_SDK_NDK\android-sdk JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45 i generated a cordova project…
Gowtham S
  • 923
  • 14
  • 39
5
votes
5 answers

How to build/test Scala without IDE dependence?

I'm well into learning Scala now and enjoying it very much; I hope to start future projects in it, rather than Java. What I'm enjoying less is the (relatively) poor IDE support. I've found both IDEA and Eclipse with the Scala Plugin (including…
Pengin
  • 4,692
  • 6
  • 36
  • 62
5
votes
2 answers

JavaFX eclipse customize deployed package with wix

I am using Eclipse 4.5.2 to deploy JavaFX application (JDK 1.8). I want to change an IniFile during the installation. Ant task or JavaFX deploy is generating a dynamic wxi file which will be included in wxs file. When I customize my wxs file it is…
Sebastian Siemens
  • 2,302
  • 1
  • 17
  • 24
5
votes
2 answers

How do I copy a directory from one location to another using Ant?

I am looking to copy a directory from one location to another. However, after looking at "copy" and "copyDir" (which is deprecated) it seems that Ant, by default, only copies the content of one location to another, not the actual directory (and…
sjwb
  • 91
  • 2
  • 4
5
votes
0 answers

Creating JavaFX fat jar using Ant

I have question. How to make fat jar for JavaFX app using Ant? I know that in Internet is a few tutrials, but it concerns Java apps, not JavaFX apps. I conlude that is difference, because i tried to follow this tutorials, and it works for Java apps,…
MikolajMGT
  • 113
  • 2
  • 10
5
votes
2 answers

Using IntelliJ IDEA for project using Makefiles

An existing Java project uses makefiles (which in turn uses ANT). I want to work on this project using IntelliJ IDEA. However, no IntelliJ specific files, e.g. project files, should be checked in to version control. How can I configure the project…
Linus
  • 3,254
  • 4
  • 22
  • 36