You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dpaily <dp...@sonypictures.com> on 2011/05/20 02:02:04 UTC
A maven-war-plugin question
I'm using maven-war-plugin in my pom. Here is my code
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<webappDirectory>target/${webapp.name}</webappDirectory>
<webResources>
<resource>
<directory>src/main/resources/META-INF/</directory>
<targetPath>META-INF</targetPath>
</resource>
</webResources>
<packagingExcludes>src/main/resources/META-INF/</packagingExcludes>
</configuration>
</plugin>
My questions is, I need the files under META-INF to show up under
target/<project-name>/META-INF/, which the above code accomplishes. But
since the plugin constructs its own folder structure, it puts those files
under target/<project-name>/WEB-INF/classes/META-INF/ as well. How can I get
the files to be excluded from classes/META-INF/ folder and only make them
show up under target/<project-name>/META-INF?
--
View this message in context: http://maven.40175.n5.nabble.com/A-maven-war-plugin-question-tp4411244p4411244.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: A maven-war-plugin question
Posted by Russ Tremain <ru...@releasetools.org>.
I think your real question might be, who is putting this stuff in my WEB-INF/classes dir?
It is the resources plugin, as commanded by the war-plugin.
therefore, you would add a <build><resources> element to prevent this.
Below is a trivial example.
/r
========================================== src
src/main/resources/META-INF/foo.xml
========================================== target
target/foo-1.0.war
target/foo/META-INF/foo.xml
target/war/work/webapp-cache.xml
========================================== war contents
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
META-INF/foo.xml
========================================== pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>foo</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<build>
<resources>
<resource>
<directory>${project.build.sourceDirectory}</directory>
<includes>
<include/>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webappDirectory>target/${webapp.name}</webappDirectory>
<packagingExcludes>WEB-INF/classes/**</packagingExcludes>
<webResources>
<resource>
<directory>src/main/resources/META-INF/</directory>
<targetPath>META-INF</targetPath>
</resource>
</webResources>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<webapp.name>foo</webapp.name>
</properties>
</project>
At 5:02 PM -0700 5/19/11, dpaily wrote:
>I'm using maven-war-plugin in my pom. Here is my code
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1-beta-1</version>
> <configuration>
> <webappDirectory>target/${webapp.name}</webappDirectory>
> <webResources>
> <resource>
> <directory>src/main/resources/META-INF/</directory>
> <targetPath>META-INF</targetPath>
> </resource>
> </webResources>
>
><packagingExcludes>src/main/resources/META-INF/</packagingExcludes>
>
> </configuration>
> </plugin>
>
>My questions is, I need the files under META-INF to show up under
>target/<project-name>/META-INF/, which the above code accomplishes. But
>since the plugin constructs its own folder structure, it puts those files
>under target/<project-name>/WEB-INF/classes/META-INF/ as well. How can I get
>the files to be excluded from classes/META-INF/ folder and only make them
>show up under target/<project-name>/META-INF?
>
>--
>View this message in context: http://maven.40175.n5.nabble.com/A-maven-war-plugin-question-tp4411244p4411244.html
>Sent from the Maven - Users mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>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: A maven-war-plugin question
Posted by Anders Hammar <an...@hammar.net>.
Put the META-INF folder structure in src/main/webapp. Not in
src/main/resources.
You should then be able to remove all your special configuration, which is a
clear sign of being on the right track.
/Anders
On Fri, May 20, 2011 at 02:02, dpaily <dp...@sonypictures.com> wrote:
> I'm using maven-war-plugin in my pom. Here is my code
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1-beta-1</version>
> <configuration>
> <webappDirectory>target/${webapp.name
> }</webappDirectory>
> <webResources>
> <resource>
>
> <directory>src/main/resources/META-INF/</directory>
> <targetPath>META-INF</targetPath>
> </resource>
> </webResources>
>
> <packagingExcludes>src/main/resources/META-INF/</packagingExcludes>
>
> </configuration>
> </plugin>
>
> My questions is, I need the files under META-INF to show up under
> target/<project-name>/META-INF/, which the above code accomplishes. But
> since the plugin constructs its own folder structure, it puts those files
> under target/<project-name>/WEB-INF/classes/META-INF/ as well. How can I
> get
> the files to be excluded from classes/META-INF/ folder and only make them
> show up under target/<project-name>/META-INF?
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/A-maven-war-plugin-question-tp4411244p4411244.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>