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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Ilya Basin
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Robert Patrick
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 <[hidden email]> 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: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Mark Prins
In reply to this post by Ilya Basin
2018-01-25 11:43 GMT+01:00 Basin Ilya <[hidden email]>:

> 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.