ant

How to pass (cli) arguments by file in Ant

Hi, I'm using Ant to build my project, generate docs and check coding strandard violations. I use some external tool through exec task. Exec prefixes the output lines with [exec] This string messes my output up. If I specify the -e switch in the command line, it remains quiet. Is there a way to specify the -e switch on every run in th...

Passing a list of files to javac

How can I get the javac task to use an existing fileset? In my build.xml I have created several filesets to be used in multiple places throughout build file. Here is how they have been defined: <fileset dir = "${src}" id = "java.source.all"> <include name = "**/*.java" /> </fileset> <fileset dir = "${src}" id ...

how to use execute() in groovy to run any command

I usually build my project using these two commands from command line (dos) G:\> cd c: C:\> cd c:\my\directory\where\ant\exists C:\my\directory\where\ant\exists> ant -Mysystem ... ..... build successful What If I want to do the above from groovy instead? groovy has execute() method but following does not work for me: def cd_command =...

how to run existing ant script from groovy

my build is a 3 step process. run ant to build. transfer war to server. touch reload file. I have transfered last two steps in groovy, using antbuilder. However, I am not able to run my existing ant script using groovy. Usually I run it using the following command in dos prompt: ant -Dsystem=mysystem -DsomeotherOption=true from g...

Is it possible to have Ant print out the classpath for a particular target? If so, how?

I'm trying to get a target to build that has quite a long list of <pathelement location="${xxx}"/> and <path refid="foo.class.path"/> elements in its <path id="bar.class.path"> element (in the build.xml file). I keep getting "package com.somecompany.somepackage does not exist" errors, and I'm having a hard time chasing down these packag...

code formatting at build time

can anyone suggest me a plugin/tool that can perform a code formatting at build time. ...

Ant hangs randomly with executing

Hi, I have noticed in recent times that when invoking my ant scripts to build and unit test my Java app, it randomly hangs at various points in the execution. The ant scripts are been invoked from my local machine on my remote clearcase view. Has anyone else had this problem? Please advise if you can. ...

The case against Maven?

Time and time again I've read and heard people frustrated over Maven and how complicated it is. And that it's much easier to use Ant to build code. However, in order to: Compile code Run tests Package a deployable unit This is all you need from Maven: <project> <modelVersion>4.0.0</modelVersion> <groupId>type something here</g...

automating hudson builds with ant throwing 403

We have a hudson server which deploys builds. We have a few services which we want to be able to remotely tell hudson to deploy a certain build ... these services are using ant. So I'm trying to get it working but keeping getting a 403 response when giving a build number like so... <ac:post to="http://hostname:8080/hudson/job/test_r...

Is there a way to conditionally copy a file using ant?

I have the following target: <target name="promptforchoice"> <input addproperty="choice"> Copy the file?. [Y, n] </input> <condition property="copy.file"> <or> <equals arg1="Y" arg2="${choice}"/> <equals arg1="y" arg2="${choice}"/> </or> </condition> </target> In another tar...

How to replace the deprecated csc ant task

I have a mixed Java / C# project and use an ant script that contains a csc task to compile the dll. This works, but I get a warning [csc] This task is deprecated and will be removed in a future version [csc] of Ant. It is now part of the .NET Antlib: [csc] http://ant.apache.org/antlibs/dotnet/index.html How can I replace the cs...

ant cpptask with ivy

A company I am working for, has some c binaries build with ant using cpptask. They use ivy to retrieve shared c libraries every time we start a build which wastes a significant amount of time comparing the revisions and downloading, when then only need to be download if the header files have changed. I have added a target which sets a va...

Ant : find the last folder in a folder

I have a folder path stored in the property nightly.basepath (here the value would be /path/to/my/nightly) : /path/to/my/nightly |- build_20100310 |- build_20100311 |- build_20100312 I want to get the folder of the lastly generated build in the nightly.basepath folder, and store the path to this last folder in the nightly.last p...

Android App Build system differences between Eclipse and Ant?

The Eclipse build for my 1.6 application project is succeeding and the Ant build is failing. I'm looking for help on why they aren't behaving the same way. We are developing on Mac OSX 10.5.8 with Eclipse 3.5 against SDK 1.6 + Google APIs. There are no setting changes in Eclipse, either at workspace or project level. Similarly, our a...

What happened to Android aapt?

I downloaded the most recent version of Android for linux (android-sdk_r05-linux_86.tgz). I was trying to use the the Android Ant task(s) for packaging, building, and deploying my code. I should mention that I'm running AMD64, but have the 32-bit libraries installed. The Android Ant tasks are all broken. First, the start-emulator tas...

ant basedir and eclipse .project file generation

I have an ant target that echo's the content of an eclipse .project file, the idea here is to ensure that the project is easily importable into eclipse. The project name should match the directory in which its checkout. I have this so far <target name="eclipse" description="creates an eclipse .project file"> <echo file=".project"> ...

Ant build scripts totally hangs, with no messages in console

I have build.xml for my project, but even this small piece of code <target name="init"> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> </target> It doesn't run Console is empty but process is active. I still can terminate it over STOP button In same time I cannot debug...

What's the use of Ant's extension-point if/unless attributes?

When you define an extension-point in an Ant build file you can have it conditional by using the if or unless attribute. On a target the if/unless prevent it's tasks from being run. But an extension-point doesn't have any tasks to conditionally run, so what does the condition do? My thought (which proved to be incorrect in Ant 1.8.0) is ...

Ant: How do I delete all files with 0 bytes?

As a result of an ant process, I generate several files (the contents of a batch svn diff). In this case, some diff files are empty, so I would like to delete them automatically so I can concentrate only on the differences. Is there an ant command that would allow me to delete all files with 0 bytes easily? ...

how to time out an ant task

Without writing a custom ant task is there a way to use a timeout on a regular ant target? To give some background info ... we are using the delete task to remove all contents of a given directory. Sometimes this directory is massive with lots of generated folders and files. We wanted to have that task say timeout after 5 minutes. I coul...