NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Manifest in Jar Files

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
lilleyt1



Joined: 29 Sep 2010
Posts: 2

PostPosted: Wed Sep 29, 2010 5:38 pm    Post subject: Manifest in Jar Files Reply with quote

The manifest.mf file created for the jar file within the IDE is different from the manifest.mf file created when I build the jar using ant with the netbeans created build.xml (the classpath and main class is added by the IDE).

Is there a way to have the same information created by the IDE added to the jar created by ant?

Thanks!
Tom
Back to top
areeda



Joined: 28 Aug 2008
Posts: 469
Location: Los Angeles

PostPosted: Wed Sep 29, 2010 6:05 pm    Post subject: Reply with quote

Tom,

What is missing? Please post an example, I'm too lazy to do it myself.

Joe
Back to top
lilleyt1



Joined: 29 Sep 2010
Posts: 2

PostPosted: Wed Sep 29, 2010 6:42 pm    Post subject: Reply with quote

Netbeans creates:

Code:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.6.0_02-b06 (Sun Microsystems Inc.)
Main-Class: my.namespace.Main
Class-Path: lib/lib1.jar lib/lib2.jar etc...
X-COMMENT: Main-Class will be added automatically by build



where lib1, lib2, etc.. are the libraries I added to the netbeans project via project-->properties


Ant creates:

Code:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 10.0-b19 (Sun Microsystems Inc.)
Main-Class: my.namespace.Main
X-COMMENT: Main-Class will be added automatically by build
Back to top
areeda



Joined: 28 Aug 2008
Posts: 469
Location: Los Angeles

PostPosted: Wed Sep 29, 2010 7:05 pm    Post subject: Reply with quote

Thank you. I understand the problem now, although I don't have a solution for you.

It's worth a bug report since I believe the goal is to have build in NB equivalent to running Ant.

I've only taken existing Ant scripts and imported into NB never the way you're doing it.

Joe
Back to top
TD
Posted via mailing list.





PostPosted: Wed Sep 29, 2010 8:55 pm    Post subject: Manifest in Jar Files Reply with quote

Use the ant build.xml together with the following snippet:

(Edit and Configure appropriately for your project .. shouldn't need too
much changed)

<path id="dist.classpath">
<fileset dir="${dist.lib.dir}" includes="**/*.jar, **/*.zip" />
</path>
<manifestclasspath property="dist.manifest.classpath"
jarfile="${dist.dir}/${ant.project.name}.jar">
<classpath refid="dist.classpath" />
</manifestclasspath>

<jar destfile="${dist.dir}/${ant.project.name}.jar" compress="true">
<fileset dir="${build.dir}" includes="**/*.*" />
<manifest>
<attribute name="Main-Class" value="${main.class.name}" />
<attribute name="Class-Path"
value="${dist.manifest.classpath}"/>
</manifest>
</jar>


DISLAIMER: Not my code! I HATE ant! But I DO know when to borrow from
others to save time .. thanks to bo.m on the Sun forums for this one, way
back in '06.

Tony


-----Original Message-----
From: lilleyt1 [mailto:address-removed]
Sent: 29 September 2010 18:39
To: address-removed
Subject: [nbusers] Manifest in Jar Files

The manifest.mf file created for the jar file within the IDE is different
from the manifest.mf file created when I build the jar using ant with the
netbeans created build.xml (the classpath and main class is added by the
IDE).

Is there a way to have the same information created by the IDE added to the
jar created by ant?

Thanks!
Tom
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo