You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Jan T. Kim" <j....@uea.ac.uk> on 2010/07/09 16:19:53 UTC

Shade plugin: including system-scoped dependencies?

Dear All,

is it possible to include system-scoped dependencies in a shaded jar?
My dependencies look like this:

    <dependency>
      <groupId>jboss-stuff</groupId>
      <artifactId>jbossall-client</artifactId>
      <version>5.1</version>
      <scope>system</scope>
      <systemPath>${jbosshome}/client/jbossall-client.jar</systemPath>
    </dependency>

I've tried adding

    <artifactSet>
      <includes>
	<include>jboss-stuff:*</include>
      </includes>
    </artifactSet>

but the contents of jbossall-client.jar still don't get included in the
shaded jar.

Am I just making a stupid mistake? Or are system-scoped dependencies
always excluded from shaded jars?

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: j.kim@uea.ac.uk                                 |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

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


Re: Shade plugin: including system-scoped dependencies?

Posted by "Jan T. Kim" <j....@uea.ac.uk>.
On Fri, Jul 09, 2010 at 07:11:14PM +0100, Wayne Fay wrote:
> >> > is it possible to include system-scoped dependencies in a shaded jar?
> 
> Do not use system-scope in your builds, period.
> 
> > jar's manifest. Obviously, that works only as long as the absolute paths to
> > the jars are the same on all machines the app is used on. However, that's no
> > longer the case, so now I'm trying to get the jar to include the stuff it
> > depends on. If anyone has a suggestion for solving this in a more elegant
> > way, I'd be interested.
> 
> Do not use system-scope. Install or deploy the jars into local Maven
> repos. Anything else is a hack.

Ok, it's a hack (in admitting that it's not elegant I had already sort
of agreed to that), but sometimes a hack that works is just what's needed
-- so I'm still interested in how to commit this hack.

As for installing the jars, yes, that's an option I sometimes use. It's
resulting in a growing collection of jars, along with a script that
runs ``mvn install:install-file ... -Dfile=<jarfile>'' on all these.
I think of that collection and script as a hack as well -- creating
copies of jars in a repository goes against my desire for normalisation
and non-redundancy.

The root of the trouble really is the lack of an indirection mechanism
that would allow building a host dependent component into Class-Path
entries in a jar manifest. The duplication of stuff (whether by installing
into repos or by building shaded jars) could be avoided if something
like

    Class-Path: ${JBOSS_HOME}/common/lib/jnpserver.jar

was supported. So it seems to me that since the root of the problem is
not a maven issue, all attempts of using maven to address is are bound
to end up being hacks.

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: j.kim@uea.ac.uk                                 |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

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


Re: Shade plugin: including system-scoped dependencies?

Posted by Wayne Fay <wa...@gmail.com>.
>> > is it possible to include system-scoped dependencies in a shaded jar?

Do not use system-scope in your builds, period.

> jar's manifest. Obviously, that works only as long as the absolute paths to
> the jars are the same on all machines the app is used on. However, that's no
> longer the case, so now I'm trying to get the jar to include the stuff it
> depends on. If anyone has a suggestion for solving this in a more elegant
> way, I'd be interested.

Do not use system-scope. Install or deploy the jars into local Maven
repos. Anything else is a hack.

Wayne

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


Re: Shade plugin: including system-scoped dependencies?

Posted by "Jan T. Kim" <j....@uea.ac.uk>.
On Fri, Jul 09, 2010 at 03:44:21PM +0100, J??rg Schaible wrote:
> Jan T. Kim wrote:
> 
> > Dear All,
> > 
> > is it possible to include system-scoped dependencies in a shaded jar?
> > My dependencies look like this:
> > 
> >     <dependency>
> >       <groupId>jboss-stuff</groupId>
> >       <artifactId>jbossall-client</artifactId>
> >       <version>5.1</version>
> >       <scope>system</scope>
> >       <systemPath>${jbosshome}/client/jbossall-client.jar</systemPath>
> >     </dependency>
> > 
> > I've tried adding
> > 
> >     <artifactSet>
> >       <includes>
> > <include>jboss-stuff:*</include>
> >       </includes>
> >     </artifactSet>
> > 
> > but the contents of jbossall-client.jar still don't get included in the
> > shaded jar.
> > 
> > Am I just making a stupid mistake? Or are system-scoped dependencies
> > always excluded from shaded jars?
> 
> This jbossall-client.jar contains only a manifest, so what do you expect ?

That's a valid point -- I hadn't noticed that the jbossall-client file
is empty these days. Apologies for providing a bad example and thanks for
looking into this.

Not all jboss-stuff jars are empty, here's another example dependency:

    <dependency>
      <groupId>jboss-stuff</groupId>
      <artifactId>jnpserver</artifactId>
      <version>5.1</version>
      <scope>system</scope>
      <systemPath>${jbosshome}/common/lib/jnpserver.jar</systemPath>
    </dependency>

This time I checked that that's not an empty jar:

% jar tvf jnpserver.jar 
[...]
     0 Mon May 11 16:47:10 BST 2009 org/
     0 Mon May 11 16:47:10 BST 2009 org/jboss/
     0 Mon May 11 16:47:10 BST 2009 org/jboss/naming/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/client/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/interfaces/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/interfaces/java/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/interfaces/jnp/
     0 Mon May 11 16:47:10 BST 2009 org/jnp/server/
  2792 Mon May 11 16:47:10 BST 2009 org/jboss/naming/BindingsInitializer.class
[...]

So I'm trying to get org/jboss/naming/BindingsInitializer.class etc. included
in the shaded jar.

As a bit of background, this is for a command line app. Currently, I've put
the jboss jars that that app depends on into the Class-Path entry in the
jar's manifest. Obviously, that works only as long as the absolute paths to
the jars are the same on all machines the app is used on. However, that's no
longer the case, so now I'm trying to get the jar to include the stuff it
depends on. If anyone has a suggestion for solving this in a more elegant
way, I'd be interested.

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |             email: j.kim@uea.ac.uk                                 |
 |             WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

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


Re: Shade plugin: including system-scoped dependencies?

Posted by Jörg Schaible <jo...@gmx.de>.
Jan T. Kim wrote:

> Dear All,
> 
> is it possible to include system-scoped dependencies in a shaded jar?
> My dependencies look like this:
> 
>     <dependency>
>       <groupId>jboss-stuff</groupId>
>       <artifactId>jbossall-client</artifactId>
>       <version>5.1</version>
>       <scope>system</scope>
>       <systemPath>${jbosshome}/client/jbossall-client.jar</systemPath>
>     </dependency>
> 
> I've tried adding
> 
>     <artifactSet>
>       <includes>
> <include>jboss-stuff:*</include>
>       </includes>
>     </artifactSet>
> 
> but the contents of jbossall-client.jar still don't get included in the
> shaded jar.
> 
> Am I just making a stupid mistake? Or are system-scoped dependencies
> always excluded from shaded jars?

This jbossall-client.jar contains only a manifest, so what do you expect ?

- Jörg


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