2014-01-30 70 views
3

我想說明通過描述@http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/exec-war-only-mojo.html#extraResources的extraResources標籤的日誌配置文件,並正在以下Maven的錯誤Apache Tomcat Maven插件的日誌記錄配置exec-war-only目標?

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> 

什麼是正確的語法?

回答

4

我能夠通過查看Maven模型資源類中的getters/setters來找到答案。正確的語法是:

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