This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling multiple --resource files

> I'm trying to put together something that can take .jar files and
> compile non-class files with the --resource option.

> Does anyone have have a piece of ant that can do the trick?

Here's an example of doing the resource compile with Ant. I attached a 
buildfile at the end of this message that will compile all *.properties, 
*.bmp, and *.gif resources in the current directory and subdirectories.

This buildfile is a generic script for compiling up a project to an 
executable using GCJ and SWT. It was taken from the article I published 
last May on IBM developerWorks. It doesn't handle the JAR part that you 
need, but you should be able to cut-and-paste the resource compile part of 
the script.

You'll need to grab four things out of the script.

1. The custom task declaration for 'applyantcall' as well as the 
associated JAR file (which is attached). Place the JAR file in the same 
directory as your Ant script.

2. The Ant target 'resource-compile'.

3. The Ant target 'resource-compile-helper'.

4. The Ant target 'resource-up-to-date'.

Also, you'll need Ant 1.5.0 or higher.

Hopefully, this is what you are looking for. Ideally, it'd be cool to have 
a custom task to do all this, but for now this should do the trick.

Good luck,


Attachment: build.xml
Description: Binary data

Attachment: customtasks.jar
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]