maven-war-plugin webResources 配置问题

a_benben a_benben 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
现有配置:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<directory>/app/config/jenkins/src/main/resources/</directory>
<targetPath>WEB-INF/classes/</targetPath>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
<include>**/*.json</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>

声明maven在打war包时, 从外部/app/config/jenkins/src/main/resources/下拷贝资源文件到项目内, 但是当/app/config/jenkins/src/main/resources/ 不存在时, maven会打包失败, 报错

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project xxx: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed: basedir \app\config\jenkins\src\main\resources does not exist -> [Help 1]

我的项目在有些环境下, 这个资源目录确实可以不打进来, 请问如何配置为, 当目录找不到时, 忽略本条资源拷贝, 继续后续资源拷贝, 完成打包?
...全文
评论
收藏 已收藏
分享
返回顶部
a_benben
版本控制 1,279 成员 1,250 内容