I have a project with multiple resource directories:
src/main/resources
src/main/generator
src/main/generator2
I declare these resource directories as following:
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/generator</directory>
</resource>
<resource>
<directory>${basedir}/src/main/generator2</directory>
</resource>
</resources>
....
</build>
I am using maven-remote-resources-plugin
to make these resources available in other projects. I am using this plugin as following:
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/generator</directory>
</resource>
<resource>
<directory>${basedir}/src/main/generator2</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
After building, all resources from all three resource directories are in the JAR. That's great. However, remote-resources.xml
only contains the resources from src/main/resources
. How can I fix this?
I tried playing around with the resourcesDirectory
configuration property, but it seems I can only set one resource directory? I could set this property as following, but this seems like an ugly hack:
<configuration>
<resourcesDirectory>${basedir}/src/main</resourcesDirectory>
<includes>
<include>**/*</include>
</includes>
</configuration>
Not 100% sure, but you could try either something like:
or try different executions:
but I'm not sure if remote-resources.xml will be merged or overwritten.
You could also try to execute the plugin in a later phase on the output directory (prepare-package to be safe, but process-sources might work as well as I think resources:resources will be executed first):