maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jo Vandermeeren" <jo.vandermee...@gmail.com>
Subject Re: Executable jar : lib inclusion
Date Wed, 01 Aug 2007 10:47:01 GMT
Hi Jean-Philippe,

Of course the dependencies are not packaged with your jar.
What do you expect? An executable jar is simply a jar with a Main-Class
property in its manifest.
In fact, a jar can not include other jars, unless you supply a custom jar
classloader to actually load the resources inside those jars.

If you want to include jar files in a jar file, there is a workaround
though.. Classworlds provides a custom classloader (which is used in
maven1's uberjar).

If you just want all classes of your dependencies, along with your own code
in a single jar, without providing a custom classloader.. You have to unpack
all dependencies and create a new jar file that wraps them all up.
The maven-assembly-plugin can do this for you, cf.
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies

Cheers
Jo

On 8/1/07, CARUANA JEAN-PHILIPPE <Jean-Philippe.Caruana@alcatel-lucent.fr>
wrote:
>
> Hi,
>
> I try to write a small swing client to test our EJB. The Ejb is deployed
> on a Weblogic 8.1 server.
> I made an executable jar file (thanks to
> <http://maven.apache.org/plugins/maven-jar-plugin/examples/executable-ja
> r.html>) so when I run java -jar myJar.jar, it works fine. But the
> generated jar file is very lightweight and doesn't include needed jar
> (commons-lang, weblogic-8.1.jar). How can I do that ?
>
> The generated manifest file tells that the classpath is easy (as if all
> jar files were in the current directory, witch is not true : all jar are
> in the repository)
>
> --
> Jean-Philippe CARUANA
> site http://perso.enstimac.fr/~caruana/
> blog http://demostene.tumblr.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message