You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kai Hendry <he...@soltecsoftware.com.au> on 2005/06/30 07:13:29 UTC

Manifestations

I'm tracking a project using a manifest in the basedir.
  <manifest file="${build.basedir}/MANIFEST.MF">
    <attribute name="Build-Master" value="${user.name}"/>
    <section name="common">
      <attribute name="Build-Version" value="${build.version}"/>
      <attribute name="Build-Number" value="${build.number}"/>
      <attribute name="Build-Date" value="${build.date}"/>
 ....

Then in each subproject I am adding 
manifest="${build.basedir}/MANIFEST.MF" to the jar tasks.

So far so good. Though how does one quickly check the manifest from 
Windows or any platform for that matter? Extract it and pull out the 
manifest? Is there some simple way to parse in the Build-Version into a 
running program?

One of the sub projects has an old manually edited MANIFEST.MF file with 
a Class-Path: and Main-Class: definitions. I thought this can't be 
serious. Can't Java/JAR files track their own classes by themselves? I 
don't see it on other JARs...

Manifest-Version: 1.0
Class-Path: jbossall-client.jar log4j.jar securityservice-ejb-client.jar 
commons-logging.jar xml-apis.jar ....
Main-Class: soltec.blah.blah.blah

So I removed them since two manifest lines (hoping they would merge) in 
the jar task didn't work. Though once testing this sub project, it seems 
to not work without this Main-Class and Class-path defined in the manifest!


Now, is that because it's hard coded into my source code or do Java 
programs really need these Class-Path defs in the manifest?

Shouldn't they be auto-generated if required?

And , is there a way of merging manifests in Ant?

Btw I am using Apache Ant version 1.6.4 compiled on May 19 2005

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Juergen Hermann <jh...@web.de>.
On Tue, 12 Jul 2005 18:11:21 +1000, Kai Hendry wrote:

>Ok ${man2} has what I want. Though the JAR take wants a FILE for the 
>manifest. So how do I dump ${man2} temporarily to a file for the task. I 
>don't want
>to overwrite MANIFEST1.MF or MANIFEST2.MF

then do not use loadfile, but concat or copy, containing the filterchain.

Ciao, Jürgen



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Kai Hendry <he...@soltecsoftware.com.au>.
Ok ${man2} has what I want. Though the JAR take wants a FILE for the 
manifest. So how do I dump ${man2} temporarily to a file for the task. I 
don't want
to overwrite MANIFEST1.MF or MANIFEST2.MF

Thanks!

<project>

<loadfile srcfile="MANIFEST1.MF" property="man1" />


<loadfile srcfile="MANIFEST2.MF" property="man2">
<filterchain>
<headfilter lines="15" skip="1" />
<concatfilter prepend="MANIFEST1.MF" />
</filterchain>


</loadfile>

<echo>First:</echo>
<echo>${man1}</echo>
<echo>Second:</echo>
<echo>${man2}</echo>

</project>




Juergen Hermann wrote:

>On Fri, 08 Jul 2005 17:37:53 +1000, Kai Hendry wrote:
>
>Seems easy enough. 
>
>use <loadfile> and a <tail> filter to load the ear manifest EXCEPT the first 
>line (<tail lines=-1 skip=1> I think). btw, you could also load this easy 
>manifest file as a property file, giving you a "class-path" property in 
>memory.
>
>then use a 2nd filterchain to insert that property into the main manifest, 
>using a <replaceregex> to insert the loaded ear manifest at the place you 
>want.
>
>  
>
>>Something specific to EAR
>>    
>>
>
>  
>
>>[hendry@SOLTEC-TEST SABSJ2EE]$ cat ./sabs/META-INF/MANIFEST.MF
>>Manifest-Version: 1.0
>>Class-Path: sabs-common.jar lots.jar more.jar jars.jar
>>    
>>
>
>  
>
>>With a base for the entire project:
>>    
>>
>
>  
>
>>[hendry@SOLTEC-TEST SABSJ2EE]$ cat ../SABSBuild/MANIFEST.MF
>>Manifest-Version: 1.0
>>Ant-Version: Apache Ant 1.6.4
>>Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)
>>Build-Master: hendry
>>    
>>
>
>  
>
>>Name: common
>>Build-Version: 4.0
>>Build-Number: 3268
>>Build-Date: 08 Jul 2005
>>Vendor: SoltecSoftware.com.au
>>    
>>
>
>
>  
>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>    
>>
>
>
>
>Ciao, Jürgen
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Juergen Hermann <jh...@web.de>.
On Fri, 08 Jul 2005 17:37:53 +1000, Kai Hendry wrote:

Seems easy enough. 

