You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Basin Ilya <ba...@gmail.com> on 2018/01/25 10:43:41 UTC

maven-war-plugin addClasspath useless, because it cannot add absolute paths

Hi List.
As far as I know, Class-Path in MANIFEST.MF of a .war file is only useful when you need to add jars that are not in WEB-INF/lib and not provided by the container.
But can maven add paths that are absolute or relative? I tried this:

   <dependency>
           <groupId>nah</groupId>
           <artifactId>nah</artifactId>
           <version>1.0.0</version>
           <scope>system</scope>
           <systemPath>/C:/1/ccc.jar</systemPath>
           <optional>true</optional>
           <!-- goes in manifest classpath, but not included in WEB-INF/lib -->
           <!-- http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html -->
   </dependency>
    ...
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-war-plugin</artifactId>
		<configuration>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>

The Class-Path was indeed added to MANIFEST.MF, but not the "ccc.jar".

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


Re: maven-war-plugin addClasspath useless, because it cannot add absolute paths

Posted by Robert Patrick <ro...@oracle.com>.
Well...I suspect that it is skipping the dependency because it is system-scoped.  If so, this doesn’t make it useless for most people since most of use do not use “system-scoped” dependencies...



> On Jan 25, 2018, at 4:43 AM, Basin Ilya <ba...@gmail.com> wrote:
> 
> Hi List.
> As far as I know, Class-Path in MANIFEST.MF of a .war file is only useful when you need to add jars that are not in WEB-INF/lib and not provided by the container.
> But can maven add paths that are absolute or relative? I tried this:
> 
>   <dependency>
>           <groupId>nah</groupId>
>           <artifactId>nah</artifactId>
>           <version>1.0.0</version>
>           <scope>system</scope>
>           <systemPath>/C:/1/ccc.jar</systemPath>
>           <optional>true</optional>
>           <!-- goes in manifest classpath, but not included in WEB-INF/lib -->
>           <!-- https://urldefense.proofpoint.com/v2/url?u=http-3A__maven.apache.org_plugins_maven-2Dwar-2Dplugin_examples_war-2Dmanifest-2Dguide.html&d=DwICaQ&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=nSxyAsyxa1Izff8ULe7vW8u084madbci-hLPsiLpxeU&m=viSwPT5200iSAfpL5QhAPYezvqa-RNTM1-l8F8QcGQ4&s=I1VopBe7SIoNcTAVqHOFWoUZjivGkkKnBd04duRtjqM&e= -->
>   </dependency>
>    ...
>    <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-war-plugin</artifactId>
>        <configuration>
>          <archive>
>            <manifest>
>              <addClasspath>true</addClasspath>
>            </manifest>
>          </archive>
> 
> The Class-Path was indeed added to MANIFEST.MF, but not the "ccc.jar".
> 
> ---------------------------------------------------------------------
> 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: maven-war-plugin addClasspath useless, because it cannot add absolute paths

Posted by Mark Prins <mc...@gmail.com>.
2018-01-25 11:43 GMT+01:00 Basin Ilya <ba...@gmail.com>:

> Hi List.
> As far as I know, Class-Path in MANIFEST.MF of a .war file is only useful
> when you need to add jars that are not in WEB-INF/lib and not provided by
> the container.
>

this really depends on the classloader of the container running the war and
the way it is configured.


> But can maven add paths that are absolute or relative? I tried this:
>
>    <dependency>
>            <groupId>nah</groupId>
>            <artifactId>nah</artifactId>
>            <version>1.0.0</version>
>            <scope>system</scope>
>            <systemPath>/C:/1/ccc.jar</systemPath>
>            <optional>true</optional>
>            <!-- goes in manifest classpath, but not included in
> WEB-INF/lib -->
>            <!-- http://maven.apache.org/plugins/maven-war-plugin/
> examples/war-manifest-guide.html -->
>    </dependency>
>

Optional dependencies are not required at runtime and should not be
expected to be part of the war


>     ...
>         <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <configuration>
>           <archive>
>             <manifest>
>               <addClasspath>true</addClasspath>
>             </manifest>
>           </archive>
>
> The Class-Path was indeed added to MANIFEST.MF, but not the "ccc.jar".
>

makes sense to me.


-- 
Disclaimer;
This message is just a reflection of what I thought at the time of sending.
The message may contain information that is not intended for you or that
you don't understand.