我想通过@ http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/exec-war-only-mojo.html#extraResources描述的extraResources标记指定日志记录配置文件,并收到以下maven错误
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
这是maven插件条目:
<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>
正确的语法是什么?
答案 0 :(得分:4)
通过查看Maven模型Resource类中的getter / setter,我找到了答案。正确的语法是:
<extraResources>
<extraResource>
<directory>path/to/resource/</directory>
<includes>
<include>resource.file.name</include>
</includes>
</extraResource>
</extraResources>