Hey,
Javadoc on immutable interfaces will stop the build from working.
You can use other versions than the default compiler-plugin or default javadoc-plugin, but it will make no difference.
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.immutables/value -->
<dependency>
<groupId>org.immutables</groupId>
<artifactId>value</artifactId>
<version>2.7.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
consider the following interface:
package de.user.immutablesjavadoc;
import org.immutables.value.Value;
import java.util.UUID;
@Value.Immutable
public interface UserId {
UUID getValue();
static ImmutableUserId.ValueBuildStage builder() {
return ImmutableUserId.builder();
}
}
Running mvn compile:
$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< de.user:immutables-javadoc >-------------------
[INFO] Building immutables-javadoc 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ immutables-javadoc ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ immutables-javadoc ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.237 s
[INFO] Finished at: 2019-01-10T12:04:36+01:00
[INFO] ------------------------------------------------------------------------
Running mvn javadoc:jar
$ mvn javadoc:jar
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< de.user:immutables-javadoc >-------------------
[INFO] Building immutables-javadoc 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (default-cli) @ immutables-javadoc ---
[WARNING] Source files encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO]
Loading source files for package de.user.immutablesjavadoc...
Constructing Javadoc information...
1 error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.667 s
[INFO] Finished at: 2019-01-10T12:04:44+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (default-cli) on project immutables-javadoc: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /home/user/svn/immutablesjavadoc/src/main/java/de/user/immutablesjavadoc/UserId.java:12: error: package ImmutableUserId does not exist
[ERROR] static ImmutableUserId.ValueBuildStage builder() {
[ERROR] ^
[ERROR]
[ERROR] Command line was: /home/user/.jabba/jdk/[email protected]/bin/javadoc @options @packages
[ERROR]
[ERROR] Refer to the generated Javadoc files in '/home/user/svn/immutablesjavadoc/target/apidocs' dir.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I'd expect the javac executable is capable of recognizing ImmutableUserId is not a package.
Using java 8 this will give the same message as a warning.
But with Java 11 this will be a fatal error, the javadoc:jar build will stop.
Is additional configuration needed? If so, shouldn't this go to the immutables homepage and/or README.md?
Thanks!
Hi, just figured it out.
This is the minimum needed to make it work:
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<sourcepath>${project.build.sourceDirectory}:${project.build.directory}/generated-sources/annotations</sourcepath>
<additionalDependencies>
<additionalDependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</additionalDependency>
</additionalDependencies>
</configuration>
</plugin>
</plugins>
</build>
Maybe, besides documentation, this should be filed as a bug against the maven-javadoc-plugin?
Most helpful comment
Hi, just figured it out.
This is the minimum needed to make it work:
Maybe, besides documentation, this should be filed as a bug against the maven-javadoc-plugin?