我正在尝试为我的构建配置仅用于执行war的目标,以包含一些额外的资源(一些配置文件)。下面给出了我使用的配置
<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>在使用上面的配置构建时,我得到了以下错误
错误未能在项目org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war-only (默认)上执行KeyManagementService:无法为参数目录解析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>发布于 2015-09-30 21:30:18
您缺少了<extraResource>标签在<extraResources>下。正确的配置应该是:
<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>
<extraResource>
<directory>${project.basedir}/</directory>
<includes>
<include>config.json</include>
</includes>
</extraResource>
</extraResources>
</configuration>
</plugin>https://stackoverflow.com/questions/32875258
复制相似问题