更新时间:2022-06-22 00:46:56
有一个 issue 已经在 OpenJFX 文档中提交了相关信息.
There is an issue already filed about this at the OpenJFX docs.
虽然尚未解决,但有一个可能的解决方法,基于:
While it hasn't been resolved yet, there is a possible workaround, based on:
NetBeans 只为具有完全相同名称和 -javadoc/-source 后缀的 jar 添加 javadoc/source jar
NetBeans only adds javadoc/source jars for a jar with the exact same name and -javadoc/-source suffix
所以这里是解决它的步骤:
So here are the steps to solve it:
克隆 HelloFX 示例 对于 NetBeans 和 Maven,来自 OpenJFX 示例.
Clone the HelloFX sample for NetBeans and Maven, from the OpenJFX samples.
将 JavaFX 依赖项更新到 11.0.2.
Update the JavaFX dependencies to 11.0.2.
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11.0.2</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11.0.2</version>
</dependency>
运行它:
Run it:
mvn clean compile exec:java
检查 JavaFX 依赖项是否已下载到本地 m2
存储库.例如,在
下,您会找到 javafx-base-11.0.2.jar
> 和 javafx-base-mac-11.0.2.jar
(或 win
或 linux
基于您的平台).
Check that the JavaFX dependencies have been downloaded to your local m2
repository. Under <user home>/.m2/repository/org/openjfx/javafx-base/11.0.2
for instance you will find javafx-base-11.0.2.jar
and javafx-base-mac-11.0.2.jar
(or win
, or linux
based on your platform).
返回 NetBeans,右键单击 Dependencies 文件夹并选择 Download Sources
(查看右下方任务栏中的任务进度),然后 Download Javadoc
(查看任务进度).
Back on NetBeans, right click in the Dependencies folder and select Download Sources
(see the task progress in the bottom right taskbar), and then Download Javadoc
(see the task progress).
m2
存储库并验证现在是否有 -source
和 -javadoc
jar 文件.m2
repository and verify that there are now -source
and -javadoc
jar files.然而,这还不能解决问题,还有一个额外的步骤:
However, this won't solve the issue yet, there is an extra step:
m2
存储库中,使用您的平台分类器将 -source
和 -javadoc
jar 文件手动重命名为 -mac-source
和 -mac-javadoc
(或 win
或 linux
基于您的平台).对不同的 JavaFX 模块执行此操作:m2
repository, manually rename the -source
and -javadoc
jar files using your platform classifier, to -mac-source
and -mac-javadoc
(or win
, or linux
based on your platform). Do this for the different JavaFX modules:回到 NetBeans,检查您现在是否拥有 JavaDoc,或者如果您按下 Ctrl/CMD+单击,您可以访问源代码.
Back to NetBeans, check that now you have JavaDoc, or if you press Ctrl/CMD+Click you can access the source.
请注意,此修复只需执行一次,其余 Maven 项目应选择 JavaDoc 和 Sources.
Note that this fix has to be done only once, the rest of your Maven projects should pick JavaDoc and Sources.