You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Erik Husby <mh...@genome.wi.mit.edu> on 2003/07/31 19:49:28 UTC

Question: How to create a manifest classpath

I am trying to convert from Ant to Maven.

One of the things that my Ant script did was to create a manifest classpath that
referred to all the jars in my /lib directory. I was able to create a jar:jar
pregoal that does that as well. But what I'd like to do would be to create the
classpath using the dependencies that are listed in the project.xml.

Would someone give me a hint on how that would be done in Maven/Jelly?

-- 
Erik Husby
Team Lead for Software Quality Automation
Whitehead Institute/MIT Center for Genome Research
Rm 2192
320 Charles St
Cambridge, MA 02141-2023
mobile: 781.354.6669
office: 617.258.9227
mhusby@genome.wi.mit.edu



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question: How to create a manifest classpath

Posted by Brent Hale <br...@eventronix.com>.
We had to tackle the same thing and did the following:

    <!--==================================================================
        createClassPathManifest:
       
        This will create a target/conf/MANIFEST.MF file which contains
        the "Class-Path" property in it which contains the list of all
        jar files the project is dependent on.
        
==================================================================-->   
    <goal name="jbrew:createClassPathManifest">
        <!-- create target directory where new manifest will be created. -->
        <mkdir dir="${maven.build.dir}/conf"/>
       
        <!-- Get a variable with the classpath value -->
        <j:set var="depsClassPath" value=""/>
        <j:forEach var="dep" items="${pom.artifacts}">
            <j:set var="depsClassPath" value="${depsClassPath} 
${deploy.lib.dir}/${dep.name}"/>
        </j:forEach>
      
        <!-- create a dynamic manifest file for performing java -jar -->
        <manifest file="${maven.build.dir}/conf/MANIFEST.MF">
            <attribute name="Class-Path" value="${depsClassPath}"/>
        </manifest>
    </goal>

Then in your project.properties file you need to include this:

maven.jar.mainclass=com.evnt.eve.Eve      <!-- specific to your project -->
maven.jar.manifest=target/conf/manifest.mf   <!-- to use the above 
created manifest.  -->


Hope that helps,
Brent


Siegfried Göschl wrote:

>Hi Michal,
>
>I had a look at uberjar a few months ago but encountered performance 
>problems due to the URLClassloader - it takes ages to pull in my JARs 
>.... :-).
>
>  
>
>>>>Orginale Mail Snippet >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>        
>>>>
>But it is too slow - my JAR is about 11.5 MByte and starting it 
>takes now 150 seconds instead of 3 seconds. After loading all the 
>classes there is still a performance degration of the factor 5 - my 
>tests runs now in 19.5 sec instead of 3.8 seconds.
><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
>As a workaround I'm using the javaapp plugin hosted on http://maven-
>plugins.sourceforge.net/ ... the most recent version for Maven B10 is 
>actually found within the CVS since I had no time to upload a new 
>release of it.
>
>Cheers,
>
>Siegfried Goeschl
>
>
>On 31 Jul 2003 at 22:26, Michal Maczka wrote:
>
>  
>
>>take a look what uberjar plugin does.
>>
>>Michal
>>
>>    
>>
>>>-----Original Message-----
>>>From: Erik Husby [mailto:mhusby@genome.wi.mit.edu]
>>>Sent: Thursday, July 31, 2003 10:21 PM
>>>To: Maven Users List
>>>Subject: Re: Question: How to create a manifest classpath
>>>
>>>
>>>Quoting Siegfried Göschl <si...@it20one.at>:
>>>
>>>      
>>>
>>>>Hi Erik,
>>>>
>>>>I'm not quite sure if I'm qualified to answer your question since
>>>>this is the first time that I heard of a manifest classpath ...
>>>>:-) ... but I asked Google.
>>>>
>>>>And Google knows a few things about it - you might find the
>>>>relevant code it the maven.ejb-plugin ...
>>>>
>>>>
>>>>Hope this helps,
>>>>
>>>>Siegfried Goeschl
>>>>        
>>>>
>>>That is exactly what I am looking for -- thanks.
>>>
>>>FYI a manifest classpath allows one easily package an application so
>>>that you can do the following:
>>>
>>>      
>>>
>>>>cd somedirectory
>>>>java -jar application.jar
>>>>        
>>>>
>>>Assuming that the application jar and all its related jar files are
>>>in the directory "somedirectory".
>>>
>>>On Windows this means you can double click on a jar file to
>>>launch the application.
>>>--
>>>Erik Husby
>>>Team Lead for Software Quality Automation
>>>Whitehead Institute/MIT Center for Genome Research
>>>Rm 2192
>>>320 Charles St
>>>Cambridge, MA 02141-2023
>>>mobile: 781.354.6669
>>>office: 617.258.9227
>>>mhusby@genome.wi.mit.edu
>>>
>>>
>>>
>>>--------------------------------------------------------------------
>>>- To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For
>>>additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>--------------------------------------------------------------------
>>>-- Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f174b
>>>
>>>
>>>
>>>      
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For
>>additional commands, e-mail: users-help@maven.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Question: How to create a manifest classpath

Posted by Siegfried Göschl <si...@it20one.at>.
Hi Michal,

I had a look at uberjar a few months ago but encountered performance 
problems due to the URLClassloader - it takes ages to pull in my JARs 
.... :-).

>>> Orginale Mail Snippet >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
But it is too slow - my JAR is about 11.5 MByte and starting it 
takes now 150 seconds instead of 3 seconds. After loading all the 
classes there is still a performance degration of the factor 5 - my 
tests runs now in 19.5 sec instead of 3.8 seconds.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

As a workaround I'm using the javaapp plugin hosted on http://maven-
plugins.sourceforge.net/ ... the most recent version for Maven B10 is 
actually found within the CVS since I had no time to upload a new 
release of it.

