「MAVEN」- package com.sun.javafx.binding does not exist

  CREATED BY JENKINSBOT

问题描述

在进行Jenkins构建时,产生如下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project foo-manage: Compilation failure: Compilation failure:
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/third/util/Validator.java:[8,29] error: package com.sun.javafx.binding does not exist
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/utils/app/Configurations.java:[4,26] error: package com.sun.javafx.geom does not exist
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/utils/msg/MessageCategory.java:[3,29] error: package com.sun.javafx.binding does not exist
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/third/util/Validator.java:[113,15] error: cannot find symbol
[ERROR]  class Validator
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/utils/app/Configurations.java:[46,22] error: cannot find symbol
[ERROR]  class Configurations
[ERROR] /var/lib/jenkins/workspace/foo-manage_test/src/main/java/com/foo/manage/utils/msg/MessageCategory.java:[71,15] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

主要的错误信息是:error: package com.sun.javafx.binding does not exist

问题原因

系统环境:CentOS Linux release 7.4.1708 (Core)

运行环境:openjdk version “1.8.0_191”

解决办法

虽然移除了,但是java version "1.8.0_66"中还是有jre/lib/ext/jfxrt.jar这个包的。所以修改了JAVA_HOMEPATH环境变量,使用特定的Java版本来构建这个项目。

!!!其实,正常一点的做法是调整程序代码。

# 是什么时候移除的

我没有找到具体是在哪个版本移除的。但是,有别人写的文章、维基百科做参考:

	Starting with JDK 8u33, JavaFX Embedded is removed from the ARM bundle and is not supported.
	**Oracle is removing JavaFX from the Java Development Kit (JDK) 11**, given an overall desire to pull out noncore modules from the JDK and retire them or stand them up as independent modules.
	JavaFX will be removed from the Java JDK as of JDK 11, which is due in September 2018. It is bundled in the current JDK 9 and will remain in JDK 10, due this spring. **Commercial support for JavaFX in JDK 8 will continue through at least 2022**. Featuring a set of packages for graphics and media, JavaFX has been part of the JDK download since 2012.

反正从Java 8开始,就已经有了删除的迹象。

相关链接

# 在Debian里有openjfx包
Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?

参考文献

Specify JDK for Maven to use
Java Development Kit for ARM Release Notes 8 Update 33
Wikipedia/JavaFX
Removed from JDK 11, JavaFX 11 arrives as a standalone module
JavaFX will be removed from the Java JDK
Why is JavaFX is not included in OpenJDK 8 on Ubuntu Wily (15.10)?