There is an archiveClasses
option in maven-war-plugin, which packages all the classes in a single .jar, and then creates .war file with that jar in lib/ folder.
I need to do the same, but leave resource files in classes directory, so that they are still accessible from the classpath but easy to modify.
What is the easiest way to do that?
Maybe you can try to configure your resources folder as a WebResource in the plugin configuration.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<archiveClasses>true</archiveClasses>
<webResources>
<resource>
<directory>src/main/resources</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
One line answer : There are no options provided in
maven-war-plugin
to exclude the resources from the jar created usingarchiveClasses
flag.
The possible and easiest workaround for this problem is to move the files present under src/main/java/resources
directory to src/main/java/webapp/WEB-INF/classes
directory.
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