Question

I am having a difficulty to understand the difference between the maven-resources-plugin and the project.build.resources tag, in maven.

Both seem to have the same purpose. The different goals of the maven-resources-plugin [resources, testResources and copy-resources] can also be achieved using the resources tag as:

<resources>
  <resource>  
    <directory>src/dir</directory>
    <targetPath>dest/dir</targetPath>
  </resource>  
</resources>

<testResources>
  <testResource>
  <directory>src/test/dir</directory>
  </testResource>

And using <resources> tag will effectively copy the specified files in source directory to destination directory, similar to copy-resources goal of maven-resources-plugin.

Then, is there any difference between them?
Will they differ in their functionality in any particular scenario?

Was it helpful?

Solution

The maven-resources-plugin is the one which handles the resources area in your pom.xml file.

The definition of the resources plugin is done in the super pom of maven. You can check which version is used by using:

mvn help:effective-pom

Furthermore the resources goal of the maven-resources-plugin is related to the resources tag in you pom whereas testResources tag is related to testResources goal of the maven-resources-plugin.

The copy-resources goal can be used to separetely copying resources etc. to an output folder if needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top