topinfra-maven
Maven core extensions run before maven plugins help you logging into docker registry, decrypting gpg key or customizing settings files etc...
These extension need to be run before any maven plugins (so they have to be extensions not plugins).
1. Install topinfra-maven
See homebrew-topinfra to find out how to install topinfra-maven as an alternative maven distribution or just install a shaded jar into you existing maven installation
snapshots: https://oss.sonatype.org/content/repositories/snapshots/top/infra/maven/
2. Use topinfra-maven-extension
You need to install topinfra-maven before using topinfra-maven-extension, see homebrew-topinfra.
.mvn/extensions.xml
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<!-- @formatter:off -->
<extension><artifactId>topinfra-maven-extension</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-docker</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-gitflow-semver</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-gpg-key</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-infrastructure-settings</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-maven-build-pom</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<extension><artifactId>topinfra-mvnext-module-settings-security</artifactId><groupId>top.infra.maven</groupId><version>1.4.0-SNAPSHOT</version></extension>
<!-- @formatter:on -->
</extensions>
(e.g. ci-and-cd/maven-build/.mvn/extensions.xml)
Build topinfra-maven
./mvnw -s settings.xml clean install
CI_OPT_SONAR="true" ./mvnw -s settings.xml -Dgpg.executable=gpg -Dgpg.loopback=true -Dsonar.organization=home1-oss-github clean deploy
./mvnw dependency:tree
References
faster-maven-builds-with-maven-opts https://docs.oracle.com/javase/8/docs/technotes/guides/vm/class-data-sharing.html#skip2content
Lifecycles Reference introduction-to-the-lifecycle standard set of bindings