591 lines
25 KiB
XML
591 lines
25 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<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>
|
|
|
|
<!-- Edit these to match your project -->
|
|
<groupId>de.kneitzel</groupId>
|
|
<artifactId>javamavenapp</artifactId>
|
|
<version>1.1-SNAPSHOT</version>
|
|
|
|
<packaging>jar</packaging>
|
|
|
|
<!-- Modify or remove -->
|
|
<organization>
|
|
<name>Java Forum</name>
|
|
</organization>
|
|
|
|
<!-- Properties of the project - Configuration is done here -->
|
|
<properties>
|
|
|
|
<!-- Application Properties -->
|
|
<link.name>${project.artifactId}</link.name>
|
|
<launcher>${project.artifactId}</launcher>
|
|
<appName>${project.artifactId}</appName>
|
|
<main.class>de.kneitzel.JavaApp</main.class>
|
|
<java.version>21</java.version>
|
|
<jar.filename>${project.artifactId}-${project.version}</jar.filename>
|
|
|
|
<!-- Dependency versions -->
|
|
<jetbrains.annotations.version>24.1.0</jetbrains.annotations.version>
|
|
<junit.version>5.10.2</junit.version>
|
|
<lombok.version>1.18.32</lombok.version>
|
|
<mockito.version>5.12.0</mockito.version>
|
|
<spotbugs.version>4.8.5</spotbugs.version>
|
|
|
|
<!-- Plugin dependencies -->
|
|
<codehaus.version.plugin>2.16.2</codehaus.version.plugin>
|
|
<jpackage.maven.plugin>0.1.5</jpackage.maven.plugin>
|
|
<maven.clean.plugin>3.3.2</maven.clean.plugin>
|
|
<maven.compiler.plugin>3.13.0</maven.compiler.plugin>
|
|
<maven.dependency.plugin>3.6.1</maven.dependency.plugin>
|
|
<maven.deploy.plugin>3.1.2</maven.deploy.plugin>
|
|
<maven.enforcer.plugin>3.4.1</maven.enforcer.plugin>
|
|
<maven.install.plugin>3.1.2</maven.install.plugin>
|
|
<maven.jar.plugin>3.4.1</maven.jar.plugin>
|
|
<maven.javadoc.plugin>3.6.3</maven.javadoc.plugin>
|
|
<maven.pmd.plugin>3.22.0</maven.pmd.plugin>
|
|
<maven.project.info.reports.plugin>3.5.0</maven.project.info.reports.plugin>
|
|
<maven.resources.plugin>3.3.1</maven.resources.plugin>
|
|
<maven.shade.plugin>3.5.3</maven.shade.plugin>
|
|
<maven.site.plugin>4.0.0-M14</maven.site.plugin>
|
|
<maven.surfire.plugin>3.2.5</maven.surfire.plugin>
|
|
<moditect.maven.plugin>1.0.0.RC2</moditect.maven.plugin>
|
|
<native.maven.plugin>0.10.2</native.maven.plugin>
|
|
<spotbugs.maven.plugin>4.8.5.0</spotbugs.maven.plugin>
|
|
|
|
<!-- other properties -->
|
|
<pmd.target>pmd</pmd.target> <!-- Set to 'pmd' if pmd should not fail on issues. Set to 'check' if you want build to fail when issues found -->
|
|
<spotbugs.target>spotbugs</spotbugs.target> <!-- Set to 'spotbugs' if spotbugs should not fail on issues. Set to 'check' if you want build to fail when issues found -->
|
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
|
<required.maven.version>3.8.6</required.maven.version>
|
|
|
|
</properties>
|
|
|
|
<dependencies>
|
|
|
|
<!-- Lombok -->
|
|
<dependency>
|
|
<groupId>org.projectlombok</groupId>
|
|
<artifactId>lombok</artifactId>
|
|
<version>${lombok.version}</version>
|
|
</dependency>
|
|
|
|
<!-- JUnit 5 -->
|
|
<dependency>
|
|
<groupId>org.junit.jupiter</groupId>
|
|
<artifactId>junit-jupiter-engine</artifactId>
|
|
<version>${junit.version}</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.junit.jupiter</groupId>
|
|
<artifactId>junit-jupiter-params</artifactId>
|
|
<version>${junit.version}</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
|
|
<!-- Mockito -->
|
|
<dependency>
|
|
<groupId>org.mockito</groupId>
|
|
<artifactId>mockito-core</artifactId>
|
|
<version>${mockito.version}</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
<dependency>
|
|
<groupId>org.mockito</groupId>
|
|
<artifactId>mockito-junit-jupiter</artifactId>
|
|
<version>${mockito.version}</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
|
|
<!-- Dependency used for @NotNull / @Nullable -->
|
|
<dependency>
|
|
<groupId>org.jetbrains</groupId>
|
|
<artifactId>annotations</artifactId>
|
|
<version>${jetbrains.annotations.version}</version>
|
|
<scope>compile</scope>
|
|
</dependency>
|
|
|
|
</dependencies>
|
|
|
|
<build>
|
|
<plugins>
|
|
|
|
<!-- Enforcer to enforce min Maven version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-enforcer-plugin</artifactId>
|
|
<version>${maven.enforcer.plugin}</version>
|
|
<executions>
|
|
<execution>
|
|
<id>enforce-versions</id>
|
|
<goals>
|
|
<goal>enforce</goal>
|
|
</goals>
|
|
<configuration>
|
|
<rules>
|
|
<requireMavenVersion>
|
|
<version>${required.maven.version}</version>
|
|
</requireMavenVersion>
|
|
</rules>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!-- Compiler including Lombok -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-compiler-plugin</artifactId>
|
|
<version>${maven.compiler.plugin}</version>
|
|
<configuration>
|
|
<release>${java.version}</release>
|
|
<annotationProcessorPaths>
|
|
<path>
|
|
<groupId>org.projectlombok</groupId>
|
|
<artifactId>lombok</artifactId>
|
|
<version>${lombok.version}</version>
|
|
</path>
|
|
</annotationProcessorPaths>
|
|
</configuration>
|
|
</plugin>
|
|
|
|
<!--Test execution -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-surefire-plugin</artifactId>
|
|
<version>${maven.surfire.plugin}</version>
|
|
<configuration>
|
|
<testFailureIgnore>true</testFailureIgnore>
|
|
</configuration>
|
|
</plugin>
|
|
|
|
<!-- Spotbugs Code Analyzer -->
|
|
<plugin>
|
|
<groupId>com.github.spotbugs</groupId>
|
|
<artifactId>spotbugs-maven-plugin</artifactId>
|
|
<version>${spotbugs.maven.plugin}</version>
|
|
<dependencies>
|
|
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
|
|
<dependency>
|
|
<groupId>com.github.spotbugs</groupId>
|
|
<artifactId>spotbugs</artifactId>
|
|
<version>${spotbugs.version}</version>
|
|
</dependency>
|
|
</dependencies>
|
|
<executions>
|
|
<execution>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>${spotbugs.target}</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
<configuration>
|
|
<excludeFilterFile>spotbugs-exclude-filter.xml</excludeFilterFile>
|
|
</configuration>
|
|
</plugin>
|
|
|
|
<!-- PMD static code analysis -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-pmd-plugin</artifactId>
|
|
<version>${maven.pmd.plugin}</version>
|
|
<configuration>
|
|
<minimumTokens>100</minimumTokens>
|
|
<targetJdk>${java.version}</targetJdk>
|
|
<rulesets>
|
|
<ruleset>pmd-ruleset.xml</ruleset>
|
|
</rulesets>
|
|
<linkXRef>false</linkXRef>
|
|
</configuration>
|
|
<executions>
|
|
<execution>
|
|
<phase>prepare-package</phase>
|
|
<goals>
|
|
<goal>${pmd.target}</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!-- Check for new versions in dependencies -->
|
|
<plugin>
|
|
<groupId>org.codehaus.mojo</groupId>
|
|
<artifactId>versions-maven-plugin</artifactId>
|
|
<version>${codehaus.version.plugin}</version>
|
|
<executions>
|
|
<execution>
|
|
<phase>validate</phase>
|
|
<goals>
|
|
<goal>display-dependency-updates</goal>
|
|
<goal>display-plugin-updates</goal>
|
|
<goal>display-property-updates</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!-- clean plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-clean-plugin</artifactId>
|
|
<version>${maven.clean.plugin}</version>
|
|
</plugin>
|
|
|
|
<!-- deploy plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-deploy-plugin</artifactId>
|
|
<version>${maven.deploy.plugin}</version>
|
|
</plugin>
|
|
|
|
<!-- install plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-install-plugin</artifactId>
|
|
<version>${maven.install.plugin}</version>
|
|
</plugin>
|
|
|
|
<!-- jar plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-jar-plugin</artifactId>
|
|
<version>${maven.jar.plugin}</version>
|
|
<configuration>
|
|
<archive>
|
|
<manifest>
|
|
<addClasspath>true</addClasspath>
|
|
<classpathPrefix>lib/</classpathPrefix>
|
|
<mainClass>${main.class}</mainClass>
|
|
</manifest>
|
|
</archive>
|
|
</configuration>
|
|
</plugin>
|
|
|
|
<!-- dependency plugin - copy dependencies to lib folder. -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-dependency-plugin</artifactId>
|
|
<version>${maven.dependency.plugin}</version>
|
|
<executions>
|
|
<execution>
|
|
<id>copy-dependencies</id>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
|
<includeScope>runtime</includeScope>
|
|
<overWriteReleases>false</overWriteReleases>
|
|
<overWriteSnapshots>false</overWriteSnapshots>
|
|
<overWriteIfNewer>true</overWriteIfNewer>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<!-- resources plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-resources-plugin</artifactId>
|
|
<version>${maven.resources.plugin}</version>
|
|
</plugin>
|
|
|
|
<!-- site plugin - to remove the warning regarding version -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-site-plugin</artifactId>
|
|
<version>${maven.site.plugin}</version>
|
|
</plugin>
|
|
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-javadoc-plugin</artifactId>
|
|
<version>${maven.javadoc.plugin}</version>
|
|
<executions>
|
|
<execution>
|
|
<id>attach-javadocs</id>
|
|
<goals>
|
|
<goal>jar</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
</plugins>
|
|
</build>
|
|
|
|
<reporting>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
|
<version>${maven.project.info.reports.plugin}</version>
|
|
<reportSets>
|
|
<reportSet>
|
|
<reports>
|
|
<report>index</report>
|
|
<report>dependencies</report>
|
|
<report>licenses</report>
|
|
<report>summary</report>
|
|
</reports>
|
|
</reportSet>
|
|
</reportSets>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-javadoc-plugin</artifactId>
|
|
<version>${maven.javadoc.plugin}</version>
|
|
<reportSets>
|
|
<reportSet>
|
|
<reports>
|
|
<report>javadoc</report>
|
|
</reports>
|
|
</reportSet>
|
|
<reportSet>
|
|
<id>tests</id>
|
|
<configuration>
|
|
<show>private</show>
|
|
</configuration>
|
|
<reports>
|
|
<report>test-javadoc</report>
|
|
</reports>
|
|
</reportSet>
|
|
</reportSets>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-pmd-plugin</artifactId>
|
|
<version>${maven.pmd.plugin}</version>
|
|
<reportSets>
|
|
<reportSet>
|
|
<reports>
|
|
<report>pmd</report>
|
|
</reports>
|
|
</reportSet>
|
|
</reportSets>
|
|
</plugin>
|
|
<plugin>
|
|
<groupId>com.github.spotbugs</groupId>
|
|
<artifactId>spotbugs-maven-plugin</artifactId>
|
|
<version>${spotbugs.maven.plugin}</version>
|
|
<reportSets>
|
|
<reportSet>
|
|
<reports>
|
|
<report>spotbugs</report>
|
|
</reports>
|
|
</reportSet>
|
|
</reportSets>
|
|
</plugin>
|
|
</plugins>
|
|
</reporting>
|
|
|
|
<profiles>
|
|
|
|
<!-- Profile that adds compiling to a native binary using
|
|
GraalVM an Native Image https://www.graalvm.org/
|
|
|
|
Add -Pnative or -Dnative to use this profile.
|
|
-->
|
|
<profile>
|
|
<id>native</id>
|
|
<activation>
|
|
<property>
|
|
<name>native</name>
|
|
</property>
|
|
</activation>
|
|
<build>
|
|
<plugins>
|
|
<plugin>
|
|
<groupId>org.graalvm.buildtools</groupId>
|
|
<artifactId>native-maven-plugin</artifactId>
|
|
<version>${native.maven.plugin}</version>
|
|
<extensions>true</extensions>
|
|
<executions>
|
|
<execution>
|
|
<id>build-native</id>
|
|
<goals>
|
|
<goal>compile-no-fork</goal>
|
|
</goals>
|
|
<phase>package</phase>
|
|
</execution>
|
|
<execution>
|
|
<id>test-native</id>
|
|
<goals>
|
|
<goal>test</goal>
|
|
</goals>
|
|
<phase>test</phase>
|
|
</execution>
|
|
</executions>
|
|
<configuration>
|
|
<imageName>${appName}</imageName>
|
|
<mainClass>${main.class}</mainClass>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
|
|
<!-- Profile that adds JLink and JPackage runs.
|
|
|
|
Add -PImage or -DImage to use this profile.
|
|
-->
|
|
<profile>
|
|
<id>image</id>
|
|
<activation>
|
|
<property>
|
|
<name>Image</name>
|
|
</property>
|
|
</activation>
|
|
<build>
|
|
<finalName>${jar.filename}</finalName>
|
|
<plugins>
|
|
<!-- Copy dependencies -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-dependency-plugin</artifactId>
|
|
<version>${maven.dependency.plugin}</version>
|
|
<executions>
|
|
<!-- erstmal Abhängigkeiten für den Class-Path kopieren -->
|
|
<execution>
|
|
<id>copy-dependencies</id>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>copy-dependencies</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
|
<includeScope>runtime</includeScope>
|
|
<overWriteReleases>false</overWriteReleases>
|
|
<overWriteSnapshots>false</overWriteSnapshots>
|
|
<overWriteIfNewer>true</overWriteIfNewer>
|
|
</configuration>
|
|
</execution>
|
|
|
|
<!-- dazu noch das Projekt-JAR -->
|
|
<execution>
|
|
<id>copy</id>
|
|
<phase>install</phase>
|
|
<goals>
|
|
<goal>copy</goal>
|
|
</goals>
|
|
<configuration>
|
|
<outputDirectory>${project.build.directory}/modules</outputDirectory>
|
|
<artifactItems>
|
|
<artifactItem>
|
|
<groupId>${project.groupId}</groupId>
|
|
<artifactId>${project.artifactId}</artifactId>
|
|
<version>${project.version}</version>
|
|
<type>${project.packaging}</type>
|
|
<destFileName>${project.build.finalName}.jar</destFileName>
|
|
</artifactItem>
|
|
</artifactItems>
|
|
<overWriteIfNewer>true</overWriteIfNewer>
|
|
</configuration>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
|
|
<plugin>
|
|
<groupId>com.github.akman</groupId>
|
|
<artifactId>jpackage-maven-plugin</artifactId>
|
|
<version>${jpackage.maven.plugin}</version>
|
|
<configuration>
|
|
<name>${appName}</name>
|
|
<type>IMAGE</type>
|
|
<mainclass>${main.class}</mainclass>
|
|
<input>${project.build.directory}/modules</input>
|
|
<mainjar>${jar.filename}.jar</mainjar>
|
|
</configuration>
|
|
<executions>
|
|
<execution>
|
|
<phase>install</phase>
|
|
<goals>
|
|
<goal>jpackage</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
|
|
<!-- Profile to build a fat jar
|
|
|
|
Add -Pfatjar or -Dfatjar to use this profile.
|
|
-->
|
|
<profile>
|
|
<id>fatjar</id>
|
|
<activation>
|
|
<property>
|
|
<name>fatjar</name>
|
|
</property>
|
|
</activation>
|
|
<build>
|
|
<plugins>
|
|
<!-- Set jar plugin to not set classpath -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-jar-plugin</artifactId>
|
|
<version>${maven.jar.plugin}</version>
|
|
<configuration>
|
|
<archive>
|
|
<manifest>
|
|
<addClasspath>false</addClasspath>
|
|
</manifest>
|
|
</archive>
|
|
</configuration>
|
|
</plugin>
|
|
|
|
<!-- build the fat jar -->
|
|
<plugin>
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
<artifactId>maven-shade-plugin</artifactId>
|
|
<version>${maven.shade.plugin}</version>
|
|
<executions>
|
|
<execution>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>shade</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
<configuration>
|
|
<shadedArtifactAttached>true</shadedArtifactAttached>
|
|
<shadedClassifierName>full</shadedClassifierName>
|
|
<transformers>
|
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
|
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
|
<manifestEntries>
|
|
<Main-Class>${main.class}</Main-Class>
|
|
<Build-Version>1.0</Build-Version>
|
|
</manifestEntries>
|
|
</transformer>
|
|
</transformers>
|
|
<filters>
|
|
<filter>
|
|
<artifact>*:*</artifact>
|
|
<excludes>
|
|
<exclude>META-INF/MANIFEST.MF</exclude>
|
|
<exclude>**/module-info.class</exclude>
|
|
<exclude>META-INF/*.SF</exclude>
|
|
<exclude>META-INF/*.DSA</exclude>
|
|
<exclude>META-INF/*.RSA</exclude>
|
|
</excludes>
|
|
</filter>
|
|
</filters>
|
|
</configuration>
|
|
</plugin>
|
|
</plugins>
|
|
</build>
|
|
</profile>
|
|
</profiles>
|
|
|
|
</project>
|