You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andrew Perez-Lopez <ap...@bbn.com> on 2005/07/13 01:17:23 UTC

ejbjar, jar, and manifests with JBoss

Hey all,

I'm working with EJBs using JBoss 4.x and Ant 1.6.5.  I'm trying to set 
the Class-Path of the manifests of a big bunch of EJBs to a set of 
libraries that I've included in my EAR file.  I can get ejbjar to 
generate all my jars, which is very nice, but since the ejbjar task 
doesn't allow for specification of a manifest file, I'd like to go back 
afterwards and use the jar task to update the manifests of those jars.  
What I'd like to avoid, if possible, is having to explicitly add a call 
for each jar into my build file.  I'd basically like to use the jar task 
on a fileset or something so that I can just specify all the jars in the 
whole directory and have it update them all at once.  Is that possible?  
Or will I have to go back and add a jar invocation for each bean? 

Thanks very much for all your help,

-Andrew

-- 

Andrew Perez-Lopez
Developer
BBN Technologies




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


Re: ejbjar, jar, and manifests with JBoss

Posted by Andrew Perez-Lopez <ap...@bbn.com>.
Conor,

Thanks very much for your prompt reply.  I figured it out - it was just 
a silly mistake on my part.  I didn't end my manifest file with a blank 
line, so it didn't recognize the final attribute, which in my case was 
the Class-Path.  I added a newline after that, and it worked without issue.

Thanks again for your help!

Regards,

-Andrew

Conor MacNeill wrote:

>Andrew,
>
>It's a while since I worked on the ejb tasks, so forgive me if I'm a
>little hazy.
>
>Andrew Perez-Lopez wrote:
>  
>
>>I got the manifest attribute to work, but not completely.  It seems to
>>ignore my Class-Path attribute.  When I use the jar task with the same
>>manifest attribute, it creates a jar with the proper attributes, but the
>>ejbjar task seems to ignore Class-Path (though it catches other ones).
>>Here's the ant I'm using for the ejbjar:
>>
>>       <ejbjar
>>           srcdir="${build.dir}"
>>           destdir="${build.dir}"
>>           naming="directory"
>>           descriptordir="${deployment-descriptor.dir}/"
>>           dependency="full"
>>           manifest="${deployment-descriptor.dir}/manifest.mf"
>>           >
>>           <jboss />
>>           <classpath>
>>               <fileset dir="${lib.dir}" >
>>                   <include name="*.jar" />
>>               </fileset>
>>           </classpath>
>>           <include name="**/*ejb-jar.xml" />
>>       </ejbjar>
>>
>>Here's the manifest file (the quotes are to help capture white-space,
>>they're not actually in the file)
>>
>>'Manifest-Version: 1.0
>>Created-By: Me
>>Class-Path: heyya.jar'
>>
>>And here's what is in the jar's when ejb-jar's done:
>>
>>'Manifest-Version: 1.0
>>Created-By: Me
>>
>>    
>>
>
>I'm not sure what is going on there. <ejbjar> uses the standard JDK
>classes for writing jars - namely JarOutputStream and Manifest and it
>should accept Class-Path entries. The manifest is read in from the file
>using
>    manifest = new Manifest(in);
>and the Jar is created with
>    jarStream
>      = new JarOutputStream(new FileOutputStream(jarfile), manifest);
>
>  
>
>>Any ideas on how to get the classpath to show up there?  Also, you
>>mentioned per-bean manifests.  As that's not documented either, do you
>>have any hints for how that works, or any references to give?
>>
>>    
>>
>
>The per-bean system depends on the naming scheme you employ. Since you
>have set naming="directory", you should be able to put a manifest.mf
>file into the same directory as the deployment descriptor and ejbjar
>should find it.
>
>Conor
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>


-- 

Andrew Perez-Lopez
Developer
BBN Technologies
aperezlo@bbn.com
(703) 284-1256



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


Re: ejbjar, jar, and manifests with JBoss

Posted by Conor MacNeill <co...@apache.org>.
Andrew,

It's a while since I worked on the ejb tasks, so forgive me if I'm a
little hazy.

