You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Kogel, Jonck-van-der" <jo...@bmw.nl> on 2009/04/17 18:04:02 UTC

Adding system scope jars to the manifest class path

Hi,
I'm trying to get Maven to correctly set my class path entry in the Jar
manifest file. It's all working as it should except for my system scoped
jars, these get excluded from the manifests class path for some reason.
 
I have several system scoped dependencies as such:
<dependency>

<groupId>com.ibm.db2</groupId>

<artifactId>db2jcc</artifactId>

<version>1.3.1</version>

<scope>system</scope>

<systemPath>${maven.home}/repository/com/ibm/db2jcc/1.3.1/db2jcc.jar

</systemPath>

</dependency>

But here is what the manifest.mf looks like after Maven runs, as you can
see the DB2 driver is not included:
Manifest-Version: 1.0

Archiver-Version: Plexus Archiver

Created-By: Apache Maven

Built-By: kogeljo

Build-Jdk: 1.6.0_05

Main-Class: com.completer.startup.App

Class-Path: lib/spring-beans-2.5.6.jar lib/commons-logging-1.1.1.jar l

ib/spring-core-2.5.6.jar lib/spring-context-2.5.6.jar lib/aopalliance

-1.0.jar lib/spring-context-support-2.5.6.jar lib/spring-dao-2.0.8.ja

r lib/spring-jdbc-2.5.6.jar lib/spring-tx-2.5.6.jar lib/spring-suppor

t-2.0.8.jar lib/commons-dbcp-1.2.2.jar lib/commons-pool-1.3.jar lib/c

ommons-beanutils-core-1.7.0.jar lib/commons-collections-2.0.jar lib/c

glib-full-2.0.2.jar lib/log4j-1.2.15.jar lib/mail-1.4.jar lib/activat

ion-1.1.jar

 
Currently I have the maven-jar-plugin configured as such:
<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-jar-plugin</artifactId>

<configuration>

<archive>

<manifest>

<mainClass>com.completer.startup.App</mainClass>

<addClasspath>true</addClasspath>

<addExtensions/>

<classpathPrefix>lib/</classpathPrefix>

</manifest>

</archive>

</configuration>

</plugin>

 

Could someone please tell me what I'm doing wrong?

 

Thanks, Jonck

 
 

RE: Adding system scope jars to the manifest class path

Posted by "Kogel, Jonck-van-der" <jo...@bmw.nl>.
> Seriously, just get over it and run a repository manager.

Ok, will do :)

Thanks for your help guys!

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


Re: Adding system scope jars to the manifest class path

Posted by Stephen Connolly <st...@gmail.com>.
2009/4/21 Kogel, Jonck-van-der <jo...@bmw.nl>:
>
>>> Sounds right; system scoped stuff are supposed to be provided by the
>>> JVM etc. so they shouldn't be any need for the manifest to point them
> out.
>
>>Also to expand a bit; if you intent to bundle those jars with your app
> use the default (compile) scope and if
>>you expect something like a servlet container to provide them instead
> use the provided scope.
>
> Ok, allow me to rephrase :)  I'm struggling with some proprietary (IBM,
> Oracle, etc..) jars that I need to get added to my manifest class path.
> I don't want to do that manually obviously. When I add the proprietary
> jars to my pom and set their scope to default level, when I try to build
> Maven complains that it can't find the proprietary jars in any of the
> public repositories. I have added the jars to my local repository and
> correctly set the directory structure to match my pom but to no avail.
> So I googled and read that the way round that is to set the scope to
> system. But then the jars don't get added to the manifest class path
> anymore. So I guess my question is: how do I set it up so that Maven
> only looks for proprietary jars on my local repository and doesn't try
> to go outside and look for them?
>

Use a repository manager (e.g. Nexus or Artifactory... I use Nexus but
Artifactory should be able to do the same)

Have the repository manager present a composite view of all
repositories that you need.

Set the repository manager's composite view as the <mirrorOf>*</mirrorOf>

Then your 3rd party jars can be merged into the composite view, you
will only ever query one repository, all your builds will be much
faster as you have a local cache of the remote repositories, and your
builds are now reproducible as you have a local copy of any artifacts
you may have used.

Setting up nexus takes about 10 min, and I've even used nexus running
on my own desktop to mirror our corporate nexus so that I get faster
builds when connecting in via VPN (so that I pull from the corporate
repos via the VPN and pull from central via direct)

