maven 排除配置文件打包_Maven,从打包的jar中排除资源文件夹

I'm trying to achieve the following distribution for my application, and I'm following this question as guideline

dist/

|-- application-1.0.jar

|-- conf/

|-- application.properties

|-- log4j.properties

|-- lib/

|-- *.jar

My src/main/resources looks like following

resources/

|-- to.be.packaged.inside.jar

|-- to.be.packaged/

| |-- also

|-- conf/

|-- application.properties

|-- log4j.properties

Now, I want to exclude the whole conf folder from being packaged in the JAR (but placed in the target folder).

I tried the following configuration to maven-jar-plugin

conf/*

However, this still packages an empty conf folder inside the JAR. How do I exclude the folder and the content?

解决方案

With conf/* you're only excluding the matching files, it doesn't match the conf directory. By added conf the directory will be excluded as well.

However, you should ask yourself: should these files be available on the classpath? I would expect the conf-directory to be a directory in the project-root (i.e. /conf ), which also means a cleaner pom because you don't have to exclude resources.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值