Updated documentation.

This commit is contained in:
Konrad Neitzel 2024-05-06 13:32:04 +02:00
parent da90bfee49
commit a7a3fbff03
2 changed files with 89 additions and 16 deletions

View File

@ -2,15 +2,18 @@
Example Maven Project for a JavaFX Application.
**The application is no longer a modular application so there are no problems with dependencies that are not providing a
module-info.**
**Update**: Java 21 is now fully supported
This projects includes multiple plugins:
- Build of an App-Image using JPackage
- Use of Maven Wrapper
- Static code analysis with PMD and Spotbugs
- Check of dependency updates during build
- Build of an App-Image using JPackage
- JavaFX plugin to start application
**Requirements**
To use this Template, all you need is a local Java Installation. My current advice is to use a long term supported (LTS) version e.g. 11, 17 or 21.
**Important** All commands following should be issued in the root directoy of the project (the directory where you find the pom.xml)
*Quick Start*
@ -21,31 +24,31 @@ This projects includes multiple plugins:
*How to use this project*
**build the application**
**Start the application from commandline**
```./mvnw javafx:run```
**Clean up**
To clean up the project, call
```./mvnw clean```
**build the application (Without building the application image) **
To build the application, maven / the maven wrapper can be used. Simply do a
```./mvnw package```
to build the application.
(simply call mvnw instead of ./mvnw on windows!)
**Clean up**
To clean up the project, call
```./mvnw package```
**Start the application from commandline**
```./mvnw javafx:run```
**Build the Image**
To build the image, the profile Image must be used:
```./mvnw -DImage install```
**Important** You cannot build an image using the javafx plugin. The javafx plugin would require that you build a modular
**Important** You cannot build an image using the javafx plugin. The javafx plugin requires that you build a modular
Java application and all dependencies providing a module description.
**Static code analysis**
**Static code analysis results**
The static code analysis is done when you build the application. The results can be found in
- ./target/pmx.xml
The static code analysis is done during the build of the application. The results can be found in
- ./target/pmd.xml
- ./target/spotbugsXml.xml

View File

@ -0,0 +1,70 @@
# Explanation of the Maven Project file (pom.xml)
The Maven Project is described inside a XML document which describes the Project Object Model (pom).
## Start of the pom.xml
The first line defines the format and encoding of the file:
```
<?xml version="1.0" encoding="UTF-8"?>
```
The top node (+ modelVersion node) of the XML document is the project node should currently always be:
```xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
</project>
```
Maybe in the future the maven project will change the project object model in which case we might want to update
the given xsd and modelVersion.
## Unique identification of project
Each project should identify itself using a groupId, artefactId and version
```xml
<groupId>de.kneitzel</groupId>
<artifactId>javafxapp</artifactId>
<version>1.0-SNAPSHOT</version>
```
**Important**: You should change these values to something that is unique to you (and your organisation) so
that there will never be two projects with the same identification.
**Optional**: You can name your organization if you want to.
```xml
<organization>
<name>Java Forum</name>
</organization>
```
**Please** remove these lines or change them to your organization.
## Properties
Properties are like variables which could be used to have everything, that is quite likely to change, in one location.
In my project, I grouped the properties in multiple areas:
### Application specific properties
In this group I specify everything that is application specific: What names should be used?
Which class is the main class? And so on.
### Dependency versions
All versions of dependencies are stored in this area. That way it is easy to use one version multiple times
and it is easay to change these
### Plugin versions
All plugin versions are stored in this area.
### Other properties
Everything that does not fit in the other areas is placed in here e.g. encoding of files.
The next big areas does not need to be changed to start with the project. Of course: You might want to add dependencies
or other plugins later during development.
The following blocks will be described in detail later:
- **dependencies** with a list of all dependencies.
- **build/plugins** with all plugins used by this project, including their configuration.
- **profiles** We are using a profile. That way, we do not build the image every time we build the project.