JavaFX application boilerplate project using gradle and maven build tools. This project aims to cover best practices for JavaFX application development as a whole. It provides tool recommendations for linting, testing and packaging.
The source for this project is available here
The latest release for this project is available here
The documentation for this project is available here
You can use either Gradle or Maven to build this boilerplate project.
Most of the configuration for the Gradle is done in the build.gradle
file.
Most of the configuration for the Maven is done in the pom.xml
file.
You should edit these files accordingly to adapt this boilerplate project to your needs.
This is the README file for the project.
The file should use UTF-8 encoding and can be written using GitHub Flavored Markdown with the appropriate key set. It will be displayed as the project homepage on common code-hosting services, and should be written for that purpose.
Typical contents for this file would include an overview of the project, basic usage examples, etc. Generally, including the project changelog in here is not a good idea, although a simple "What's New" section for the most recent version may be appropriate.
All tasks are performed from the project directory itself
where placed gradlew
, gradlew.bat
and mvnw
, mvnw.cmd
files.
It is recommended to always execute a build with the wrappers to ensure
a reliable, controlled and standardized execution of the build.
Using the wrappers looks almost exactly like running the build with
the Gradle or the Maven installation. Depending on the operating
system you either run gradlew
or gradlew.bat
for the Gradle and
run mvnw
or mvnw.cmd
for the Maven instead of the gradle
or mvn
command.
Generating the wrapper files requires an installed version of the Maven on your machine.
mvn -N io.takari:maven:wrapper
To switch the version of the Maven used to build a project simply pass in the new version.
mvn -N io.takari:maven:wrapper -Dmaven=3.6.3
Generating the wrapper files requires an installed version of the Gradle on your machine.
gradle wrapper
To switch the version of the Gradle used to build a project simply pass in
the new version as well as the distribution type, either all
which includes
sources and documentation or bin
which only ships with the binaries.
gradle wrapper --gradle-version 6.5.1
gradle wrapper --gradle-version 6.5.1 --distribution-type bin
You can set settings by export environment variable MAVEN_OPTS
:
export MAVEN_OPTS="-Xmx1024m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
Edit default gradle properties in the file .gradle/gradle.properties
in the user’s home directory.
For example you can set gradle console output to plain mode, set running gradle builds without gradle daemon.
org.gradle.daemon = false
org.gradle.parallel = true
org.gradle.console = plain
org.gradle.jvmargs = -Xms512m -Xmx1024m -Dfile.encoding=UTF-8
Or you can set above settings by export environment variable GRADLE_OPTS
:
export GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.parallel=true -Dorg.gradle.console=plain -Xms512m -Xmx1024m -Dfile.encoding=UTF-8"
Maven is based around the central concept of a build lifecycle.
The build process is clearly defined. There are three built-in build
lifecycles: default
, clean
and site
.
The default lifecycle comprises of the following phases:
validate
- validate the project is correctcompile
- compile the source code of the projecttest
- test the compiled source codepackage
- take the compiled code and package itverify
- run any checks on results of integration testsinstall
- install the package into the local repositorydeploy
- deploy the final package to the remote repository
Each of a build phase is made up of plugin goals, and this is done by declaring the plugin goals bound to those build phases.
To see which tasks are available for your Gradle build you can run:
./gradlew tasks
By default only the tasks which are dependencies on other tasks are shown.
To see all tasks we must add the command-line option --all
.
./gradlew tasks --all
To see more detail about a task, run:
./gradlew help --task <task>
Clean build.
./gradlew clean
./mvnw clean
Run all checks.
./gradlew check
./mvnw verify
The following plugins are used to check the project:
- license
- checkstyle
- pmd/cpd
- spotbugs
- codenarc
You can use all of these tools separately.
License plugin will scan and adapt your source files to include a provided header, e.g. a LICENSE file. By default it will scan every source set and report warnings. It will also create format tasks, which will properly format and apply the specified header. This plugin will also report on the licenses of your dependencies.
Check for header consistency.
./gradlew license
./mvnw validate license:check
Apply the license found in the header file in files missing the header.
./gradlew licenseFormat
./mvnw validate license:format
Generate reports on your runtime dependencies.
./gradlew downloadLicenses
The Checkstyle plugin performs quality checks on your project’s Java source files using Checkstyle and generates reports from these checks.
./gradlew checkstyleMain checkstyleTest
./mvnw checkstyle:check
The PMD/CPD plugin performs quality checks on your project’s Java source files using PMD/CPD and generates reports from these checks.
./gradlew pmdMain pmdTest cpdCheck
./mvnw pmd:check pmd:cpd-check
SpotBugs plugin performs static analysis to look for bugs in Java code using SpotBugs and generates reports from these analysis.
./gradlew spotbugsMain spotbugsTest
./mvnw spotbugs:check
./mvnw spotbugs:gui
The CodeNarc plugin performs quality checks on your project’s Groovy source files using CodeNarc and generates reports from these checks.
./gradlew codenarcMain codenarcTest
./mvnw antrun:run@codenarc
Run unit tests:
./gradlew test
./mvnw test
The JaCoCo plugin provides code coverage metrics for Java code via integration with JaCoCo.
Generate reports:
./gradlew projectReport buildDashboard
./mvnw validate site
Build this project
./gradlew clean build
./mvnw clean verify
./gradlew run
./gradlew run --args="--gui --debug"
./mvnw exec:exec
Create modular runtime image with installer:
./gradlew jpackage
./mvnw validate jlink:jlink jpackage:jpackage@image jpackage:jpackage@installer
Displays all dependencies declared in project.
./gradlew dependencies
./mvnw dependency:tree
Discover dependency updates
./gradlew dependencyUpdates -Drevision=release
./mvnw versions:display-dependency-updates
Display the properties of the project.
./gradlew properties
./mvnw help:effective-settings
./mvnw help:effective-pom
./mvnw help:system
./mvnw help:all-profiles
./gradlew release
./mvnw release:clean release:prepare release:perform
Pull request template: .github/pull_request_template.md.