Open joris-desmedt opened 5 years ago
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/>
</parent>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>10</java.version>
<!-- Installer Filename without suffix -->
<app.filename>appName</app.filename>
<!-- The Application vendor used by javapackager -->
<app.vendor>appVendor</app.vendor>
<!-- Optional override to specify where the cached files are stored. Default is current working directory -->
<app.cacheDir>./appName</app.cacheDir> <!-- since userlib doesn't work for springBoot -->
<!-- The Application version used by javapackager -->
<app.version>${project.version}</app.version>
<!-- The Main class name -->
<app.mainClass>org.springframework.boot.loader.JarLauncher</app.mainClass>
<!-- The app and launcher will be assembled in this folder -->
<app.dir>${project.build.directory}/app</app.dir>
<!-- Native installers will be build in this folder -->
<app.installerdir>${project.build.directory}/installer</app.installerdir>
<!-- Base URL where you will host the application artifacts -->
<app.url>...</app.url>
</properties>
<dependencies>
<!-- Project dependencies -->
...
<!-- fxlauncher dependencies-->
<dependency>
<groupId>no.tornado</groupId>
<artifactId>fxlauncher</artifactId>
<version>1.0.20</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compile project to appdir -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<outputDirectory>${app.dir}</outputDirectory>
</configuration>
</plugin>
<!-- Copy dependencies to appdir -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<excludeScope>provided</excludeScope>
<outputDirectory>${app.dir}</outputDirectory>
<stripVersion>true</stripVersion>
<includeGroupIds>no.tornado</includeGroupIds>
<includeArtifactIds>fxlauncher</includeArtifactIds>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
<!-- Generate app.xml manifest -->
<executions>
<execution>
<id>create-manifest</id>
<phase>package</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>fxlauncher.CreateManifest</mainClass>
<arguments>
<argument>${app.url}</argument>
<argument>${app.mainClass}</argument>
<argument>${app.dir}</argument>
<argument>--cache-dir=${app.cacheDir}</argument>
<argument>--include-extensions=jpg</argument>
</arguments>
</configuration>
</execution>
<!-- Embed app.xml inside fxlauncher.jar so we don't need to reference app.xml to start the app -->
<execution>
<id>embed-manifest-in-launcher</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>jar</executable>
<workingDirectory>${app.dir}</workingDirectory>
<arguments>
<argument>uf</argument>
<argument>fxlauncher.jar</argument>
<argument>app.xml</argument>
</arguments>
</configuration>
</execution>
<!-- Create native installer. -->
<execution>
<id>installer</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>javapackager</executable>
<arguments>
<argument>-deploy</argument>
<argument>-native</argument>
<argument>-outdir</argument>
<argument>${app.installerdir}</argument>
<argument>-outfile</argument>
<argument>${app.filename}</argument>
<argument>-srcdir</argument>
<argument>${app.dir}</argument>
<argument>-srcfiles</argument>
<argument>fxlauncher.jar</argument>
<argument>-appclass</argument>
<argument>fxlauncher.Launcher</argument>
<argument>-name</argument>
<argument>${project.name}</argument>
<argument>-title</argument>
<argument>${project.name}</argument>
<argument>-vendor</argument>
<argument>${app.vendor}</argument>
<argument>-BappVersion=${app.version}</argument>
<argument>-Bidentifier=${project.groupId}.${project.artifactId}</argument>
<argument>--add-modules</argument>
<argument>java.xml.bind</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
In fxlauncher.Launcher.startApplication() Should getRuntime().exec(command) work if there is no jre in path? Wouldn't it be better to use java.net.URLClassLoader and invoke the main method?
That sounds reasonable to me, but I have never used spring boot and I don't know the reasoning behind doing it this way. Hopefully the author of that function will chime in :)
When I run my native application (on windows without java in path) it start fxlauncher fine, but when fxlauncher tries to run my springboot jar I get this error.
Any idea what the reason for this is?