Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java 8 javadoc tool differences and bug with gradle: how to work around it?

I have a very strange bug with gradle (1.11) and the javadoc task. I have links in my build.gradle such as:

javadoc.options.links("http://docs.oracle.com/javase/7/docs/api");

I now use Java 8 (JDK downloaded from Oracle) and here is the output of the javadoc task:

fge@alustriel:~/src/perso/largetext$ java -version; ./gradlew clean javadoc
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
:clean
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
:processResources
:classes
:javadoc
javadoc: warning - Error fetching URL: http://docs.oracle.com/javase/7/docs/api
javadoc: warning - Error fetching URL: http://jsr-305.googlecode.com/svn/trunk/javadoc
javadoc: warning - Error fetching URL: http://docs.guava-libraries.googlecode.com/git-history/v16.0.1/javadoc
3 warnings

BUILD SUCCESSFUL

Total time: 7.726 secs

And indeed, when I view the javadoc, all external links are not there; if I run with Java 7 however:

fge@alustriel:~/src/perso/largetext$ (export JAVA_HOME=/opt/sunjdk/1.7/current; export PATH=$JAVA_HOME/bin:$PATH; java -version; ./gradlew clean javadoc)
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
:clean
:compileJava
:processResources
:classes
:javadoc

BUILD SUCCESSFUL

Total time: 7.635 secs

then everything works.

Now, I have also tried and modified the javadoc link to read:

// Note the appended "/package-list"
javadoc.options.links("http://docs.oracle.com/javase/7/docs/api/package-list");

Using Java 8, it then gives no warnings, it generates links... But the links are broken! That is, for instance, I get:

http://docs.oracle.com/javase/7/docs/api/package-list/java/lang/NullPointerException.html?is-external=true

(note the package-list/) as a link instead of:

http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true

What has changed in Java 8 which causes that? Is there a workaround?

like image 632
fge Avatar asked Mar 21 '23 01:03

fge


1 Answers

Try using http://docs.oracle.com/javase/7/docs/api/ instead of http://docs.oracle.com/javase/7/docs/api.

Apparently the trailing slash is needed.

like image 77
sonOfRa Avatar answered Mar 22 '23 14:03

sonOfRa