You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by amit patel <am...@gmail.com> on 2009/12/03 01:00:04 UTC
WAR manifest customization - not again!
http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html
According to this guide, marking dependency as optional=true should be
regarded by war plugin to not copy jars in web-inf / lib
I cant get it to work without packagingExcludes
If I want to copy some jars in web-inf/lib and refer some from EAR/lib
using manifest, this would become messy
it seems like optional tag is not respected anymore?
I am using
Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
Java version: 1.6.0_16
Java home: C:\Apps\Java\jdk160_16\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
Here is my pom
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>cpa.tuscany.example.service</groupId>
<artifactId>ExampleTuscanyService</artifactId>
<name>ExampleTuscanyService</name>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-sca-api</artifactId>
<version>2.0-M4</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-web-runtime</artifactId>
<version>2.0-M4</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.18</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
<!-- Create a skinny war. All JARs go into the EAR. -->
<warSourceExcludes>
WEB-INF/lib/*.jar
</warSourceExcludes>
<packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> <!--
when I remove this, jars end up in web-inf / lib -->
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>manifest</goal>
</goals>
<inherited>true</inherited>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: WAR manifest customization - not again!
Posted by amit patel <am...@gmail.com>.
Well, I paid a little more attention and optional does work, but not like I
expected.
Tuscany comes with 200 jars.
optional removed that particular jar, but not its dependencies!
so i was still stuck with 199 jars in my web-inf lib, until I used
packagingExcludes
In case where you want 15 jars on top of EAR/lib folder, and 5 in
web-inf/lib, this is still messy (lot of maintenance)
We need optional=true/false/recursive or optionalchildren=true to get rid of
dependent jars if parent guy is optional.
-
On Wed, Dec 2, 2009 at 6:00 PM, amit patel <am...@gmail.com> wrote:
>
> http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html
>
> According to this guide, marking dependency as optional=true should be
> regarded by war plugin to not copy jars in web-inf / lib
>
> I cant get it to work without packagingExcludes
>
> If I want to copy some jars in web-inf/lib and refer some from EAR/lib
> using manifest, this would become messy
>
> it seems like optional tag is not respected anymore?
>
> I am using
>
> Apache Maven 2.2.1 (r801777; 2009-08-06 14:16:01-0500)
> Java version: 1.6.0_16
> Java home: C:\Apps\Java\jdk160_16\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
>
> Here is my pom
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
> <modelVersion>4.0.0</modelVersion>
>
> <groupId>cpa.tuscany.example.service</groupId>
> <artifactId>ExampleTuscanyService</artifactId>
> <name>ExampleTuscanyService</name>
> <packaging>war</packaging>
> <version>1.0-SNAPSHOT</version>
>
> <dependencies>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
> <artifactId>tuscany-sca-api</artifactId>
> <version>2.0-M4</version>
> <optional>true</optional>
> </dependency>
>
> <dependency>
> <groupId>org.apache.tuscany.sca</groupId>
>
> <artifactId>tuscany-implementation-web-runtime</artifactId>
> <version>2.0-M4</version>
> <optional>true</optional>
> </dependency>
>
> </dependencies>
>
> <build>
> <finalName>${artifactId}</finalName>
> <sourceDirectory>src</sourceDirectory>
> <plugins>
> <plugin>
> <groupId>org.mortbay.jetty</groupId>
> <artifactId>maven-jetty-plugin</artifactId>
> <version>6.1.18</version>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1-beta-1</version>
> <configuration>
>
> <warSourceDirectory>web</warSourceDirectory>
> <!-- Create a skinny war. All JARs
> go into the EAR. -->
> <warSourceExcludes>
> WEB-INF/lib/*.jar
> </warSourceExcludes>
>
> <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> <!--
> when I remove this, jars end up in web-inf / lib -->
> <archive>
> <manifest>
>
> <addClasspath>true</addClasspath>
>
> <classpathPrefix>lib/</classpathPrefix>
> </manifest>
> </archive>
>
> </configuration>
> <executions>
> <execution>
> <phase>package</phase>
> <goals>
>
> <goal>manifest</goal>
> </goals>
> <inherited>true</inherited>
> </execution>
> </executions>
> </plugin>
>
> </plugins>
> </build>
>
> </project>
>