Logging configuration for the Apache Tomcat Maven plugin exec-war-only goal?

maven, tomcat

Solution

I was able to find the answer by looking at the the getters/setters in the Maven model Resource class. The proper syntax is:

<extraResources>
   <extraResource>
      <directory>path/to/resource/</directory>
      <includes>
         <include>resource.file.name</include>
      </includes>
   </extraResource>
</extraResources>

Problem

I would like to specify a logging configuration file via the extraResources tag described @ http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/exec-war-only-mojo.html#extraResources and am getting the following maven error ``` Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:exec-war-only (tomcat-run) on project iot-service-embedded-tomcat: Unable to parse configuration of mojo org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:exec-war-only for parameter extraResource: Cannot configure instance of org.apache.tomcat.maven.plugin.tomcat7.run.ExtraResource from log4j.properties ``` Here's the maven plugin entry: ``` <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.1</version> <executions> <execution> <id>tomcat-run</id> <goals> <goal>exec-war-only</goal> </goals> <phase>package</phase> <configuration> ... <extraResources> <extraResource> log4j.properties </extraResource> </extraResources> <extraDependencies> ... <extraDependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> <scope>compile</scope> </extraDependency> </extraDependencies> ... </configuration> </execution> </executions> </plugin> ``` What is the proper syntax?

Original source