You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by maxmil <ma...@alwayssunny.com> on 2006/07/21 18:08:36 UTC

Separate static content in war

In my development environment i use tomcat with my exploded war in
/src/main/webapp.

Within this directory apart from the contents of WEB-INF i have jsp's,
htmls, gifs, jpgs.

In production i use separate application and web servers.

When i generate my war to export to my application server in my production
environment i don't want the htmls, gifs, jpgs etc to be copied.

I have tried creating a resource in the plugin properties in my pom.xml and
excluding certain static files, but it has not  worked. The /src/main/webapp
folder is always copied entirely to my war each time that i build it.

Here is the code that i have tried

           <plugin>
	      <groupId>org.apache.maven.plugins</groupId>
	      <artifactId>maven-war-plugin</artifactId>
	      <version>2.0</version>
	      <configuration>
	        <webResources>
	          <resource>
	            <directory>src/main/webapp</directory>
	            <excludes>
	            	<exclude>**/*.jsp</exclude>
	            	<exclude>**/*.gif</exclude>	            	
	            </excludes>
	          </resource>
	        </webResources>
	       </configuration>
	     </plugin>

All help would be apreciated.


-- 
View this message in context: http://www.nabble.com/Separate-static-content-in-war-tf1981030.html#a5436334
Sent from the Maven - Users forum at Nabble.com.


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


Re: Separate static content in war

Posted by maxmil <ma...@alwayssunny.com>.
Thanks for the tip Denis.

I'm working in Maven 2 and found an even easier way... warSourceExcludes was
exactly what i was looking for.

This is the relavant build entry in my pom.xml

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-war-plugin</artifactId>
              <version>2.0</version>
              <configuration>
                                       
<warSourceExcludes>${prop.warSourceExcludes}</warSourceExcludes>
               </configuration>
             </plugin>

The propertty ${prop.warSourceExcludes} is defined depending on my
environement (development or production).
-- 
View this message in context: http://www.nabble.com/Separate-static-content-in-war-tf1981030.html#a5472639
Sent from the Maven - Users forum at Nabble.com.


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


Re: Separate static content in war

Posted by dcabasson <de...@insee.fr>.

maxmil wrote:
> 
> When i generate my war to export to my application server in my production
> environment i don't want the htmls, gifs, jpgs etc to be copied.
> 

Try changing the property:
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#warSourceDirectory
to an empty directory.

By default, all ressources from the webapp directory are copied (without
filtering), and your extras webRessource configuration is added to the
war....

Denis.
-- 
View this message in context: http://www.nabble.com/Separate-static-content-in-war-tf1981030.html#a5463278
Sent from the Maven - Users forum at Nabble.com.


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