5

My parent pom exlicitly declares a dependence on maven-javadoc-plugin 2.9.1 in both

<pluginManagement>
   <plugins>
     <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>
     </plugin>
        ...

and

    <reporting>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>2.9.1</version>
         ...

(see Maven plugin version in pom (seemingly) ignored ) and mvn help:effective-pom shows 2.9.1 is being used. However, the build is using 2.10 which is causes build failures (see maven-javadoc-plugin breaks mvn release:perform and http://jira.codehaus.org/browse/MJAVADOC-407 )

mvn help:describe -DgroupId=org.apache.maven.plugins \
                  -DartifactId=maven-javadoc-plugin

shows

    Name: Apache Maven Javadoc Plugin
    Description: The Apache Maven Javadoc Plugin is a plugin that uses the
      javadoc tool for generating javadocs for the specified project.
    Group Id: org.apache.maven.plugins
    Artifact Id: maven-javadoc-plugin
    Version: 2.10
    Goal Prefix: javadoc

Meanwhile,

mvn dependency:resolve-plugins

shows

[INFO] Plugin Resolved: maven-javadoc-plugin-2.9.1.jar

Yet when I run the build, mvn uses 2.10 instead, causing a build failure.

How can I force maven to use 2.9.1 and not the broken 2.10?

(I'm using Maven 3.2.1)

Community
  • 1
  • 1
djb
  • 4,930
  • 1
  • 34
  • 37
  • Have you checked the full dependency tree, to see if some other dependency is also importing the javadoc plugin? – Software Engineer Sep 24 '14 at 19:07
  • How do I do that? I ran mvn dependency:resolve-plugins and it reports 2.9.1 – djb Sep 24 '14 at 19:28
  • I "fixed" the problem by deleting my ~/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin. I'm not writing this as an answer to the question; I would still like to see better Maven dependency: tools to show the dependency chains (i.e. what plugin 'forced' the use of 2.10 contrary to the pom.xml). Hopefully the steps I took to diagnose and the workaround will help others. – djb Sep 24 '14 at 21:14

1 Answers1

5

Be sure that you are looking at the right dependency. We are seeing that 2.9.1 as specified is being used for site reports but 2.10 is being used by the build. I believe you should specify it in your

<build><plugins>

section as well.

We just verified that we were suffering the same problem. We had the plugin version in the reporting plugins section but not build plugins. Once we added it to the build plugins section, the issue was resolved. The reason it needed to be in build plugins was because it was being used in the prepare deploy phase to build a javadoc jar. This happens separately from generating javadoc for the site reports.

dres
  • 1,172
  • 11
  • 15
  • I've tried that, too, and mvn help:describe still shows Version: 2.10 -- strange! But as with adding it to pluginManagement, the build succeeds and -X shows maven-javadoc-plugin:2.9.1:javadoc (once my repo was cleaned out). I think all together, this is enough of an answer – djb Sep 25 '14 at 16:34