FX+springboot打包发布

1.Maven 配置

maven 主要配置依赖库和插件,具体如下

       <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-web</artifactId>        </dependency>
        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-test</artifactId>            <scope>test</scope>        </dependency>  <!--SpringBoot & JavaFx-->        <dependency>            <groupId>de.roskenet</groupId>            <artifactId>springboot-javafx-support</artifactId>            <version>2.1.6</version>        </dependency>
        <!--SpringBoot & JavaFx-->        <dependency>            <groupId>de.roskenet</groupId>            <artifactId>springboot-javafx-test</artifactId>            <version>1.3.0</version>            <scope>test</scope>        </dependency>                 <build>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>            <plugin>                <groupId>com.zenjava</groupId>                <artifactId>javafx-maven-plugin</artifactId>                <configuration>                    <mainClass>com.example.springbootfx.SpringbootFxApplication</mainClass>                    <vendor>Spartajet</vendor>                </configuration>            </plugin>        </plugins>        <resources>
            <resource>                <!-- 这里是放在 src/main/java-->                <directory>src/main/java</directory>                <includes>                    <include>**/*.properties</include>                    <include>**/*.fxml</include>                    <include>**/fxml/*.fxml</include>                    <!-- 如果想要弄个包名专门放fxml文件,像上一行这样添加设置 -->                    <!-- 之后,使用getResource("fxml/xx.fxml")这样子 -->                </includes>                <filtering>false</filtering>            </resource>            <resource>                <directory>src/main/resources</directory>                <includes>                    <include>**/*.xml</include>                    <include>**/*.fxml</include>                    <include>**/*.properties</include>                    <include>**/*.yml</include>                </includes>                <filtering>false</filtering>            </resource>        </resources>    </build>   

2.

SpringbootFxApplication如下,其他的与普通fx项目一样

@SpringBootApplication@MapperScan("com.example.springbootfx.mapper")public class SpringbootFxApplication extends AbstractJavaFxApplicationSupport {
    public static void main(String[] args) {
        //SpringApplication.run(SpringbootFxApplication.class, args);        launch(SpringbootFxApplication.class, MainView.class,args);    }}

项目结构如下

FX+springboot打包发布

3.开始发布

FX+springboot打包发布

 

FX+springboot打包发布

FX+springboot打包发布

 

 

运行效果

FX+springboot打包发布

 

ok啦

温馨提示:本站提供的一切软件、教程和内容信息都来自网络收集整理,仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,版权争议与本站无关。用户必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解!

给TA打赏
共{{data.count}}人
人已打赏
GitHub项目

IDEA打包JavaFx为exe

2025-8-28 15:35:11

GitHub项目

基于芋道(ruoyi-vue-pro)的公司执照年报,执照注销,信用修复系统

2025-8-28 15:37:20

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索