gpt4 book ai didi

Java 8 javadoc 工具差异和 gradle 错误 : how to work around it?

转载 作者:搜寻专家 更新时间:2023-11-01 01:52:26 28 4
gpt4 key购买 nike

我有一个关于 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 中发生了什么变化导致了这种情况?有解决方法吗?

最佳答案

尝试使用 http://docs.oracle.com/javase/7/docs/api/而不是 http://docs.oracle.com/javase/7/docs/api .

显然需要尾部斜杠。

关于Java 8 javadoc 工具差异和 gradle 错误 : how to work around it?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22756850/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com