Skip to content

Javadoc generation does not work with Java 9 #10029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
snicoll opened this issue Aug 17, 2017 · 2 comments
Closed

Javadoc generation does not work with Java 9 #10029

snicoll opened this issue Aug 17, 2017 · 2 comments
Assignees
Labels
type: task A general task
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Aug 17, 2017

Executing

$ mvn clean install -U -DskipTests -Pfull -s ../settings.xml

From the spring-boot-full-build directory yield:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.0-M1:jar (attach-javadocs) on project spring-boot-devtools: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /Users/snicoll/workspace/pivotal/spring-boot/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/HateoasObjenesisCacheDisabler.java:21: error: package javax.annotation is not visible
[ERROR] import javax.annotation.PostConstruct;
[ERROR]             ^
[ERROR]   (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
[ERROR] /Users/snicoll/workspace/pivotal/spring-boot/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/OptionalLiveReloadServer.java:19: error: package javax.annotation is not visible
[ERROR] import javax.annotation.PostConstruct;
[ERROR]             ^
[ERROR]   (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
[ERROR] /Users/snicoll/workspace/pivotal/spring-boot/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java:27: error: package javax.annotation is not visible
[ERROR] import javax.annotation.PostConstruct;
[ERROR]             ^
[ERROR]   (package javax.annotation is declared in module java.xml.ws.annotation, which is not in the module graph)
[ERROR]

(You need to upgrade to maven-javadoc-plugin 3.0.0+ first)

@snicoll snicoll added this to the 2.0.0.M5 milestone Aug 17, 2017
@wilkinsona
Copy link
Member

We have dependency management for the Annotation API jar now so this can be resolved with these changes:

diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index 37762f8bac..266fa49462 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -217,7 +217,7 @@
                <maven-invoker-plugin.version>3.0.0</maven-invoker-plugin.version>
                <maven-help-plugin.version>2.2</maven-help-plugin.version>
                <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
-               <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
+               <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
                <maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
                <maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
                <maven-site-plugin.version>3.5.1</maven-site-plugin.version>
diff --git a/spring-boot-devtools/pom.xml b/spring-boot-devtools/pom.xml
index 559a2470a3..53602046e4 100644
--- a/spring-boot-devtools/pom.xml
+++ b/spring-boot-devtools/pom.xml
@@ -85,6 +85,12 @@
                        <artifactId>spring-boot-configuration-processor</artifactId>
                        <optional>true</optional>
                </dependency>
+               <!-- Provided (Javadoc on Java 9) -->
+               <dependency>
+                       <groupId>javax.annotation</groupId>
+                       <artifactId>javax.annotation-api</artifactId>
+                       <scope>provided</scope>
+               </dependency>
                <!-- Test -->
                <dependency>
                        <groupId>org.springframework.boot</groupId>

DevTools has a compile and runtime dependency on javax.annotation.PostConstruct. That class is provided by the JDK on Java 8, but not on Java 9. Anyone using spring-boot-starter now also has javax.annotation:javax.annotation-api on the classpath so DevTools expecting it to be provided doesn't feel unreasonable to me. Thoughts?

@wilkinsona wilkinsona added the for: team-attention An issue we'd like other members of the team to review label Sep 22, 2017
@philwebb
Copy link
Member

Seems reasonable to me. We might also be able to refactor DevTools to use InitializingBean instead.

@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Sep 22, 2017
@wilkinsona wilkinsona self-assigned this Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

3 participants