Reputation: 891
I am using maven for my spring boot application(1.5 version). There are some files in src/main/resources
like abc.properties
, app.json
. Below are some pointer what i want to achieve.
I looked at related answers on SO but none matches my case. Any suggestion?
Upvotes: 0
Views: 954
Reputation: 40036
My understanding is
The way I used to do is:
src/main/appconfig/
testResource
in POM. When I use Eclipse + M2E, testResource
s will be added as source folder. Not sure how IntelliJ though)For point 2, I used to do it slightly differently. Instead of excluding, I will include in the result JAR but in a separate directory (e.g. appconfig-template), so that people using the application can take this as reference to configure their environment.
An alternative of 3 is: create a separate profile which include appconfig
as resource
. Use this profile only for your IDE setup but not building your artifact.
Upvotes: 0
Reputation: 69440
you can use the resouce tag in maven pom file:
<resources>
<resource>
<directory>[your directory]</directory>
<excludes>
<exclude>[non-resource file #1]</exclude>
<exclude>[non-resource file #2]</exclude>
<exclude>[non-resource file #3]</exclude>
...
<exclude>[non-resource file #n]</exclude>
</excludes>
</resource>
...
</resources>
For more informations see: https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
Upvotes: 2