From a7a3fbff03f938cf769143b9ef5aed4813ac6f01 Mon Sep 17 00:00:00 2001 From: Konrad Neitzel Date: Mon, 6 May 2024 13:32:04 +0200 Subject: [PATCH] Updated documentation. --- README.md | 35 ++++++++++-------- documentation/MavenProject.md | 70 +++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 16 deletions(-) create mode 100644 documentation/MavenProject.md diff --git a/README.md b/README.md index 5acf8c7..1a28708 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/documentation/MavenProject.md b/documentation/MavenProject.md new file mode 100644 index 0000000..51ac8c7 --- /dev/null +++ b/documentation/MavenProject.md @@ -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: +``` + +``` + +The top node (+ modelVersion node) of the XML document is the project node should currently always be: +```xml + + + 4.0.0 + + +``` + +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 + de.kneitzel + javafxapp + 1.0-SNAPSHOT +``` +**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 + + Java Forum + +``` +**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.