项目作者: marcin-chwedczuk

项目描述 :
Template for JavaFX GUI applications / JDK 11 / TestFX
高级语言: Java
项目地址: git://github.com/marcin-chwedczuk/javafx-template.git
创建时间: 2021-06-12T17:00:41Z
项目社区:https://github.com/marcin-chwedczuk/javafx-template

开源协议:MIT License

下载


JavaFX Opinionated Application Template

Build Status

  • Created for JDK 17+, with Java 9 modules support
  • Multi-module Maven project by default
  • Sass used instead of CSS
  • assertJ and jUnit 5 used for unit testing
  • TestFX used for integration testing
  • Example GitHub action that builds the project and runs integration tests in headless mode

How to run application

  1. ./mvnw javafx:run -pl gui

How to rebuild .css files from .scss

  1. ./mvnw nl.geodienstencentrum.maven:sass-maven-plugin:update-stylesheets -pl gui

How to watch for SCSS changes and regenerate them when they change

  1. fswatch --exclude='.*' --include='.*[.]scss$' --print0 . | while read -d "" event; do
  2. ./mvnw nl.geodienstencentrum.maven:sass-maven-plugin:update-stylesheets -pl gui
  3. done

You need to install fswatch command for this to work.

  1. ./mvnw javafx:jlink -pl gui

You can now send ./gui/target/gui.zip to your friends :tada:

How to run integration tests (TestFX)

  1. ./mvnw verify -Dskip.integration.tests=false -Dskip.unit.tests=true

How to run single integration test

  1. ./mvnw clean verify -Dskip.integration.tests=false -Dskip.unit.tests=true \
  2. -pl gui -Dit.test=MainWindowIT

How to run integration tests in the headless mode

  1. _JAVA_OPTIONS="-Djava.awt.headless=true \
  2. -Dtestfx.robot=glass \
  3. -Dtestfx.headless=true \
  4. -Dprism.order=sw \
  5. -Dprism.verbose=true" ./mvnw verify -Dskip.integration.tests=false -pl gui

On macOS you must allow IntelliJ or the terminal app that you are using,
to “take over your computer”:
macOS settings needed for IT