Seriously, just get over it and run a repository manager.

-Stephen

Note: I do not work for Sonatype, I have no interest in Nexus other
than I happen to use it.

> Thanks, Jonck
>
> ---------------------------------------------------------------------
> 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: Adding system scope jars to the manifest class path

Posted by Graham Leggett <mi...@sharp.fm>.
Graham Leggett wrote:

> The core reason is that it's virtually guaranteed that someone else, on
> a different machine, will want to build you code, and if the jars are on
> a shared repository (public or private, maven does care), then this is
> trivial and automatic.

you == your
does == doesn't

Sigh, need more coffee.

Regards,
Graham
--

Re: Adding system scope jars to the manifest class path

Posted by Graham Leggett <mi...@sharp.fm>.
Kogel, Jonck-van-der wrote:

> Ok, allow me to rephrase :)  I'm struggling with some proprietary (IBM,
> Oracle, etc..) jars that I need to get added to my manifest class path.
> I don't want to do that manually obviously. When I add the proprietary
> jars to my pom and set their scope to default level, when I try to build
> Maven complains that it can't find the proprietary jars in any of the
> public repositories. I have added the jars to my local repository and
> correctly set the directory structure to match my pom but to no avail. 
> So I googled and read that the way round that is to set the scope to
> system. But then the jars don't get added to the manifest class path
> anymore. So I guess my question is: how do I set it up so that Maven
> only looks for proprietary jars on my local repository and doesn't try
> to go outside and look for them?

Ideally you should run your own private repository and publish the jars
there. At the most basic level, this repository is just a webserver, so
it doesn't require much setup.

This repository starts becoming important when you start using the
release plugin to make your releases, your code will then be uploaded
automatically to your same private repository.

The core reason is that it's virtually guaranteed that someone else, on
a different machine, will want to build you code, and if the jars are on
a shared repository (public or private, maven does care), then this is
trivial and automatic.

Trying to maintain your own private directories of jars causes pain that
maven steers you away from. Taking the effort to set up a private repo
in the beginning will make your life significantly easier down the line.

Regards,
Graham
--

RE: Adding system scope jars to the manifest class path

Posted by "Kogel, Jonck-van-der" <jo...@bmw.nl>.
>> Sounds right; system scoped stuff are supposed to be provided by the 
>> JVM etc. so they shouldn't be any need for the manifest to point them
out.

>Also to expand a bit; if you intent to bundle those jars with your app
use the default (compile) scope and if 
>you expect something like a servlet container to provide them instead
use the provided scope.

Ok, allow me to rephrase :)  I'm struggling with some proprietary (IBM,
Oracle, etc..) jars that I need to get added to my manifest class path.
I don't want to do that manually obviously. When I add the proprietary
jars to my pom and set their scope to default level, when I try to build
Maven complains that it can't find the proprietary jars in any of the
public repositories. I have added the jars to my local repository and
correctly set the directory structure to match my pom but to no avail. 
So I googled and read that the way round that is to set the scope to
system. But then the jars don't get added to the manifest class path
anymore. So I guess my question is: how do I set it up so that Maven
only looks for proprietary jars on my local repository and doesn't try
to go outside and look for them?

Thanks, Jonck

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


Re: Adding system scope jars to the manifest class path

Posted by Manos Batsis <ma...@geekologue.com>.
Manos Batsis wrote:
> Kogel, Jonck-van-der wrote:
>> I'm trying to get Maven to correctly set my class path entry in the Jar
>> manifest file. It's all working as it should except for my system scoped
>> jars, these get excluded from the manifests class path for some reason.
> 
> Sounds right; system scoped stuff are supposed to be provided by the JVM 
> etc. so they shouldn't be any need for the manifest to point them out.

Also to expand a bit; if you intent to bundle those jars with your app 
use the default (compile) scope and if you expect something like a 
servlet container to provide them instead use the provided scope.

Short explanation of scopes:

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

hth,

Manos

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


Re: Adding system scope jars to the manifest class path

Posted by Manos Batsis <ma...@geekologue.com>.
Kogel, Jonck-van-der wrote:
> I'm trying to get Maven to correctly set my class path entry in the Jar
> manifest file. It's all working as it should except for my system scoped
> jars, these get excluded from the manifests class path for some reason.

Sounds right; system scoped stuff are supposed to be provided by the JVM 
etc. so they shouldn't be any need for the manifest to point them out.

Cheers,

Manos

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