Take the 2-minute tour ×

We've been using war:exploded for a while now and I'm trying to do away with it. I've added the following to my pom:


This copies files such as the in src/main/webapp/keystore into target/classes/keystore so my local UI launcher works and sees everything. Score!

However, by adding to the resources list, this means that the same files also show up in the war file as keystore (correct) and WEB-INF/classes/keystore (wrong). It also means there there is a WEB-INF/classes/WEB-INF directory (blah). I'm trying to exclude the resource files from src/main/webapp resource since src/main/webapp/WEB-INF is already a resource.

I'm trying not to specifically exclude keystore and other files since we add/delete from that list semi-often. I've tried to add the following (and a number of other variants) to the war plugin configuration without results:


I've also read a number of other SO questions and I've spent at least an hour reading docs on from the maven war plugin page and tried other configs without success.

Any idea what magic I need to do here? Thanks in advance.

share|improve this question
What about moving the keystore directory into /src/main/resources instead of having it in /src/main/webapp? Then the maven-resources-plugin will handle the copy into target/classes/keystore. –  user944849 Oct 4 '13 at 13:12
keystore is a file @user944849. I could do that but I think that would break the war in other ways. The webapp layout is textbook from a war plugin perspective: maven.apache.org/plugins/maven-war-plugin/usage.html –  Gray Oct 4 '13 at 13:15
I think I must be missing something. The question says the keystore file should be at the top level of the war (keystore) not in the war's typical location (WEB-INF/classes/keystore). Thus, you are looking to do something a little different than the textbook war plugin method. The way to do what you're asking for in Maven is to put the file in /src/main/resources. –  user944849 Oct 4 '13 at 13:56
So if you are talking about wars @user944849, then typically the web resources are put in src/main/webapp. That's where the keystore file is located and it is copied (appropriately) into the root of the war classpath. –  Gray Oct 4 '13 at 14:01

2 Answers 2

You need


Also See

share|improve this answer
Thanks for this. I'm trying to "not specifically exclude keystore and other files" like the post states. Any way to exclude a particular overlapping resource directory? –  Gray Oct 4 '13 at 12:04
just replace **/keystore with your desired pattern –  Jigar Joshi Oct 4 '13 at 16:09
up vote 1 down vote accepted


I was not able to get the war-plugin to properly exclude the webapp directory while at the same time allowing the webapp/WEB-INF directory. Instead of adding the following to the pom:

<!-- bad idea, this didn't work -->

I switched to using the resources-plugin to be able to copy certain resources over during the validate phase:


I initially copied the webapp directory into target/classes but that also seemed to make it into the resulting war file which was what I was trying to avoid. I have the feeling that I could have solved this if necessary.

Instead I decided to copy the webapp files into the target/webapp directory and change my program to look for the resources there:

String RESOURCE_BASE = "target/webapp";
System.setProperty("server.jetty.webapp.resourceBase", RESOURCE_BASE + "/");
System.setProperty("server.jetty.ssl.keystore", RESOURCE_BASE + "/keystore");
System.setProperty("server.jetty.ssl.truststore", RESOURCE_BASE + "/keystore");

This seems to be working well. Testing locally now works (without war-exploded!!) and the files are not doubly included in the resulting war file. In addition, I added a symlink at runtime from target/webapp/views/cms to point to our CMS hierarchy which is in another project.

share|improve this answer

Your Answer


