ant

How do I execute Ant command if some task fails?

Suppose I have some Ant task, say javac or junit. If either task fails, I want to execute a command, but if they succeeds I don't. Any idea how to do this? ...

Ant task for generating ER diagram from JPA/Hibernate annotated classes

Does anyone know of a tool that can do that? Linguine maps seems to only work on old hibernate xml files. And the hibernate tool task hbm2hbmxml seems to have a bug so that I can't do the two step process "annotations->hbmxml->diagram" Best, Anders ...

Tricky Ant fileset (include most, but not all of a directory)

I've got a case where I just can't figure out how to get Ant to pull in just the files I want in a fileset (why on earth didn't the Ant people just use regex?). Here's the situation. I've got a bunch of classes under the classes directory. I want: 1) All of the files under classes, 2) But not those under /com/foo/bar 3) Except I do ...

Injecting current git commit id into Java webapp

We have a git repository which contains source for a few related Java WARs and JARs. It would be nice if the Java code could somehow: System.err.println("I was built from git commit " + commitID); (Obviously real code might be putting this into an HTTP header, logging it on startup, or whatever, that's not important right now) We are...

what the heck is a JPA configuration?

I'm going nuts trying to get a simple Envers example to work. I'm stuck on the org.hibernate.tool.ant.EnversHibernateToolTask it looks like I finally got all the jar files I needed, but now I get the error message [hibernatetool] Persistence unit not found: 'ConsolePU'. BUILD FAILED C:\deka\proj\java\test-database\build.xml:61: Persi...

Ant Sshexec output blocked?

I'm using ant-jsch-1.6.5 and jsch-0.1.41 and groovy-1.6.3 (which uses ant-1.7.1) new AntBuilder().sequential{ def user = "user", pass = "pass", host = "host" echo "echo 1" sshexec( host:host ,username:user, password:pass, verbose:true, trust:true , command:"touch 1.txt" ) echo "echo 2" sshexec( ...

Save information between tasks in Ant build scripts

Hey In am writing a Java API for an SMS gateway, and I have some trouble with my ANT build script. Basically what I would like to do is to be able to only specify the username and password for the service in one place in the build file but be able to call the task that sends an SMS from anywhere in the build file. What I have now is th...

Skip projects with ant iterate-projects

We have an ant build script which contains this bit: <target name="test"> <antcall target="iterate-projects"> <param name="test-depends" value="false" /> <param name="target" value="test" /> </antcall> </target> I'd like to skip testing some of our projects, since they are very large and contain 3rd party tests. Something...

ant+cpptasks vs. scons vs. make

I'm looking into scons and I just want to make sure I know what the alternatives are, before I invest a chunk of brain cells into something completely different. I've been using GNU make in the past but have never been particularly happy with it. Particularly: why isn't Ant used more often with C / C++ projects? (given that there's ant ...

How to replace all lines of a file with their substring with Ant?

E.g. to trim the first n characters of the lines, so that 123 1234 becomes 3 34 ? ...

Do you know alternatives in Ant to generate project documentation?

I'm wondering are there more current and active alternative tools to the Apache Forrest product for project documentation that developers are using?. It seems to be stuck in v0.8 release since 2007. I'm thinking about using the maven site via Ant to generate a HTML report with the various javadoc, pmd and findbug reports for my project....

How can I run unit tests for just the source files which have changed?

Is there a way I can get ant to run the unit tests just for the java classes it builds? For example, if MyClass.java is out of date, ant will build MyClass.class. After that I want it to also run MyClassTest and MyClassTestSuite if they exist. It doesn't have to be based on a naming convention. I'd be fine with using annotations or a...

how to rename a folder using ant

I want to rename my application folder with a time stamp and then unzip a newer version of my app using the same folder name using ant. From the following link, it looks like ant can allow you to move contents from a folder to another (http://ant.apache.org/manual/CoreTasks/move.html), is this the only way I can do in ant? Thanks in adv...

How to set class path for client of web service in build.xml

HI, I need to know how to set class path for the client tag under web service of build.xml in java. I have to add the log4j.properties file to the client jar. Thanks Abhi ...

executing eclipse.buildscript task on a feature misses the fragment

I have a feature called foo, plugin called foo, and a single fragment foo.win32.x86. I should be able to execute a call to eclipse.buildscript within an ant file on a feature and have it create a build.xml for the feature, plugin, and fragment; however, all I get is the build.xml for the feature and plugin. The foo feature.xml: <?xml ...

Ant: Referencing dynamic properties

I want to use the same ant script to do a build in either my local windows environment or on our redhat build server. I have a variable 'buildDirectory' in two files (build_unix.properties & build_windows). I want to set variables depending on the environment. <osfamily property="os.family"/> <property file="./build_${os.family}.pro...

How can I post process the files compiled by javac ant task?

I need the list of files that were compiled during this run. I want to feed this list to a subsequent post-processing step. I have found an option to list (see listfiles option) the files compiled during this run, but it seems only good for displaying the list on console. Any idea? Edit: I am talking about incremental compiles, so t...

svnant - parent dir in server is not a working copy.

I want to checkout project, get the revision number, build jar with that number in menifest, on the server with a web interface. There are some other minor steps in the whole process, but that's the main goal. everything in the build script is working fine locally, but I always get stuck when it is done on the server. when I try to use s...

How can I read output of an sql query into an ant property?

I would like to feed the result of a simple sql query (something like: select SP_NUMBER from SERVICE_PACK) which I run inside my ant script (using the sql task) back into an ant property (e.g. service.pack.number). The sql task can output to a file, but is there a more direct way? ...

Running Ant script in IntelliJ results in script opening in editor...

I've got a custom ant script for building and other fun stuff. IntelliJ has very nice integration for handling Ant tasks. However, every time I run a task IntelliJ opens the script in my editor panel. It moves to the line of the task I'm running and then I close it; actually I now have it in its own panel, minimized to the max. Is t...