【发布时间】:2015-09-30 20:41:56
【问题描述】:
我正在尝试为我的构建配置 exec-war-only 目标以包含一些额外资源(一些配置文件)。我正在使用的配置如下所示
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec-war-only</goal>
</goals>
</execution>
</executions>
<configuration>
<buildDirectory>${project.basedir}/../kmszip/</buildDirectory>
<path>/kms</path>
<finalName>${project.artifactId}.jar</finalName>
<enableNaming>true</enableNaming>
<extraResources>
<directory>${project.basedir}/</directory>
<includes>
<include>config.json</include>
</includes>
</extraResources>
</configuration>
</plugin>
使用上述配置构建时出现以下错误
[错误] 无法在项目 KeyManagementService 上执行目标 org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war-only(默认):无法解析 mojo org.apache.tomcat 的配置。 maven:tomcat7-maven-plugin:2.2:exec-war-only 用于参数目录:在类 org.apache.tomcat.maven.plugin.tomcat7.run.ExtraResource 中找不到默认设置器 -> [帮助 1]
我还尝试对<extraResources> 使用以下配置,并得到与上述类似的错误。
<extraResources>
<extraResource>${project.basedir}/config.json</extraResource>
</extraResources>
【问题讨论】:
标签: java maven tomcat tomcat7-maven-plugin