I have a simple project with maven using the maven war plugin. When I clean the project and run mvn package the conf.properties file I have is always left out of my war file.
The conf.properties file is located at src/main/java/conf/conf.properties.
Any ideas on why this file is ignored?
Thanks in advance
It is possible to include or exclude certain files from the WAR file, by using the <packagingIncludes> and <packagingExcludes> configuration parameters.
The plugin will prevent binary files filtering without adding some excludes configuration for the following file extensions jpg , jpeg , gif , bmp and png . If you like to add supplemental file extensions this can simply achieved by using a configuration like the following: <project>
Using the mvn:war:exploded command, we can generate the exploded WAR as a directory inside the target directory. This is a normal directory, and all the files inside the WAR file are contained inside the exploded WAR directory.
packagingExcludes: The comma separated list of tokens to exclude from the WAR before packaging. With packagingExcludes, the tokens are completely excluded from the final war file. With warSourceExcludes, the tokens are just ignored when copying the war directory into the war file.
if you want to package your property files, put your property files in src/main/resources. This is the generic location for property files for all maven builds.
In case you are unable to change the location of the properties file, you can add something like the following in your pom to indicate the alternate location. Refer to this as well.
<resources>
<resource>
<directory>${basedir}/src/main/java/conf</directory>
</resource>
</resources>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With