[英]How do I deploy this JavaFX/Maven to a executable?
I have been working on a desktop app using javafx and maven, in this project i also use apache poi to read some excels and h2 database to make a temporary database.我一直在使用 javafx 和 maven 开发桌面应用程序,在这个项目中我还使用 apache poi 读取一些 excels 和 h2 数据库来制作临时数据库。 I have been able to make it run perfectly in intellij idea, but i can't for the life of me deploy it in .jar and run it outside of the idea.I tried doing it using javfx:jlink but it fails with this error: error
我已经能够让它在 intellij 想法中完美运行,但我一生都无法将它部署在 .jar 中并在想法之外运行它。我尝试使用 javfx:jlink 进行操作,但由于此错误而失败:错误
Here also a link for the repository in github: github repository这里还有github 中存储库的链接: github 存储库
Please thats the only thing left to do.Any help is appreciated.请这是唯一要做的事情。任何帮助表示赞赏。
As far I know you're able to use fat-jar to bring all dependencies with your application and pack it into single fat-ultrasomma.jar
file.据我所知,您可以使用 fat-jar 将所有依赖项与您的应用程序一起打包,并将其打包到单个
fat-ultrasomma.jar
文件中。
You'll run the app by using the next command:您将使用下一个命令运行该应用程序:
$ java -jar target/fat-ultrasomma.jar
To do that you need to add a shade
plugin为此,您需要添加一个
shade
插件
<build>
<plugins>
...
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<finalName>fat-ultrasomma</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>ultrasomma.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
And a Main.java class for execution和一个用于执行的 Main.java 类
public class Main {
public static void main(String[] args) {
App.main(args);
}
}
Links:链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.