maven-springboot-electron:仅使用Maven将Java Web应用程序与Electron + OpenJ

  • O0_904273
    了解作者
  • 291.9KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-11 09:09
    上传日期
Maven + Springboot + Electron(+ OpenJDK) 这个项目是用电子作为本机可执行文件包装任何Java Web应用程序(使用Springboot的fe)的起点。 对于构建过程,仅使用maven。 该项目包含所有必要的配置和一些占位符文件,以帮助您入门。 该项目的灵感来自 ,但有一些主要区别: 代替Gradle仅使用Maven(当然也使用Node,但间接使用) 在构建Electron应用程序时,将包含一个OpenJDK以启动Java Web应用程序 概念证明 该项目的目的是个人的兴趣,以表明该概念(Electron->出厂的JDK-> Java Web Ap
maven-springboot-electron-master.zip
内容介绍
## Maven + Springboot + Electron (+ OpenJDK) This project is a starting point to wrap any Java web application (f.e. using Springboot) with electron as a native executable. For the build process, only maven is being used. This project contains all the necessary configuration and some placeholder files to get you started. This project was inspired a lot by [electron-java-app](https://github.com/jreznot/electron-java-app), but it has some key differences: * Instead of Gradle only Maven is being used (of course also Node but indirectly) * When building the Electron application an OpenJDK will be included to start the Java web application ## Proof of concept The purpose of this project was sole of personal interest to show that this concept (Electron -> shipped JDK -> Java Web Application as Jar) is possible. Before taking it into production, you should check your requirements carefully. On one hand, the project is in its current form far from ideal. Electron wastes out of the box a lot of resources on the client-side, shipping an additional a JVM and an embedded web server does not make it better (Why would I need a Browser and a OpenJDK just to use a Java Web application as a desktop application?). If it needs to be Java, why not use Swing or JavaFX? But I can imagine some use cases where this could come in handy, f.e. as inbetween solution before migrating to the cloud. An improvement to the concept could be done by getting rid of the OpenJDK by using native images of the GraalVM. Getting rid of the browser is currently not possible. If PWAs get available for all platforms and can run applications running on localhost, the browser could eventually be dropped. Currently, an updater functionality is missing, also logging needs to be done manually. ## How to build `mvn clean install -Pproduction` The artifacts from the electron build will be put into: * `target\electron\springboot-on-electron-darwin-x64` * `target\electron\springboot-on-electron-win32-x64` When using Mac OS or linux, `wine` is required to build `windows` (check the maven build for further information). When using Windows, admin privileges are required to build `darwin` (check the maven build for further information). ## Shipping OpenJDK Since not all your users have a JVM available via the classpath a OpenJDK 8 will be packed into the electron builds ## Documentation * [Configure electron Application](https://github.com/appreciated/maven-springboot-electron/tree/master/src/main/javascript) * [Configure the electron archs Part1](https://github.com/appreciated/maven-springboot-electron/blob/master/src/main/javascript/package.json) * [Configure the electron archs Part2](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L236-L257) * [Electron build Part1](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L198-L259) * [Electron build Part2](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L333-L358) * [Configure OpenJDK download](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L260-L332) * [Configure OpenJDK injection](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L359-L397) ## Build When executing `mvn clean install -Pproduction` by default the `windows` (x64) and `darwin` (x64) will be built. The rest is currently not supported but adding those shouldn't be too hard but some changes will need to be made at the following files: * [Create 'scripts' for the other electron archs](https://github.com/appreciated/maven-springboot-electron/blob/master/src/main/javascript/package.json#L14-L17) * [Add the new 'scripts' to the maven build](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L236-L257) * [Download the correct JDK](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L265-L294) * [Unpack the Downloaded JDK](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L296-L332) * [Inject downloaded JDK to the electron build](https://github.com/appreciated/maven-springboot-electron/blob/master/pom.xml#L359-L395) * [Use correct JDK at runtime](https://github.com/appreciated/maven-springboot-electron/blob/master/src/main/javascript/main.js#L108-L139) ## Pull requests are welcome
评论
    相关推荐