-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Spring Boot JavaFX Integration #92
Comments
This is the source of the issue - this missing logger class. Not sure off the cuff what you want to do RE: logging, check out https://www.baeldung.com/spring-boot-logging for some tips and ideas. FWIW you might want to think hard about what you are trying to do combining Spring Boot & a native desktop client. 99% of the you're probably better off just putting up a Spring Boot REST server and then having the desktop client access the API. Lately I've found SvelteKit + Tauri or Capacitor a much easier system for building client apps. |
thanks... I have solve my issue by manually compile some dependencies. And finally I packaging my springboot-javaFX project to DMG and run app normolly. thanks a lot for your maven-jpackage-template. that very powerful for packaging javaFX project. I am a beginner in programming,so At present,I just focus on java and javafx, but thanks your advices. this is my pom.xml with springboot <?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.1</version>
</parent>
<groupId>io.github.labcentral</groupId>
<artifactId>labcentral</artifactId>
<version>1.0.3</version>
<!-- This description text is included in the Windows installer by default, see windows-jpackage.txt -->
<description>For LabCentral use, design by zemise</description>
<!-- todo: for now, just not use for packaging -->
<name>LabCentral</name>
<!-- spring-boot-maven-plugin packaging to jar, it can also can set to war -->
<packaging>jar</packaging>
<properties>
<main-class>io.github.labcentral.LabCentralMain</main-class>
<start-class>io.github.labcentral.LabCentralMain</start-class>
<!-- app's name, avoid spaces just to safe for compatibility across operating systems -->
<app.name>LabCentral</app.name>
<!-- This converts the build timestamp to a Windows-installer friendly version number (minute level resolution).
Note that Maven generated timestamp is in UTC, not local time. For more information see:
https://docs.microsoft.com/en-us/windows/win32/msi/productversion
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/text/SimpleDateFormat.html
-->
<app.version>1.0.3</app.version>
<!-- This property is used to specify the modules included in the (custom) JVM image. -->
<!-- Reminder: javafx.web (the embedded browser component) is not included in this project by default due
to GitHub template size restrictions. You can download the full SDK from https://openjfx.io -->
<!-- ToDo: need to expand -->
<jvm.modules>
javafx.web,javafx.controls,javafx.fxml,java.logging,java.naming,java.sql,java.management,java.security.jgss,java.instrument,
</jvm.modules>
<!-- Set the project to UTF-8, avoiding warnings in the build logs -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>18</maven.compiler.source>
<maven.compiler.target>18</maven.compiler.target>
<!-- Used to set both the path to find the JavaFX modules and also the versions for Maven dependencies -->
<javafx.version>18.0.2</javafx.version>
<!-- Replace this UUID with a custom one for your project. This ID is used by the Windows installer system
to know that an installer is intended to replace/upgrade an earlier version. The easiest thing to do is
grab a unique UUID via https://www.uuidgenerator.net -->
<windows.upgrade.uuid>aaaaaaaa-0000-aaaa-aaaa-aaaaaaaaaaaa</windows.upgrade.uuid>
<!-- This is used to set many user-visible fields in the Windows Installer. See windows-jpackage.txt -->
<windows.vendor>Lab</windows.vendor>
<!-- Empty properties to skip signing by default. Set with the macos-sign Maven profile -->
<macos.sign></macos.sign>
<macos.sign.identity></macos.sign.identity>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<!-- openjfx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-community-dialects</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>6.0.6.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
<scope>compile</scope>
</dependency>
<!-- materialFX controllers -->
<dependency>
<groupId>io.github.palexdev</groupId>
<artifactId>materialfx</artifactId>
<version>11.17.0</version>
<exclusions>
<exclusion>
<artifactId>javafx-controls</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
<exclusion>
<artifactId>javafx-fxml</artifactId>
<groupId>org.openjfx</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- fontawesome -->
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx-fontawesome</artifactId>
<version>4.7.0-9.1.2</version>
</dependency>
</dependencies>
<build>
<extensions>
<!-- Used to inject the OS and architecture values in a consistent manner -->
<!-- https://github.com/trustin/os-maven-plugin -->
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
<resources>
<resource>
<!-- Here we are processing the platform-specific jpackage command files, adding in Maven
properties for configuration. -->
<directory>${project.basedir}/src/packaging</directory>
<filtering>true</filtering>
<targetPath>${project.build.directory}/packaging</targetPath>
</resource>
<!-- Add the default resource path back in - by overriding above it disables the default -->
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources/build-info/</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<!-- This is an app, so we don't want to install it in the local Maven repository -->
<skip>true</skip>
</configuration>
</plugin>
<!-- use spring-boot-maven-plugin to packaging -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!-- This set when Run main class don't produce packaging jar with spring-boot-maven-plugin -->
<!-- <skip>true</skip>-->
<!-- <excludes>-->
<!-- <exclude>-->
<!-- <groupId>org.projectlombok</groupId>-->
<!-- <artifactId>lombok</artifactId>-->
<!-- </exclude>-->
<!-- </excludes>-->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<!-- This copies the jar files declared by the Maven build into a single directory.
This makes it easy to assemble the final installer package -->
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<!-- Include only compile stage dependencies (no test dependencies) -->
<includeScope>compile</includeScope>
<!-- The JavaFX libraries are bundled into the custom JVM, so we don't want to duplicate
them in the bundled app and installer. This command skips all of the JavaFX by groupId. -->
<excludeGroupIds>org.openjfx</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- Put the application jar generated by the project into the dependency folder - the default folder
for the maven-dependency-plugin output. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
</configuration>
</plugin>
<plugin>
<!-- Plugin to make working with JavaFX nicer. See https://github.com/openjfx/javafx-maven-plugin -->
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<configuration>
<mainClass>${main-class}</mainClass>
</configuration>
</plugin>
<plugin>
<!-- https://github.com/wiverson/jtoolprovider-plugin -->
<groupId>io.github.wiverson</groupId>
<artifactId>jtoolprovider-plugin</artifactId>
<version>1.0.34</version>
<executions>
<!-- This command runs jlink, generating a custom JVM by combining the JavaFX modules bundled in
this project with the JDK modules. -->
<execution>
<id>jlink</id>
<phase>package</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jlink</toolName>
<removeDirectories>${project.build.directory}/jvm-image/</removeDirectories>
<addModules>${jvm.modules}</addModules>
<output>${project.build.directory}/jvm-image</output>
<args>
<arg>--strip-native-commands</arg>
<arg>--no-header-files</arg>
<arg>--strip-debug</arg>
<arg>--no-man-pages</arg>
<arg>--compress=2</arg>
</args>
</configuration>
</execution>
<!-- The command that actually generates the installer. The options for each platform
are found the /src/packaging directory. These files are copied into the target directory by
the Maven resources plugin, which does the filtering to replace the original values with
the actual Maven properties.
https://github.com/wiverson/jtoolprovider-plugin/blob/main/java-tool-doc.md
-->
<execution>
<id>jpackage</id>
<phase>install</phase>
<goals>
<goal>java-tool</goal>
</goals>
<configuration>
<toolName>jpackage</toolName>
<writeOutputToLog>true</writeOutputToLog>
<writeErrorsToLog>true</writeErrorsToLog>
<failOnError>true</failOnError>
<removeDirectories>${project.build.directory}/installer-work</removeDirectories>
<args>@${project.build.directory}/packaging/${os.detected.name}-jpackage.txt</args>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- todo: for now reporting just not use -->
<reporting>
</reporting>
<profiles>
<profile>
<id>GitHub Run</id>
<activation>
<property>
<name>env.GITHUB_ACTIONS</name>
</property>
</activation>
<properties>
<!--suppress UnresolvedMavenProperty -->
<app.version>1.1.${env.GITHUB_RUN_NUMBER}</app.version>
</properties>
</profile>
<profile>
<id>Local Development Run</id>
<activation>
<property>
<name>!env.GITHUB_ACTIONS</name>
</property>
</activation>
<properties>
<app.version>1.1.0</app.version>
</properties>
</profile>
<!-- We use the built-in Maven profile activation system to set the platform property.
These properties are then use to build the directory paths to the platform specific resources.
It would be great if Maven automatically added the os family as a property by default
-->
<profile>
<id>macos-sign</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<macos.sign>--mac-sign</macos.sign>
<!-- You will have to replace this with your own dev information from your Apple identity -->
<macos.sign.identity>--mac-signing-key-user-name "Company Name, Inc. (BXPXTXC35S)"</macos.sign.identity>
</properties>
</profile>
</profiles>
</project>
|
I'm trying use this to packaging my project that use javaFX and sprigboot, but found some problem.
first of all, my project can be packaged to jar and run normally with springboot-plugin. Meantime, It use the maven-jpackage-template also can be packaged to macOS dmg, but when it installed and run , they error notification is: ClassNotFoundException: XXXX.
I try to add <jvm.modules>, like this
before
after
they do solve some ClassNotFoundException, but still produce new ClassNotFoundException, I have no idea with the problem.
this is my pom.xml, could you give me some advice, thk......
When run packaged app in terminal, Full Error like this;
The text was updated successfully, but these errors were encountered: