Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-javadoc-plugin breaks mvn release:perform

Tags:

java

maven

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?

like image 276
Rob Johansen Avatar asked Sep 22 '14 22:09

Rob Johansen


People also ask

How do I fix Javadoc errors?

You need to call mvn javadoc:fix to fix main Java source files (i.e. inside src/main/java directory) or mvn javadoc:test-fix to fix test Java source files (i.e. inside src/test/java directory).

What is Maven Release perform?

release:perform will fork a new Maven instance to build the checked-out project. This new Maven instance will use the same system configuration and Maven profiles used by the one running the release:perform goal. After the release is complete, the release.

How do I disable Javadoc in Maven?

The Javadoc generation can be skipped by setting the property maven. javadoc. skip to true [1], i.e.

How do I publish a Javadoc?

In the Goals field, place javadoc:javadoc —this will tell Maven to generate the Javadoc documentation. Now go to the “Post-build Action” and tick the “Publish Javadoc” checkbox. This project is a multimodule project, so a separate subdirectory is generated for each module (core, services, web and so forth).


2 Answers

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

like image 95
Frédéric Meunier Avatar answered Sep 22 '22 19:09

Frédéric Meunier


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.

like image 40
David J. Liszewski Avatar answered Sep 22 '22 19:09

David J. Liszewski