aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Problem with packaging using ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problem with packaging using ant" Watch "Problem with packaging using ant" New topic
Author

Problem with packaging using ant

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi all.
I have the following structure:
Dir\src for source
Dir\build for class files
Dir\dist for storing the jar
Dir\images images used by the application
using ant, I want to create an executable jar file.
I wrote :

but the problem is, ant doesn't create images directory inside the Jar file, so the application will not working.
(when extracting the jar I found:
com/*.class
Meta-INF
image1.gif
image2.gif)
how to create the images directory inside the jar ??
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
You need to include your "images" directory as part of the build. Right now you are just including all the files inside the "images" directory. Try something like this:

That should work for you if your "images" property is the value you want to show up in your JAR. If you need a different name, you'd have to do something like copy all your images to a temp directory whose name is the one you want, then do the same sort of thing.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Please look at my build file:

now, the jar doesn't include the the images at all !!
how to create the images directory inside the jar ?
please help ....
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
The nested include inside the fileset needs to be a relative URI. Since you have your "basedir" portion of your images attribute it messes everything up. Change to this:
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Thanks you alot.
but there is the last problem.
I have the class Manager under the package com, and as you see I have specified it within the manifest tag:
<attribute name="Main-Class" value="com.Manager"/>
but the jar file don't launch (it launch if I put my class without a package)....
so what is the problem ?
I appreciate your help...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with packaging using ant