Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping directory names in jar files

Status
Not open for further replies.

tom62

Programmer
Nov 12, 2002
152
DE
I'm an absolute Ant beginner with a jar task problem. In the past I build my jar files directly in Eclipse, but now I'd like to do the same with Ant. In my project working directory I have 3 subdirectories, which I'd like to add to a single jar file, while keeping the original directory structure.

Directory structure:

D:\FNProg2PDA\config
D:\FNProg2PDA\help
D:\FNProg2PDA\images

Jar-entries as produced by Eclipse Export to Jar file:

META-INF\MANIFEST.mf
config\*.config
help\*.html
images\*.jpg


Jar-entries that Ant however creates, no matter what I try to do:

META-INF\MANIFEST.mf
*.config
*.html
*.jpg

This is what my Ant build.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>

<project name="Builder" default="build"
basedir=".">
<description>
</description>

<target name="build" description="Build the Project jars">
<jar destfile="resources.jar">
<fileset dir="config"/>
<fileset dir="help"/>
<fileset dir="images"/>
</jar>
</target>
</project>

Thanks in advance for your help,

Tom
 
I've found it myself! The problem was caused by the fact that I was adding files at project/subdirectory path level instead of at project path level.

<?xml version="1.0" encoding="UTF-8"?>

<project name="Builder" default="build" basedir=".">
<description>
</description>

<target name="build" description="Build the Project jars">
<jar destfile="resources.jar">
<fileset dir=".">
<include name="config/*.*"/>
<include name="help/*.*"/>
<include name="images/*.*"/>
</fileset>
</jar>
</target>
</project>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top