我正在尝试为我的构建配置 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>