使用Maven集成在Eclipse中为OpenJFX11项目创建Windows可执行文件
我正在从Java8(OracleJDK)切换到OpenJDK11和OpenJFX11。我已经通过使用使用Maven集成在Eclipse中为OpenJFX11项目创建Windows可执行文件,eclipse,maven,javafx,openjdk-11,Eclipse,Maven,Javafx,Openjdk 11,我正在从Java8(OracleJDK)切换到OpenJDK11和OpenJFX11。我已经通过使用Maven编译器插件的cleanjavafx:run命令成功地让我的项目通过Maven在Eclipse中工作,但是我在构建可运行的jar和windows可执行文件时遇到了问题。我不需要linux或mac runnable,因为这个项目只是一个内部产品,我们只使用windows 我已经试过几个插件,比如maven shade插件,也试过运行mvm包,但都没有用。我试过这个和这个 在过去,我可以通过E
Maven编译器插件的cleanjavafx:run
命令成功地让我的项目通过Maven在Eclipse中工作,但是我在构建可运行的jar和windows可执行文件时遇到了问题。我不需要linux或mac runnable,因为这个项目只是一个内部产品,我们只使用windows
我已经试过几个插件,比如maven shade插件
,也试过运行mvm包
,但都没有用。我试过这个和这个
在过去,我可以通过Eclipse的“Export Runnable jar”选项构建一个可执行jar,然后通过launch4j创建一个可执行jar,但是这似乎不再有效,我理解这可能是由于OpenJDk 9+的模块化结构
我添加了所有JavaFX依赖项以及我需要的JAXB依赖项,并且在构建它时在IDE中运行(尽管在Maven运行配置中运行之后,我无法让它作为Java应用程序运行配置运行)
以下是我的插件:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.tapestry.testertools.ApplicationMainFrame</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
问题似乎是“编译时出现致命错误:无效标志:--module path”。这表示Maven正在使用Java 8或更早版本。请确保已安装Java 11,并且您的环境变量(即path、Java_HOME)指向它。这就是问题所在。我的机器上仍然安装了JRE 8,所以运行配置默认为那样。非常感谢。
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.325 s
[INFO] Finished at: 2019-09-20T09:19:35-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project testertools: Fatal error compiling: invalid flag: --module-path -> [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/MojoExecutionException