Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2006

Tip: Looking for answers? Try searching our database.

Problem with Ant jars

Thread view: 
apattin - 25 Mar 2006 16:45 GMT
When using Eclipse, I can create a jar for  a package ("com.foo.bar") ;
the package directory structure is replicated within the jar. How can I
do the same using the Ant jar task (running Ant from within Eclipse)?
It seems all the jars ant builds contain just the class files with no
structure.

Thanks!
opalpa@gmail.com opalinski from opalpaweb - 25 Mar 2006 17:37 GMT
> It seems all the jars ant builds contain just the class files with no
> structure.

That is not my experience.   Please post your jar task.  Good day,

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Roedy Green - 25 Mar 2006 19:22 GMT
On 25 Mar 2006 08:37:53 -0800, "opalpa@gmail.com opalinski from
opalpaweb" <opalpa@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>> It seems all the jars ant builds contain just the class files with no
>> structure.
>
>That is not my experience.   Please post your jar task.  Good day,

see http://mindprod.com/jgloss/ant.html
for a sample ant build script. You are not providing the package names
properly to the jar task.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

apattin - 28 Mar 2006 00:42 GMT
Thanks to all who responded. I found the solution; here it is for
others:

I was having trouble creating the jar from Eclipse, where the project
structure is like this:

my_project/com/my_name/package1
                                     /package2

The .class files are under package1 and package2

What I found out is you have to specify the basedir for the fileset in
the jar task as the parent dir to "com". So:

<project name="Test Build" default="main" basedir="C:\my_project">
<property name="package_root" value="com/my_name/"/>
<property name="package1_dir" value="${package_root}package1/"/>

<jar destfile="${package1_dir}package1.jar" >
   <fileset dir="${basedir}"
includes="${package1_dir}**/*.class"></fileset>
</jar>

worked for me.

Thanks!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.