How to build exploded jars using Ant task? - ant

Kindly suggest how to build exploded jars using Ant task?
Thanks.

An exploded jar is simply a directory which has the same structure as a jar file. Just use copy, for example, to put all the files you want in this directory.

Related

Apache Ant Build, jar with external librarys

i have a Apache Ant build.xml to create a simple executeable jar file, but this file is very big.
Now i have the idea to build a executeable jar file with my code and have a directory named "lib" with all external jar files.
I think this will reduce the size of my application to 3%.
Thanks for your help.

How extract the .rar files through ANT script

How to Extract the .rar files through ANT script and multiple files?
I don't think there's anything native in ant or Java to handle RAR files. Maybe you can <exec> the unrar command from here?

How to get all dependency jars from build.xml

I have several very big ant build.xml files.
Someone know tool or program for get all dependency jar files from build.xml ?
Please check How To Check Dependencies Between Jar Files?.
http://www.jboss.org/tattletale or jdepend could help in getting dependencies between jars.
If you want to extract dependencies from a given build.xml , one option is to write XML parser and process ant file. Not an easy task. Another option will be write a listener for each build task. If the task is javac then query its classpath.

How should the log4j.properties put inside the war file using ANT build tool?

I have a log4j.properties that sit right under the src folder. When I building my war file using ANT tool, the particular properties file wasn't pack inside WEB-INF/classes folder, and it was right under the "root" directory of the war file (if you unwar it). I heard from my colleague mention that this is not correct. May I know is this true? If no, how should I correct it?
THanks #!
Yes, log4j.properties (or any other resource loaded from the classpath) should be at the root of your Java source folder (src/main/java, build/main, src, JavaSource, or however you have your project configured).
In the WAR, it should be under WEB-INF/classes, not at the root (as if you unzipped it).
If this is not the case, being able to see your ANT build file would be very helpful. You should have something like this line configured within your war task:
<classes dir="build/main"/>
As long as you have a build/main/log4j.properties in your Ant basedir, this should work as you're expecting.

Dynamically finding build files with <ant> task

I am trying to build subprojects from my main Ant build script..
The build files are located in
plugings/<pluginName>/build.xml
I want to do something effectively like
<ant antfile="plugins/*/build.xml" ...>
It should dynamically find build files in the plugin directory. Haven't been able to get it to work yet with filesets.. any tips?
Thanks in advance.
Solution: <subant> was the task I was looking for
These links show you a way of building sub-projects:
Sample Ant build file for multiple projects
Ant Tip 1: Write a master build file
Check this answer:
Generate Ant build file

Resources