Andrew Perez-Lopez wrote:
> I got the manifest attribute to work, but not completely.  It seems to
> ignore my Class-Path attribute.  When I use the jar task with the same
> manifest attribute, it creates a jar with the proper attributes, but the
> ejbjar task seems to ignore Class-Path (though it catches other ones).
> Here's the ant I'm using for the ejbjar:
> 
>        <ejbjar
>            srcdir="${build.dir}"
>            destdir="${build.dir}"
>            naming="directory"
>            descriptordir="${deployment-descriptor.dir}/"
>            dependency="full"
>            manifest="${deployment-descriptor.dir}/manifest.mf"
>            >
>            <jboss />
>            <classpath>
>                <fileset dir="${lib.dir}" >
>                    <include name="*.jar" />
>                </fileset>
>            </classpath>
>            <include name="**/*ejb-jar.xml" />
>        </ejbjar>
> 
> Here's the manifest file (the quotes are to help capture white-space,
> they're not actually in the file)
> 
> 'Manifest-Version: 1.0
> Created-By: Me
> Class-Path: heyya.jar'
> 
> And here's what is in the jar's when ejb-jar's done:
> 
> 'Manifest-Version: 1.0
> Created-By: Me
> 

I'm not sure what is going on there. <ejbjar> uses the standard JDK
classes for writing jars - namely JarOutputStream and Manifest and it
should accept Class-Path entries. The manifest is read in from the file
using
    manifest = new Manifest(in);
and the Jar is created with
    jarStream
      = new JarOutputStream(new FileOutputStream(jarfile), manifest);

> 
> Any ideas on how to get the classpath to show up there?  Also, you
> mentioned per-bean manifests.  As that's not documented either, do you
> have any hints for how that works, or any references to give?
> 

The per-bean system depends on the naming scheme you employ. Since you
have set naming="directory", you should be able to put a manifest.mf
file into the same directory as the deployment descriptor and ejbjar
should find it.

Conor

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


Re: ejbjar, jar, and manifests with JBoss

Posted by Andrew Perez-Lopez <ap...@bbn.com>.
Conor,

Thanks very much for your help.  I'm half-way there now...

I got the manifest attribute to work, but not completely.  It seems to 
ignore my Class-Path attribute.  When I use the jar task with the same 
manifest attribute, it creates a jar with the proper attributes, but the 
ejbjar task seems to ignore Class-Path (though it catches other ones). 

Here's the ant I'm using for the ejbjar:

        <ejbjar
            srcdir="${build.dir}"
            destdir="${build.dir}"
            naming="directory"
            descriptordir="${deployment-descriptor.dir}/"
            dependency="full"
            manifest="${deployment-descriptor.dir}/manifest.mf"
            >
            <jboss />
            <classpath>
                <fileset dir="${lib.dir}" >
                    <include name="*.jar" />
                </fileset>
            </classpath>
            <include name="**/*ejb-jar.xml" />
        </ejbjar>

Here's the manifest file (the quotes are to help capture white-space, 
they're not actually in the file)

'Manifest-Version: 1.0
Created-By: Me
Class-Path: heyya.jar'

And here's what is in the jar's when ejb-jar's done:

'Manifest-Version: 1.0
Created-By: Me

'

Any ideas on how to get the classpath to show up there?  Also, you 
mentioned per-bean manifests.  As that's not documented either, do you 
have any hints for how that works, or any references to give?

Thanks very much,

-Andrew

Conor MacNeill wrote:

>Andrew Perez-Lopez wrote:
>  
>
>>Hey all,
>>
>>I'm working with EJBs using JBoss 4.x and Ant 1.6.5.  I'm trying to set
>>the Class-Path of the manifests of a big bunch of EJBs to a set of
>>libraries that I've included in my EAR file.  I can get ejbjar to
>>generate all my jars, which is very nice, but since the ejbjar task
>>doesn't allow for specification of a manifest file, 
>>    
>>
>
>The ejbjar task does allow for the specification of a manifest file. Use
>the manifest attribute. It's not documented :-) It is also possible for
><ejbjar> to pick up a per-bean manifest file
>
>Conor
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>


-- 

Andrew Perez-Lopez
Developer
BBN Technologies



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


Re: ejbjar, jar, and manifests with JBoss

Posted by Conor MacNeill <co...@apache.org>.
Andrew Perez-Lopez wrote:
> Hey all,
> 
> I'm working with EJBs using JBoss 4.x and Ant 1.6.5.  I'm trying to set
> the Class-Path of the manifests of a big bunch of EJBs to a set of
> libraries that I've included in my EAR file.  I can get ejbjar to
> generate all my jars, which is very nice, but since the ejbjar task
> doesn't allow for specification of a manifest file, 

The ejbjar task does allow for the specification of a manifest file. Use
the manifest attribute. It's not documented :-) It is also possible for
<ejbjar> to pick up a per-bean manifest file

Conor


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