【问题标题】:Logging configuration for the Apache Tomcat Maven plugin exec-war-only goal?Apache Tomcat Maven 插件 exec-war-only 目标的日志记录配置?
【发布时间】:2014-02-23 05:16:02
【问题描述】:

我想通过描述 @http://tomcat.apache.org/maven-plugin-2.1/tomcat7-maven-plugin/exec-war-only-mojo.html#extraResources 的 extraResources 标记指定一个日志记录配置文件,并收到以下 maven 错误

未能在项目 iot-service-embedded-tomcat 上执行目标 org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:exec-war-only (tomcat-run):无法解析 mojo org 的配置.apache.tomcat.maven:tomcat7-maven-plugin:2.1:exec-war-only 用于参数 extraResource:无法从 log4j.properties 配置 org.apache.tomcat.maven.plugin.tomcat7.run.ExtraResource 的实例

这里是 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>

正确的语法是什么?

【问题讨论】:

    标签: maven tomcat


    【解决方案1】:

    我能够通过查看 Maven 模型资源类中的 getter/setter 找到答案。正确的语法是:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-30
      • 2011-11-02
      • 2013-06-03
      • 1970-01-01
      • 2013-08-02
      • 1970-01-01
      • 1970-01-01
      • 2012-06-24
      相关资源
      最近更新 更多