Reputation: 51
I'm trying to use the maven-remote-resources-plugin to share remote resources in multiple projects.
I have one jar with resource files in \src\main\resources. The pom is :
...
<build>
<plugins>
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<includes>
<include>*.*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
When I run mvn install on this project, it creates \target\classes\META-INF\maven\remote-resources.xml file containing all files in \src\main\resources.
That seems to be correct.
The problem is in the projects that needs the resources. I have this in the pom :
...
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<resourceBundles>
<resourceBundle><groupId>:<artifactId>:<version></resourceBundle>
</resourceBundles>
</configuration>
</execution>
</executions>
</plugin>
...
When I run mvn install on this project, I get this on the console :
[INFO] --- maven-remote-resources-plugin:1.5:process (default) @ <project> ---
Downloading: <repository>/<groupId>/<artifactId>/<version>/maven-metadata.xml
781/781 B
Downloaded: <repository>/<groupId>/<artifactId>/<version>/maven-metadata.xml (781 B at 38.1 KB/sec)
So it seems that the resource bundle is found and downloaded.
In the Apache documentation of maven-remote-dependency-plugin it is said :
This will retrieve the apache-jar-resource-bundle-1.0.jar from the remote repositories specified in your POM, process each resource in the bundle and deposit them in your projects $basedir/target/classes directory.
However, the files are not copied to the directory.
Am I missing something or doing something wrong?
Maven version 3.3.1
Thank you in advance for your answers.
Upvotes: 4
Views: 2437
Reputation: 51
Finally all work fine.
Don't know if either I didn't see the created folder (which is ${project.build.directory}/maven-shared-archive-resources
by default, and not ${basedir}/target/classes
like it is said in the documentation) or there was something wrong in my installed/deployed resource project.
However, with the code above, I get all my resources copied in the ${project.build.directory}/maven-shared-archive-resources
directory of the projects that have the resource dependency (those where the process goal is defined in the pom).
If you ever want to change the directory in which the resources are copied, just add <outputDirectory>
option to the configuration of the process goal in your pom.xml
.
Upvotes: 1