Alex Coles
2008-10-13 02:07:35 UTC
I am encountering problems trying to exclude certain file types from
my WAR files. My WAR files are bloated, and becoming difficult to very
cumbersome to deploy to production servers.
Here's the two main types of files that should not be included in my WARs:
* Versioning Control Files (.git, .gitignore, .svn; I am using git's
submodules feature with one particular directory, but certainly do not
want to deploy a whole .git repository with my WAR)
* Photoshop PSD files, of which most are contained within a
assets/src-images folder.
This issue is somewhat similar to the issue raised here, over 2 years ago:
http://www.mail-archive.com/***@maven.apache.org/msg41790.html
http://markmail.org/message/qeoprewtxngxlaom
I have tried two configurations:
[1]
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
<excludes>
<exclude>**/.git</exclude>
<exclude>**/.gitignore</exclude>
<exclude>**/*.psd</exclude>
<exclude>assets/src-images/**</exclude>
</excludes>
</configuration>
</plugin>
[2]
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
<webResources>
<resource>
<!--<directory>resource2</directory>-->
<excludes>
<exclude>**/.git</exclude>
<exclude>**/.gitignore</exclude>
<exclude>**/*.psd</exclude>
<exclude>assets/src-images/**</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
[1] doesn't seem to be working. the excludes are simply ignored.
[2] throws a NullPointerException if the directory element is omitted.
This appears to contradict the fourth example in the documentation
(under Includes/Excludes here:
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html)
which shows the directory element may be omitted.
Thanks for any advice you can give.
Alex Coles
my WAR files. My WAR files are bloated, and becoming difficult to very
cumbersome to deploy to production servers.
Here's the two main types of files that should not be included in my WARs:
* Versioning Control Files (.git, .gitignore, .svn; I am using git's
submodules feature with one particular directory, but certainly do not
want to deploy a whole .git repository with my WAR)
* Photoshop PSD files, of which most are contained within a
assets/src-images folder.
This issue is somewhat similar to the issue raised here, over 2 years ago:
http://www.mail-archive.com/***@maven.apache.org/msg41790.html
http://markmail.org/message/qeoprewtxngxlaom
I have tried two configurations:
[1]
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
<excludes>
<exclude>**/.git</exclude>
<exclude>**/.gitignore</exclude>
<exclude>**/*.psd</exclude>
<exclude>assets/src-images/**</exclude>
</excludes>
</configuration>
</plugin>
[2]
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
<webResources>
<resource>
<!--<directory>resource2</directory>-->
<excludes>
<exclude>**/.git</exclude>
<exclude>**/.gitignore</exclude>
<exclude>**/*.psd</exclude>
<exclude>assets/src-images/**</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
[1] doesn't seem to be working. the excludes are simply ignored.
[2] throws a NullPointerException if the directory element is omitted.
This appears to contradict the fourth example in the documentation
(under Includes/Excludes here:
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html)
which shows the directory element may be omitted.
Thanks for any advice you can give.
Alex Coles