use <loadfile> and a <tail> filter to load the ear manifest EXCEPT the first 
line (<tail lines=-1 skip=1> I think). btw, you could also load this easy 
manifest file as a property file, giving you a "class-path" property in 
memory.

then use a 2nd filterchain to insert that property into the main manifest, 
using a <replaceregex> to insert the loaded ear manifest at the place you 
want.

>Something specific to EAR

>[hendry@SOLTEC-TEST SABSJ2EE]$ cat ./sabs/META-INF/MANIFEST.MF
>Manifest-Version: 1.0
>Class-Path: sabs-common.jar lots.jar more.jar jars.jar

>With a base for the entire project:

>[hendry@SOLTEC-TEST SABSJ2EE]$ cat ../SABSBuild/MANIFEST.MF
>Manifest-Version: 1.0
>Ant-Version: Apache Ant 1.6.4
>Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)
>Build-Master: hendry

>Name: common
>Build-Version: 4.0
>Build-Number: 3268
>Build-Date: 08 Jul 2005
>Vendor: SoltecSoftware.com.au


>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org



Ciao, Jürgen



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Kai Hendry <he...@soltecsoftware.com.au>.
Juergen Hermann wrote:

>On Fri, 08 Jul 2005 16:23:49 +1000, Kai Hendry wrote:
>
>  
>
>>Is there a way in ant to merge the content of two manifest files?
>>    
>>
>
>Maybe by some (complex) filterchains, depends on what exactly you want to 
>merge.
>
>  
>

Those two:

Something specific to EAR

[hendry@SOLTEC-TEST SABSJ2EE]$ cat ./sabs/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path: sabs-common.jar lots.jar more.jar jars.jar

With a base for the entire project:

[hendry@SOLTEC-TEST SABSJ2EE]$ cat ../SABSBuild/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.4
Created-By: 1.4.2_06-b03 (Sun Microsystems Inc.)
Build-Master: hendry

Name: common
Build-Version: 4.0
Build-Number: 3268
Build-Date: 08 Jul 2005
Vendor: SoltecSoftware.com.au


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Juergen Hermann <jh...@web.de>.
On Fri, 08 Jul 2005 16:23:49 +1000, Kai Hendry wrote:

>Is there a way in ant to merge the content of two manifest files?

Maybe by some (complex) filterchains, depends on what exactly you want to 
merge.

Ciao, Jürgen



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Manifestations

Posted by Kai Hendry <he...@soltecsoftware.com.au>.
Rainer Noack wrote:

>Both manifest entries are often used.
>1) Class-path: lists "required" jars (typically if one application consists
>of many jars).
>Many classloaders evaluate this entry.
>  
>

Yes, couldn't this be automagically generated? It seems to be made by 
hand in my project.

Is there a way in ant to merge the content of two manifest files?

The base one:

${build.basedir}/MANIFEST.MF

And the specific one with the class-path:
manifest="${build.metainf.dir}/${ear.module.name}/META-INF/MANIFEST.MF"

Because I don't think you can. :(


>See sun's description of the extension mechanism for details.
>You can manually add the designated jars to your classpath if there is a
>reason
>to not use this mechanism.
>
>2) Main-Class: is used for the jar-version of running java.
>(like: java myjar.jar)
>(Afaik only available on windows)
>
>Hope that helps
>
>Rainer
>
>  
>
>>-----Original Message-----
>>From: Kai Hendry [mailto:hendry@soltecsoftware.com.au] 
>>Sent: Thursday, June 30, 2005 7:13 AM
>>To: Ant Users List
>>Subject: Manifestations
>>
>>
>>I'm tracking a project using a manifest in the basedir.
>>  <manifest file="${build.basedir}/MANIFEST.MF">
>>    <attribute name="Build-Master" value="${user.name}"/>
>>    <section name="common">
>>      <attribute name="Build-Version" value="${build.version}"/>
>>      <attribute name="Build-Number" value="${build.number}"/>
>>      <attribute name="Build-Date" value="${build.date}"/>
>> ....
>>
>>Then in each subproject I am adding 
>>manifest="${build.basedir}/MANIFEST.MF" to the jar tasks.
>>
>>So far so good. Though how does one quickly check the manifest from 
>>Windows or any platform for that matter? Extract it and pull out the 
>>manifest? Is there some simple way to parse in the 
>>Build-Version into a 
>>running program?
>>
>>One of the sub projects has an old manually edited 
>>MANIFEST.MF file with 
>>a Class-Path: and Main-Class: definitions. I thought this can't be 
>>serious. Can't Java/JAR files track their own classes by 
>>themselves? I 
>>don't see it on other JARs...
>>
>>Manifest-Version: 1.0
>>Class-Path: jbossall-client.jar log4j.jar 
>>securityservice-ejb-client.jar 
>>commons-logging.jar xml-apis.jar ....
>>Main-Class: soltec.blah.blah.blah
>>
>>So I removed them since two manifest lines (hoping they would 
>>merge) in 
>>the jar task didn't work. Though once testing this sub 
>>project, it seems 
>>to not work without this Main-Class and Class-path defined in 
>>the manifest!
>>
>>
>>Now, is that because it's hard coded into my source code or do Java 
>>programs really need these Class-Path defs in the manifest?
>>
>>Shouldn't they be auto-generated if required?
>>
>>And , is there a way of merging manifests in Ant?
>>
>>Btw I am using Apache Ant version 1.6.4 compiled on May 19 2005
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Manifestations

