java-application-parent
Used in:
components
- OverviewOverview
- VersionsVersions
- DependentsDependents
- DependenciesDependencies
<dependency>
<groupId>dev.mohterbaord</groupId>
<artifactId>java-application-parent</artifactId>
<version>1.0</version>
</dependency><?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-FileCopyrightText: 2026 Sergei Sokolov <mohterbaord@gmail.com> -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
<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>
<parent>
<groupId>dev.mohterbaord</groupId>
<artifactId>maven-parent</artifactId>
<version>14.0</version>
</parent>
<artifactId>java-application-parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>Java Application Parent</name>
<description>Build profiles parent POM for modern Java applications</description>
<url>https://codeberg.org/mohterbaord/java-application-parent</url>
<organization>
<name>Sergei Sokolov</name>
</organization>
<inceptionYear>2026</inceptionYear>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<id>mohterbaord</id>
<name>Sergei Sokolov</name>
<email>mohterbaord@gmail.com</email>
<url>https://mohterbaord.dev</url>
<roles>
<role>Project lead</role>
<role>Developer</role>
<role>Maintainer</role>
</roles>
</developer>
</developers>
<scm>
<url>https://codeberg.org/mohterbaord/java-application-parent</url>
<connection>scm:git:https://codeberg.org/mohterbaord/java-application-parent.git</connection>
<developerConnection>scm:git:ssh://git@codeberg.org/mohterbaord/java-application-parent.git</developerConnection>
<tag>1.0</tag>
</scm>
<properties>
<!-- NOTE:
A directory containing JPMS modules - the application JAR and its
dependency JARs. Used in "java-application:build" and
"java-application:run" profiles. Can be used for specifying module path
when running the application by its main module.
-->
<modulesHome>${project.build.directory}/modules</modulesHome>
<!-- NOTE:
Overriding 21 from "maven-parent" to the last LTS available as for
applications, the new Java features are more preferable.
-->
<maven.compiler.release>25</maven.compiler.release>
<!-- Dependencies - dev.mohterbaord libraries -->
<!--
Depki
* Docs: https://codeberg.org/mohterbaord/depki
* Sources: https://codeberg.org/mohterbaord/depki
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord/depki/overview
-->
<version.depki>0.0.5</version.depki>
<!--
FP4j
* Docs: https://codeberg.org/mohterbaord/fp4j
* Sources: https://codeberg.org/mohterbaord/fp4j
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord/fp4j/overview
-->
<version.fp4j>0.5.0</version.fp4j>
<!--
HJSON
* Docs: https://codeberg.org/mohterbaord/hjson-java
* Sources: https://codeberg.org/mohterbaord/hjson-java
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord/hjson/overview
-->
<version.hjson>4.0.0-M1</version.hjson>
<!--
Routiki
* Docs: https://codeberg.org/mohterbaord/routiki
* Sources: https://codeberg.org/mohterbaord/routiki
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord/routiki/overview
-->
<version.routiki>0.1.1</version.routiki>
<!-- Dependencies - dev.mohterbaord utility libraries -->
<!--
Char Cursor
* Docs: https://codeberg.org/mohterbaord/char-cursor
* Sources: https://codeberg.org/mohterbaord/char-cursor
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord.util/char-cursor/overview
-->
<version.char-cursor>0.0.2</version.char-cursor>
<!--
Failable Functions
* Docs: https://codeberg.org/mohterbaord/failable-functions
* Sources: https://codeberg.org/mohterbaord/failable-functions
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord.util/failable-functions/overview
-->
<version.failable-functions>0.0.1</version.failable-functions>
<!--
Result
* Docs: https://codeberg.org/mohterbaord/result-java
* Sources: https://codeberg.org/mohterbaord/result-java
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord.util/result/overview
-->
<version.result>0.0.1</version.result>
<!--
Unicode Encoding Detector
* Docs: https://codeberg.org/mohterbaord/unicode-encoding-detector
* Sources: https://codeberg.org/mohterbaord/unicode-encoding-detector
* MVN repo: https://central.sonatype.com/artifact/dev.mohterbaord.util/unicode-encoding-detector/overview
-->
<version.unicode-encoding-detector>0.2.0</version.unicode-encoding-detector>
</properties>
<dependencyManagement>
<dependencies>
<!-- Dependencies - dev.mohterbaord libraries -->
<dependency>
<groupId>dev.mohterbaord</groupId>
<artifactId>depki</artifactId>
<version>${version.depki}</version>
</dependency>
<dependency>
<groupId>dev.mohterbaord</groupId>
<artifactId>fp4j-bom</artifactId>
<version>${version.fp4j}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>dev.mohterbaord</groupId>
<artifactId>hjson</artifactId>
<version>${version.hjson}</version>
</dependency>
<dependency>
<groupId>dev.mohterbaord</groupId>
<artifactId>routiki</artifactId>
<version>${version.routiki}</version>
</dependency>
<!-- Dependencies - dev.mohterbaord utility libraries -->
<dependency>
<groupId>dev.mohterbaord.util</groupId>
<artifactId>char-cursor</artifactId>
<version>${version.char-cursor}</version>
</dependency>
<dependency>
<groupId>dev.mohterbaord.util</groupId>
<artifactId>failable-functions</artifactId>
<version>${version.failable-functions}</version>
</dependency>
<dependency>
<groupId>dev.mohterbaord.util</groupId>
<artifactId>result</artifactId>
<version>${version.result}</version>
</dependency>
<dependency>
<groupId>dev.mohterbaord.util</groupId>
<artifactId>unicode-encoding-detector</artifactId>
<version>${version.unicode-encoding-detector}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<!-- NOTE:
Profiles starting with "java-application" are provided and should be used
in children.
-->
<profile>
<id>java-application:build</id>
<properties>
<mainClass />
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>require-main-class</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>mainClass</property>
<regex>.+\..+</regex>
<regexMessage>Property "mainClass" is required (specify it in FQCN format)</regexMessage>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>check-main-class-exists</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<fail message="Main class ${mainClass} not found in ${project.build.outputDirectory}">
<condition>
<not>
<available classname="${mainClass}">
<classpath>
<pathelement location="${project.build.outputDirectory}" />
</classpath>
</available>
</not>
</condition>
</fail>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${modulesHome}</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-application-jar</id>
<!-- NOTE:
Relies on jar:jar (default "package" binding tied to the
"maven-jar-plugin" declaration above) running before this
execution, since both are bound to "package" and Maven orders
same-phase executions by <plugin> declaration order in the POM
(guaranteed since Maven 3.0.3 — see MNG-2258). Keep this
plugin block textually AFTER "maven-jar-plugin".
-->
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modulesHome}</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<includes>
<include>${project.build.finalName}.jar</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-application:run</id>
<properties>
<mainModule />
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>require-main-module</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>mainModule</property>
<regex>.+\..+</regex>
<regexMessage>Property "mainModule" is required</regexMessage>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>run-application</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<!-- NOTE:
"exec-maven-plugin:3.6.3" automatically post-processes the
module-path/class-path arguments when it detects the
executable is "java" (longModulepath/longClasspath handling
for @argfile support). This post-processing silently drops
the module-path value from the final command line, leaving
"java - -module-path - -module ..." with no path. Disabling
it below restores the raw arguments as configured.
-->
<longModulepath>false</longModulepath>
<arguments>
<argument>--module-path</argument>
<argument>${modulesHome}</argument>
<argument>--module</argument>
<argument>${mainModule}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- NOTE:
Profiles starting with "java-application-parent" are only used in the
POM's own build lifecycle and then should not be used in children.
-->
<profile>
<id>java-application-parent:versions</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.6.2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.3</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<ruleSet>
<ignoreVersion>
<type>regex</type>
<version>.+-(SNAPSHOT|M\d)</version>
</ignoreVersion>
<ignoreVersion>
<type>regex</type>
<version>.+-(alpha|beta).*</version>
</ignoreVersion>
<rules>
<rule>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<ignoreVersion>
<type>regex</type>
<version>.*</version>
</ignoreVersion>
</rule>
<rule>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<ignoreVersion>
<type>regex</type>
<version>.*</version>
</ignoreVersion>
</rule>
</rules>
</ruleSet>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-application-parent:license</id>
<properties>
<skipTests>true</skipTests>
<license.licenseName>apache_v2</license.licenseName>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.7.1</version>
<executions>
<execution>
<id>upsert-license-file</id>
<goals>
<goal>update-project-license</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-application-parent:release</id>
<properties>
<keynameProfile>keyname-general</keynameProfile>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{version}</tagNameFormat>
<releaseProfiles>${keynameProfile},java-application-parent:publish</releaseProfiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java-application-parent:publish</id>
<properties>
<publishingServerId>java-application-parent-usertoken</publishingServerId>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<bestPractices>true</bestPractices>
<defaultKeyring>false</defaultKeyring>
<keyname>${gpg.keyname}</keyname>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.10.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>${publishingServerId}</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>