36

I'm trying to execute mvn release:perform on three projects that I have released to our Nexus server many times in the past. Suddenly today, for no apparent reason, all releases are failing to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10:jar (attach-javadocs).

With full stack tracing and debug logging turned on (-e and -X), I see several hundred lines of errors about missing packages:

...    
package org.apache.http does not exist
package org.slf4j does not exist
package org.joda.time does not exist
...

However, all of these packages are in both my local repository and Nexus server. Moreover, I don't get any of these errors from mvn clean install, and all the projects (Java web apps) actually launch from Intellij without issues—so clearly I'm not actually missing hundreds of packages.

What could be preventing mvn release:perform from finding these packages when mvn clean install and mvn release:prepare don't have any problems?

Rob Johansen
  • 5,076
  • 10
  • 40
  • 72
  • 1
    I'm seeing the same issue. It looks like a new version of the plugin was released yesterday Sun, 21 Sep 2014 http://www.mail-archive.com/users@maven.apache.org/msg134790.html – Josh Canfield Sep 23 '14 at 00:10
  • 2
    http://jira.codehaus.org/browse/MJAVADOC-398 The fix for this ticket appears to have caused the problem. http://jira.codehaus.org/browse/MJAVADOC-406 - this ticket is in response, but it was unresolved before the latest release. – Josh Canfield Sep 23 '14 at 00:18

7 Answers7

39

Another way to fix this issue is to add the following property :

...
<properties>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
...
</properties>

in your pom.xml

  • 5
    or, in other words: `mvn -Dmaven.javadoc.failOnError=false whatever` – acdcjunior Nov 18 '14 at 21:39
  • 11
    Try `mvn -Darguments="-Dmaven.javadoc.failOnError=false" whatever`. When passing multiple arguments to the forked process then join them in one -Darguments. For example `-Darguments="-DskipITs -Dmaven.javadoc.failOnError=false"` – Bart Swennenhuis Oct 01 '15 at 09:30
32

There seems to be a cascade of issues regarding update to maven-javadoc-plugin. See https://issues.apache.org/jira/browse/MJAVADOC-408.

I can see some benefit in having mvn use the latest versions of "built-in" plugins if not otherwise specified (vs. a "pinned version" for a given Maven version), but it means plug-in maintainers are obliged to do regression testing against every version of Maven upon a plugin release. Maybe something was missed.

One workaround would be to explicitly specify the previous version of maven-javadoc-plugin in your organization's super POM, or alternatively, the project POM if it's not possible to change the super POM in a hurry:

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

Our CI rig (Jenkins) hit the same problem today. Hopefully a new maven-javadoc-plugin will get pushed with it's dependency tree updated (if that is indeed the issue). FWIW, we were on 3.0.5 (ya, sad for a variety of reasons).

Update 2014-09-24

This whole hubub seems to have originated in the response of maven-javadoc-plugin maintainers to an yet-to-be-closed issue in java-1.8.0-openjdk in MJAVADOC-398. I have no idea why anyone would release a breaking work-around for a unresolved downstream project defect.

Update 2014-10-02

MJAVADOC-406 has been resolved and there is a 2.10.1 version of maven-javadoc-plugin available in Maven Central and likely many repositories near you.

Builds with un-pinned javadoc plugin version should be returning to normal now.

Moral of the Story

Maven-folk, you have been warned. Lock down your plug-in dependencies because they could go rogue.

P.S., MJAVADOC-408 has been closed as a duplicate of MJAVADOC-407.

turbanoff
  • 2,439
  • 6
  • 42
  • 99
David J. Liszewski
  • 10,959
  • 6
  • 44
  • 57
  • 1
    On further thought, regression would have to have been be against every plug-in version .. not a happy prospect. It may turn out an update to `maven-release-plugin` is in order. – David J. Liszewski Sep 23 '14 at 04:03
  • Thanks, David. We only have a few POMs, so this works for us. – Rob Johansen Sep 23 '14 at 15:53
  • We have a central POM to pin external dependencies. Tks a lot. – Lovato Sep 23 '14 at 19:33
  • 4
    we have strong regression tests in every plugin, run as ITs. In general these ITs give us the protection we expect against such regressions. But it seems we missed a use case here... will need to add one more in http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-javadoc-plugin/src/it/ – hboutemy Sep 24 '14 at 04:16
  • 1
    @hboutemy Much obliged for the follow-up. What's the recommendation? – David J. Liszewski Sep 24 '14 at 05:13
  • Thank you for all details. Great explanation – Danilo Gomes Apr 25 '16 at 15:07
13

mvn release package uses a special profile by default. This default profile includes some default plugin configurations (such as automatically attach-javadocs as part of the build).

This is the reason your build is only failing on mvn release:perform and not on mvn clean install.

If you want to control in a better way what configuration is going to be used (for example if you don't want javadocs, or you want to provide your own configuration for the javadocs), you can try disabling this default profile by adding the configuration: <useReleaseProfile>false</useReleaseProfile>

or in the command-line: mvn release:perform -DuseReleaseProfile=false

More info here: http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html#useReleaseProfile

crandrad
  • 5,081
  • 1
  • 17
  • 7
  • I'm having the opposite problem - I want to see how javadoc will fail before I get to the stage of performing a release. Is there a way to get `mvn javadoc:javadoc` to fail in the same way that it would during a release? – Ian Robertson Mar 16 '16 at 22:16
  • This problem hung me up for a long time while I tried to do a release:perform after making some changes to the pom subsequent to the release:prepare which were designed to test and fix the java doc generation in java 8 problem with doclint. Turning off useReleaseProfile finally let me complete the release, though without the javadocs included. I could subsequently remove the useReleaseProfile=false setting for new release which then included the javadocs. – Peter N. Steinmetz Mar 12 '18 at 20:51
4

I just had a previously working build fail with Javadoc plugin 2.9.1.

In my case it was because I switched to Java 8 from 7, and the javadoc tool in 8 seems to be stricter with its checks. I had a broken {@link ...} in my code that the tool from 7 was letting through.

Jens
  • 67,715
  • 15
  • 98
  • 113
user2800708
  • 1,890
  • 2
  • 18
  • 31
  • Similar problem. I got this error when compiling from and to Java7 source code using the Java8 compiler. – Pytry Jul 28 '15 at 18:21
4

If javadocs generation is not needed just add the skip property:

<properties>
    <maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
magiccrafter
  • 5,175
  • 1
  • 56
  • 50
3

I have version 2.8 and

<maven.javadoc.failOnError>false</maven.javadoc.failOnError>

works

0

As of 2021-12-15 , this is what worked for me using Maven 3.8.4 and version 3.0.1 of the maven-javadoc-plugin:

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
            <doclint>none</doclint>
          </configuration>
        </plugin>
Tobias Gierke
  • 392
  • 1
  • 9