Posted by Rainer Noack <ra...@noacks.net>.
> -----Original Message-----
> From: Dominique Devienne [mailto:ddevienne@gmail.com] 
> Sent: Thursday, June 30, 2005 10:39 PM
> To: 'Ant Users List'; rainer@noacks.net
> Subject: RE: Manifestations
> 
> 
> > 2) Main-Class: is used for the jar-version of running java.
> > (like: java myjar.jar)
> > (Afaik only available on windows)
> 
> FYI: It's the direct execution of a Jar file that Windows can 
> support. I prefer to link the .jar extension to WinZip myself.
> 
> All platforms support java -jar jarfile.jar, which execute 
> the Main-Class: in jarfile.jar's Manifest. --DD
> 

yep, absolutely.
seems, it was a little bit late yesterday evening...

> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Manifestations

Posted by Dominique Devienne <dd...@gmail.com>.
> 2) Main-Class: is used for the jar-version of running java.
> (like: java myjar.jar)
> (Afaik only available on windows)

FYI: It's the direct execution of a Jar file that Windows can support.
I prefer to link the .jar extension to WinZip myself.

All platforms support java -jar jarfile.jar, which execute the Main-Class:
in jarfile.jar's Manifest. --DD


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Manifestations

Posted by Rainer Noack <ra...@noacks.net>.
Hi Kai,
this is not really the correct list for this question.
however, the answer is pretty simple.
Both manifest entries are often used.
1) Class-path: lists "required" jars (typically if one application consists
of many jars).
Many classloaders evaluate this entry.
See sun's description of the extension mechanism for details.
You can manually add the designated jars to your classpath if there is a
reason
to not use this mechanism.

2) Main-Class: is used for the jar-version of running java.
(like: java myjar.jar)
(Afaik only available on windows)

Hope that helps

Rainer

> -----Original Message-----
> From: Kai Hendry [mailto:hendry@soltecsoftware.com.au] 
> Sent: Thursday, June 30, 2005 7:13 AM
> To: Ant Users List
> Subject: Manifestations
> 
> 
> I'm tracking a project using a manifest in the basedir.
>   <manifest file="${build.basedir}/MANIFEST.MF">
>     <attribute name="Build-Master" value="${user.name}"/>
>     <section name="common">
>       <attribute name="Build-Version" value="${build.version}"/>
>       <attribute name="Build-Number" value="${build.number}"/>
>       <attribute name="Build-Date" value="${build.date}"/>
>  ....
> 
> Then in each subproject I am adding 
> manifest="${build.basedir}/MANIFEST.MF" to the jar tasks.
> 
> So far so good. Though how does one quickly check the manifest from 
> Windows or any platform for that matter? Extract it and pull out the 
> manifest? Is there some simple way to parse in the 
> Build-Version into a 
> running program?
> 
> One of the sub projects has an old manually edited 
> MANIFEST.MF file with 
> a Class-Path: and Main-Class: definitions. I thought this can't be 
> serious. Can't Java/JAR files track their own classes by 
> themselves? I 
> don't see it on other JARs...
> 
> Manifest-Version: 1.0
> Class-Path: jbossall-client.jar log4j.jar 
> securityservice-ejb-client.jar 
> commons-logging.jar xml-apis.jar ....
> Main-Class: soltec.blah.blah.blah
> 
> So I removed them since two manifest lines (hoping they would 
> merge) in 
> the jar task didn't work. Though once testing this sub 
> project, it seems 
> to not work without this Main-Class and Class-path defined in 
> the manifest!
> 
> 
> Now, is that because it's hard coded into my source code or do Java 
> programs really need these Class-Path defs in the manifest?
> 
> Shouldn't they be auto-generated if required?
> 
> And , is there a way of merging manifests in Ant?
> 
> Btw I am using Apache Ant version 1.6.4 compiled on May 19 2005
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org