Make JAR packaging portable across desktop systems
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
<atlantafx.version>2.0.1</atlantafx.version>
|
||||
<ikonli.version>12.4.0</ikonli.version>
|
||||
<!-- 指定 JDK 17 路径(系统默认 JDK 8 时启用) -->
|
||||
<jdk17.home>C:\Program Files\Java\jdk-17</jdk17.home>
|
||||
</properties>
|
||||
<repositories>
|
||||
<!-- AtlantaFX Maven 仓库 -->
|
||||
@@ -214,9 +213,6 @@
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
<verbose>true</verbose>
|
||||
<fork>true</fork>
|
||||
<executable>${jdk17.home}\bin\javac</executable>
|
||||
<compilerVersion>17</compilerVersion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -234,36 +230,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.akathist.maven.plugins.launch4j</groupId>
|
||||
<artifactId>launch4j-maven-plugin</artifactId>
|
||||
<version>2.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j-exe</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>launch4j</goal></goals>
|
||||
<configuration>
|
||||
<headerType>gui</headerType>
|
||||
<jar>${project.build.directory}/${project.build.finalName}.jar</jar>
|
||||
<outfile>${project.build.directory}/workutils.exe</outfile>
|
||||
<icon>${project.basedir}/src/main/resources/app_icon.ico</icon>
|
||||
<dontWrapJar>false</dontWrapJar>
|
||||
<classPath>
|
||||
<mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
|
||||
</classPath>
|
||||
<jre>
|
||||
<path>jre</path>
|
||||
<minVersion>17</minVersion>
|
||||
<opts>
|
||||
<opt>-Dfile.encoding=UTF-8</opt>
|
||||
</opts>
|
||||
</jre>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- 复制启动脚本到 target 目录 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -280,7 +246,7 @@
|
||||
<resource>
|
||||
<directory>${basedir}/scripts</directory>
|
||||
<includes>
|
||||
<include>start.bat</include>
|
||||
<include>start.sh</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
@@ -294,15 +260,62 @@
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jdk17-home-env</id>
|
||||
<id>windows-package</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.JDK17_HOME</name>
|
||||
</property>
|
||||
<os><family>Windows</family></os>
|
||||
</activation>
|
||||
<properties>
|
||||
<jdk17.home>${env.JDK17_HOME}</jdk17.home>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.akathist.maven.plugins.launch4j</groupId>
|
||||
<artifactId>launch4j-maven-plugin</artifactId>
|
||||
<version>2.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>l4j-exe</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>launch4j</goal></goals>
|
||||
<configuration>
|
||||
<headerType>gui</headerType>
|
||||
<jar>${project.build.directory}/${project.build.finalName}.jar</jar>
|
||||
<outfile>${project.build.directory}/workutils.exe</outfile>
|
||||
<icon>${project.basedir}/src/main/resources/app_icon.ico</icon>
|
||||
<dontWrapJar>false</dontWrapJar>
|
||||
<classPath>
|
||||
<mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
|
||||
</classPath>
|
||||
<jre>
|
||||
<path>jre</path>
|
||||
<minVersion>17</minVersion>
|
||||
<opts><opt>-Dfile.encoding=UTF-8</opt></opts>
|
||||
</jre>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-windows-start-script</id>
|
||||
<phase>package</phase>
|
||||
<goals><goal>copy-resources</goal></goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${basedir}/scripts</directory>
|
||||
<includes><include>start.bat</include></includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user