Chris Finley
Chris Finley

Reputation: 4051

How do I force Maven to use maven-resources-plugin version 2.6?

When I run $mvn -q clean install, I see a bunch of [debug] execute contextualize statements printed to the console.

After doing some searching, I determined that this is a problem with version 2.5 of the Maven Resources Plugin. This problem has been fixed in version 2.6, but I cant figure out how to get my project to use it. (http://jira.codehaus.org/browse/MRESOURCES-140)

None of my projects have this plugin listed in their poms, so I am not sure where Maven is getting it from, maybe it is used in one of the other Apache dependencies or something? (I don't really even understand what this plugin does or how plugins in Maven are used in general)

I tried adding the following to my root pom:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
        </plugin>
    </plugins>
</build>

However, this doesn't seem to solve the problem. I still see the [debug] execute contextualize output and when I run $mvn help:effective-pom, the output still shows:

  <plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
    <executions>
      <execution>
        <id>default-resources</id>
        <phase>process-resources</phase>
        <goals>
          <goal>resources</goal>
        </goals>
      </execution>
      <execution>
        <id>default-testResources</id>
        <phase>process-test-resources</phase>
        <goals>
          <goal>testResources</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

How can I force Maven to use the newer version of this plugin so that I can suppress the annoying [debug] execute contextualize outputs?

Upvotes: 2

Views: 6675

Answers (2)

user944849
user944849

Reputation: 14951

The maven-resources-plugin is bound to the lifecycle by default for jars, wars, & ears. Adding a definition to your corporate root POM as you did should work to update the version used. Things to check:

  • Is the inheriting project specifying the version of the corporate parent POM that includes the change?
  • Did you run mvn clean install on the root POM prior to running the project build?

If the answer is "yes" and "yes", try cleaning out your local artifact repo, then run mvn clean install for the root, and try the build again.

Upvotes: 1

Odward
Odward

Reputation: 113

Try do add the groupId of the plugin in your build settings :

<build>
  <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.6</version>
    </plugin>
  </plugins>
</build>

Upvotes: 5

Related Questions