I am trying to exclude some java files from src/main/java and also some yml files from src/main/resources folder while building the jar using spring boot maven plugin. I have tried the following options:
Option 1 in maven-jar-plugin
<configuration>
<excludes>
<exclude>**/security/**/*.java</exclude>
<exclude>**/application-*.yml</exclude>
</excludes>
</configuration>
Option 2 resources in build tag:
<resources>
<resource>
<directory>src/main</directory>
<excludes>
<exclude>**/security/*</exclude>
<exclude>**/application-*.yml</exclude>
</excludes>
<filtering>false</filtering>
</resource>
</resources>
Option 1 and both are removing the java files from the generated jar.
But option 2 changes structure in JAR it includes java and resource folder.
Any pointer for the above is greatly appreciated.