Java 8 javadoc工具差异和gradle的bug:如何解决它?

时间:2014-03-31 08:27:48

标签: java gradle javadoc java-8

我有一个非常奇怪的错误,包括gradle(1.11)和javadoc任务。我的build.gradle中有链接,例如:

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

我现在使用Java 8(从Oracle下载的JDK),这是javadoc任务的输出:

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

事实上,当我查看javadoc时,所有外部链接都不存在;如果我使用Java 7运行:

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

然后一切正常。

现在,我也尝试并修改了javadoc链接:

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

使用Java 8,然后它不会发出任何警告,它会生成链接......但是链接被破坏了!也就是说,例如,我得到:

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

(请注意package-list/)作为链接,而不是:

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

Java 8中发生了哪些变化?有解决方法吗?

1 个答案:

答案 0 :(得分:7)