JavaFx:如何配置使用jfx打包java程序

Posted 秦晓宇

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaFx:如何配置使用jfx打包java程序相关的知识,希望对你有一定的参考价值。

Eclipse如何配置通过jfx打包JavaFx为jar执行文件

1. maven打包配置

2. pom.xml中加入如下配置

<build>
  <plugins>
	<plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.3</version>
           <configuration>
               <source>1.8</source>
               <target>1.8</target>
           </configuration>
       </plugin>	  
    <plugin>
      <groupId>com.zenjava</groupId>
      <artifactId>javafx-maven-plugin</artifactId>
      <version>8.8.3</version>
      <configuration>
        <vendor>starwell</vendor>
        <mainClass>exhibitTerminal.Main</mainClass>
      </configuration>
    </plugin>
  </plugins>
</build>

3. 我的完整pom.xml配置

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xingwell</groupId>
  <artifactId>JavaCodeTool</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
 	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	</properties>
    <dependencies>
		<dependency>
		    <groupId>com.google.guava</groupId>
		    <artifactId>guava</artifactId>
		    <version>22.0</version>
		</dependency>    
		<dependency>
		    <groupId>com.github.oshi</groupId>
		    <artifactId>oshi-core</artifactId>
		    <version>5.6.1</version>
		</dependency>    
	  	<dependency>
	    	<groupId>mysql</groupId>
	    	<artifactId>mysql-connector-java</artifactId>
	    	<version>5.1.35</version>
		</dependency>
		<dependency>
		    <groupId>cn.hutool</groupId>
		    <artifactId>hutool-all</artifactId>
		    <version>5.7.15</version>
		</dependency>
		<dependency>
		    <groupId>org.projectlombok</groupId>
		    <artifactId>lombok</artifactId>
		    <version>1.18.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.8.2</version>
		</dependency>
		<!-- javaFx -->
		<dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-fxml</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-controls</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-graphics</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>com.jfoenix</groupId>
	         <artifactId>jfoenix</artifactId>
	         <version>9.0.9</version>
	     </dependency>
	     <dependency>
	         <groupId>io.datafx</groupId>
	         <artifactId>datafx</artifactId>
	         <version>8.0.7</version>
	     </dependency>
	     <dependency>
	         <groupId>io.datafx</groupId>
	         <artifactId>flow</artifactId>
	         <version>8.0.7</version>
	     </dependency>
	     <dependency>
	         <groupId>org.kordamp.ikonli</groupId>
	         <artifactId>ikonli-javafx</artifactId>
	         <version>11.4.0</version>
	     </dependency>
	     <dependency>
	         <groupId>org.kordamp.ikonli</groupId>
	         <artifactId>ikonli-fontawesome5-pack</artifactId>
	         <version>11.4.0</version>
	     </dependency>
		 <dependency>
		 	<groupId>org.kordamp.bootstrapfx</groupId>
		 	<artifactId>bootstrapfx-core</artifactId>
		 	<version>0.2.4</version>
		 </dependency>
		 <dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.5</version>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.40</version>
		</dependency>
		<!--dbutils-->
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>1.6</version>
        </dependency>
		<dependency>
		  <groupId>com.ibeetl</groupId>
		  <artifactId>beetl</artifactId>
		  <version>3.9.3.RELEASE</version>
		</dependency>
	</dependencies>
	<build>
	  <plugins>
		<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>	  
	    <plugin>
	      <groupId>com.zenjava</groupId>
	      <artifactId>javafx-maven-plugin</artifactId>
	      <version>8.8.3</version>
	      <configuration>
	        <vendor>starwell</vendor>
	        <mainClass>exhibitTerminal.Main</mainClass>
	      </configuration>
	    </plugin>
	  </plugins>
	</build>
</project>

以上是关于JavaFx:如何配置使用jfx打包java程序的主要内容,如果未能解决你的问题,请参考以下文章

JavaFx:如何配置使用jfx打包java程序

IDEA通过Maven打包JavaFX工程(OpenJFX11)

IDEA通过Maven打包JavaFX工程(OpenJFX11)

IDEA通过Maven打包JavaFX工程(OpenJFX11)

IDEA通过Maven打包JavaFX工程(OpenJFX11)

JavaFX Maven 插件:在当前项目和插件组中找不到前缀“jfx”的插件