parent-pom

Java POM for easy POM definition and inheritance.

Have a look at Available Profiles to see what it can do.

[TOC]

Requirements

Setup

Install the POM

$ mvn -P library install

Updating

# Check for Maven Plugin updates
$ mvn versions:display-plugin-updates
# Check for Maven Dependency updates
$ mvn versions:display-dependency-updates

Using it

Once this Parent POM is inside the Maven local repository or a Maven Registry, child projects can inherit it.

Add this to their pom.xml file:

<parent>
    <groupId>io.github.cardin</groupId>
    <artifactId>parent-pom</artifactId>
    <version>...</version>
</parent>

There are several configuration values in the <properties> section, feel free to overwrite as necessary by redefining it.

Example:

<properties>
    <property>
        <maven.compiler.source>17</maven.compiler.source>
    </property>
</properties>

Child projects can also utilise profiles defined by the Parent POM.

Available Profiles

Default profile

mvn <goal>

Required Properties:

Purpose:

library profile

mvn -P library <goal>

Meant for non-executable JARs.

It has the same behavior as the default profile, except it:

Purpose:

uber profile

Meant for compiling a standalone JAR with all dependencies embedded

It has the same behavior as the default profile, except it:

Required Properties:

Purpose:

Deploying Offline

After you’ve inherited this POM and built a Java app, sometimes you want to deploy within an offline environment.

  1. Go to an online machine
  2. git clone <url> <localDir>
  3. Build your Java app, but add this property -D"maven.repo.local"=<dir>
    • E.g. mvn -Dmaven.repo.local=<dir> install
    • You might need mvn -D"maven.repo.local"=<dir> instead if you’re on Windows
    • <dir> is where you define your temporary Maven local repository
  4. Zip the Maven local repository, transfer it, and unzip it in the offline machine
    • You can unzip in the default location ~/.m2
    • Or use the property -Dmaven.repo.local=<dir>
    • Or configure <localRepository> in Maven settings.xml
    • See https://maven.apache.org/settings.html
  5. Configure your offline machine’s Maven settings.xml
    • Set <offline>true</offline>
  6. You will be able to build using Maven now