Oh, I'm sorry, I thought you were saying that the Class-Path entry in the
manifest couldn't refer to non-jar items. It's very easy to set the
Class-Path entry using either the jar plugin or the assembly plugin. In the
<configuration> section, specify an <archive> element. The jar plugin has
pretty good docs for this. If you want maven to include your dependencies,
say this:

<archive>
  <manifest>
    <mainClass>com.example.App</mainClass>
    <addClasspath>true</addClasspath>
  </manifest>
</archive>

To give your own classpath (or prepend to what maven writes), do this:

<archive>
  ...
  <manifestEntries>
    <Class-Path>config/ classes/</Class-Path>
  </manifestEntries>
</archive>

But note that currently the assembly plugin has a bug and ignores
<manifestEntries>. The jar plugin does not have this bug.

Paul



berndq wrote:
> 
> Hi,
> 
>> Are you sure that documentation wasn't talking about applets? I've run
>> executable jars with Class-Path manifest entries referencing the
>> filesystem
>> many times.
> 
> I looked it up again:
> 
> http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html
> goto -jar option, there it says
> "When you use this option [Main-Class:classname], the JAR file is the 
> source of all user classes, and other user class path settings are
> ignored."
> 
> I was trying to extend the classpath from outside the jar (-cp xxx)
> and this is what does not work according to the specs.
> 
> I did not try to extend the classpath in the manifest inside the jar.
> Is this possible at all when using the assembly plugin the create the
> classpath entry in the manifest?
> 
> thanks for you info!
> 
> Bernd
> 
>> Paul
>> 
>> 
>> berndq wrote:
>>> SingleShot wrote:
>>>> I am building an executable JAR that depends on a handful of other JARs
>>>> and a
>>>> few config files being on the classpath. I want the config files to be
>>>> editable by the end user, so did not add them as internal JAR
>>>> resources.
>>>> I've configured the maven-jar-plugin to generate a manifest and add the
>>>> dependencies to its classpath (and create a mainclass entry), but
>>>> cannot
>>>> figure out how to configure it to add my config directory (containing
>>>> the
>>>> config files) to the classpath.
>>>>
>>>> Is it possible to add a directory to the classpath of a Maven-generated
>>>> Manifest?
>>> Hi,
>>>
>>> I had exactly the same problem. This is not a maven but a (sun?) Java 
>>> problem:
>>>
>>> Executable jars use a classloader that can only load resources/classes 
>>> from other jars and not from the file system. I found this documented 
>>> somewhere under java.sun.com.
>>>
>>>
>>> So I had to stop using executable jars :-(
>>>
>>> best regards
>>> Bernd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Add-Directory-to-Jar-Manifest-Classpath-tf2504507.html#a7031994
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to