Cheers,

Siegfried Goeschl


On 31 Jul 2003 at 22:26, Michal Maczka wrote:

> take a look what uberjar plugin does.
> 
> Michal
> 
> > -----Original Message-----
> > From: Erik Husby [mailto:mhusby@genome.wi.mit.edu]
> > Sent: Thursday, July 31, 2003 10:21 PM
> > To: Maven Users List
> > Subject: Re: Question: How to create a manifest classpath
> >
> >
> > Quoting Siegfried Göschl <si...@it20one.at>:
> >
> > > Hi Erik,
> > >
> > > I'm not quite sure if I'm qualified to answer your question since
> > > this is the first time that I heard of a manifest classpath ...
> > > :-) ... but I asked Google.
> > >
> > > And Google knows a few things about it - you might find the
> > > relevant code it the maven.ejb-plugin ...
> > >
> > >
> > > Hope this helps,
> > >
> > > Siegfried Goeschl
> >
> > That is exactly what I am looking for -- thanks.
> >
> > FYI a manifest classpath allows one easily package an application so
> > that you can do the following:
> >
> > > cd somedirectory
> > > java -jar application.jar
> >
> > Assuming that the application jar and all its related jar files are
> > in the directory "somedirectory".
> >
> > On Windows this means you can double click on a jar file to
> > launch the application.
> > --
> > Erik Husby
> > Team Lead for Software Quality Automation
> > Whitehead Institute/MIT Center for Genome Research
> > Rm 2192
> > 320 Charles St
> > Cambridge, MA 02141-2023
> > mobile: 781.354.6669
> > office: 617.258.9227
> > mhusby@genome.wi.mit.edu
> >
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For
> > additional commands, e-mail: users-help@maven.apache.org
> >
> >
> > --------------------------------------------------------------------
> > -- Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f174b
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For
> additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Question: How to create a manifest classpath

Posted by Michal Maczka <mm...@interia.pl>.
take a look what uberjar plugin does.

Michal

> -----Original Message-----
> From: Erik Husby [mailto:mhusby@genome.wi.mit.edu]
> Sent: Thursday, July 31, 2003 10:21 PM
> To: Maven Users List
> Subject: Re: Question: How to create a manifest classpath
>
>
> Quoting Siegfried Göschl <si...@it20one.at>:
>
> > Hi Erik,
> >
> > I'm not quite sure if I'm qualified to answer your question since
> > this is the first time that I heard of a manifest classpath ... :-)
> > ... but I asked Google.
> >
> > And Google knows a few things about it - you might find the relevant
> > code it the maven.ejb-plugin ...
> >
> >
> > Hope this helps,
> >
> > Siegfried Goeschl
>
> That is exactly what I am looking for -- thanks.
>
> FYI a manifest classpath allows one easily package an application
> so that you
> can do the following:
>
> > cd somedirectory
> > java -jar application.jar
>
> Assuming that the application jar and all its related jar files are in the
> directory "somedirectory".
>
> On Windows this means you can double click on a jar file to
> launch the application.
> --
> Erik Husby
> Team Lead for Software Quality Automation
> Whitehead Institute/MIT Center for Genome Research
> Rm 2192
> 320 Charles St
> Cambridge, MA 02141-2023
> mobile: 781.354.6669
> office: 617.258.9227
> mhusby@genome.wi.mit.edu
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ----------------------------------------------------------------------
> Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f174b
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question: How to create a manifest classpath

Posted by Erik Husby <mh...@genome.wi.mit.edu>.
Quoting Siegfried Göschl <si...@it20one.at>:

> Hi Erik,
> 
> I'm not quite sure if I'm qualified to answer your question since 
> this is the first time that I heard of a manifest classpath ... :-) 
> ... but I asked Google.
> 
> And Google knows a few things about it - you might find the relevant 
> code it the maven.ejb-plugin ...
> 
> 
> Hope this helps,
> 
> Siegfried Goeschl

That is exactly what I am looking for -- thanks.

FYI a manifest classpath allows one easily package an application so that you
can do the following:

> cd somedirectory
> java -jar application.jar

Assuming that the application jar and all its related jar files are in the
directory "somedirectory".

On Windows this means you can double click on a jar file to launch the application.
-- 
Erik Husby
Team Lead for Software Quality Automation
Whitehead Institute/MIT Center for Genome Research
Rm 2192
320 Charles St
Cambridge, MA 02141-2023
mobile: 781.354.6669
office: 617.258.9227
mhusby@genome.wi.mit.edu



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Question: How to create a manifest classpath

Posted by Siegfried Göschl <si...@it20one.at>.
Hi Erik,

I'm not quite sure if I'm qualified to answer your question since 
this is the first time that I heard of a manifest classpath ... :-) 
... but I asked Google.

And Google knows a few things about it - you might find the relevant 
code it the maven.ejb-plugin ...


Hope this helps,

Siegfried Goeschl

On 31 Jul 2003 at 13:49, Erik Husby wrote:

> 
> I am trying to convert from Ant to Maven.
> 
> One of the things that my Ant script did was to create a manifest
> classpath that referred to all the jars in my /lib directory. I was
> able to create a jar:jar pregoal that does that as well. But what I'd
> like to do would be to create the classpath using the dependencies
> that are listed in the project.xml.
> 
> Would someone give me a hint on how that would be done in Maven/Jelly?
> 
> -- 
> Erik Husby
> Team Lead for Software Quality Automation
> Whitehead Institute/MIT Center for Genome Research
> Rm 2192
> 320 Charles St
> Cambridge, MA 02141-2023
> mobile: 781.354.6669
> office: 617.258.9227
> mhusby@genome.wi.mit.edu
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org For
> additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org