Apache Tomcat Maven插件的exec-war-only目标的日志记录配置? [英] Logging configuration for the Apache Tomcat Maven plugin exec-war-only goal?

查看:104
本文介绍了Apache Tomcat Maven插件的exec-war-only目标的日志记录配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过@

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

这是maven插件条目:

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>

正确的语法是什么?

推荐答案

我能够通过查看Maven模型Resource类中的getter/setter方法来找到答案.正确的语法是:

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>

这篇关于Apache Tomcat Maven插件的exec-war-only目标的日志记录配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