[英]JavaFX 11 in Netbeans 10 (with Maven) has no Sources/Javadocs
I tried out the JavaFX tutorial for Netbeans with Maven and got it running without a problem.我使用 Maven尝试了Netbeans的JavaFX 教程,并且运行起来没有任何问题。 Maven found the artifacts, downloaded them, build the project and started it.
Maven 找到了这些工件,下载了它们,构建了项目并启动了它。 But I get no code completion (Missing sources and Javadocs).
但是我没有完成代码(缺少源代码和 Javadocs)。
I tried to download the sources and javadocs for the maven dependencies in Netbeans, but only the sources/javadocs for the wrapper artifacts (eg the empty javafx-controls-11) are available.我尝试下载 Netbeans 中 maven 依赖项的源代码和 javadoc,但只有包装器工件(例如空的 javafx-controls-11)的源/javadoc 可用。 But no sources are found for the actual implementation (eg javafx-controls-11-linux).
但是没有找到实际实现的来源(例如 javafx-controls-11-linux)。
Where do I find the sources/javadocs and how do I add them to Netbeans?我在哪里可以找到源代码/javadocs 以及如何将它们添加到 Netbeans?
There is an issue already filed about this at the OpenJFX docs. OpenJFX 文档中已经提出了一个关于此的问题。
While it hasn't been resolved yet, there is a possible workaround, based on:虽然尚未解决,但有一个可能的解决方法,基于:
NetBeans only adds javadoc/source jars for a jar with the exact same name and -javadoc/-source suffix
NetBeans 只为具有完全相同名称和 -javadoc/-source 后缀的 jar 添加 javadoc/source jar
So here are the steps to solve it:所以这里是解决它的步骤:
Install NetBeans 10 and JDK 11.0.2 .安装 NetBeans 10和 JDK 11.0.2 。
Clone the HelloFX sample for NetBeans and Maven, from the OpenJFX samples.从 OpenJFX 示例克隆 NetBeans 和 Maven 的 HelloFX 示例。
Update the JavaFX dependencies to 11.0.2.将 JavaFX 依赖项更新到 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
Check that the JavaFX dependencies have been downloaded to your local m2
repository.检查 JavaFX 依赖项是否已下载到本地
m2
存储库。 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).例如,在
<user home>/.m2/repository/org/openjfx/javafx-base/11.0.2
下,您将找到javafx-base-11.0.2.jar
和javafx-base-mac-11.0.2.jar
(或win
或linux
基于您的平台)。
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).返回 NetBeans,右键单击 Dependencies 文件夹并选择
Download Sources
(查看右下方任务栏中的任务进度),然后Download Javadoc
(查看任务进度)。
m2
repository and verify that there are now -source
and -javadoc
jar files.m2
存储库并验证现在是否有-source
和-javadoc
jar 文件。 However, this won't solve the issue yet, there is an extra step:但是,这还不能解决问题,还有一个额外的步骤:
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).m2
存储库中,使用您的平台分类器将-source
和-javadoc
jar 文件手动重命名为-mac-source
和-mac-javadoc
(或win
或linux
基于您的平台)。 Do this for the different JavaFX modules: Back to NetBeans, check that now you have JavaDoc, or if you press Ctrl/CMD+Click you can access the source.回到 NetBeans,检查您现在是否拥有 JavaDoc,或者如果您按 Ctrl/CMD+单击,您可以访问源代码。
Note that this fix has to be done only once, the rest of your Maven projects should pick JavaDoc and Sources.请注意,此修复只需执行一次,其余的 Maven 项目应选择 JavaDoc 和 Sources。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.