By default the Maven Tomcat plugin with tomcat7:run
reads resources from src/main/webapp
.
However when you have custom resources from the Maven resources plugin this needs to be configured to include these. The general advice is to configure warSourceDirectory
to point to target/${project.build.finalName}
, which is created by the Maven WAR plugin in the package
phase. This works, but now files I change in src/main/webapp
will not change in the Tomcat instance until mvn package
is run. IDEs typically do a mvn compile
so resources get copied to target/classes
. I tried pointing it to target/classes but it expects a WEB-INF/ folder in there. I also tried using additionalClasspathDirs
to point to both target/classes
and src/main/webapp
which had no effect.
Plugin version is 2.2.
How do I include resources in the Maven Tomcat plugin while still being able to reload reosurces on the fly?