首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为插件exec目标声明额外的资源?

为插件exec目标声明额外的资源?
EN

Stack Overflow用户
提问于 2015-09-30 20:41:56
回答 1查看 902关注 0票数 2

我正在尝试为我的构建配置仅用于执行war的目标,以包含一些额外的资源(一些配置文件)。下面给出了我使用的配置

代码语言:javascript
复制
 <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>使用下面的配置,并得到了与上面类似的错误。

代码语言:javascript
复制
<extraResources>
    <extraResource>${project.basedir}/config.json</extraResource>
</extraResources>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-30 21:30:18

您缺少了<extraResource>标签在<extraResources>下。正确的配置应该是:

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32875258

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档