<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2011-2025 Lime Mojito Pty Ltd
  ~
  ~    Licensed under the Apache License, Version 2.0 (the "License");
  ~    you may not use this file except in compliance with the License.
  ~    You may obtain a copy of the License at
  ~
  ~        http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~    Unless required by applicable law or agreed to in writing, software
  ~    distributed under the License is distributed on an "AS IS" BASIS,
  ~    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~    See the License for the specific language governing permissions and
  ~    limitations under the License.
  ~
  -->
<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>

    <groupId>com.limemojito.oss.standards</groupId>
    <artifactId>oss-maven-standards</artifactId>
    <version>15.2.0</version>
    <packaging>pom</packaging>

    <properties>
        <!-- Overridden by build server -->
        <build.number>LOCAL</build.number>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <github.url>https://github.com/LimeMojito/oss-maven-standards</github.url>
        <git.url>git@github.com:LimeMojito/oss-maven-standards.git</git.url>
        <lime.scm.url>scm:git:${git.url}</lime.scm.url>
        <lime.website.url>https://limemojito.com</lime.website.url>
        <staging.nexus.url>https://oss.sonatype.org</staging.nexus.url>

        <checkstyle.version>10.21.0</checkstyle.version>
        <java.version>21</java.version>
        <!-- This has both library and build implications -->
        <spring.boot.version>3.4.1</spring.boot.version>
        <aws-cdk-lib.version>2.174.0</aws-cdk-lib.version>
        <lombok.version>1.18.36</lombok.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
    </properties>

    <modules>
        <module>library</module>
        <module>java-development</module>
        <module>jar-development</module>

        <module>utilities</module>

        <module>spring-boot-development</module>
        <module>jar-lambda-development</module>
        <module>java-cdk-development</module>

        <!-- Useful things made from the development archetypes -->
        <module>applications</module>

        <!-- Test the dev framework -->
        <module>development-test</module>
    </modules>

    <name>Lime Mojito OSS Development Standard Build</name>
    <description>A set of maven poms that allow us to use an agile development methodology when we build our apps.
        Checkstyle, unit test, coverage, etc. are all built into the build.
    </description>
    <url>${github.url}</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>Lime Mojito Pty Ltd</id>
            <name>Development Group</name>
            <email>sales@limemojito.com</email>
            <timezone>+10</timezone>
            <organization>Lime Mojito Pty Ltd</organization>
            <organizationUrl>${lime.website.url}</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
        </developer>
    </developers>
    <issueManagement>
        <system>GitHub</system>
        <url>${github.url}/issues</url>
    </issueManagement>

    <organization>
        <name>Lime Mojito Pty Ltd</name>
        <url>${lime.website.url}</url>
    </organization>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>${staging.nexus.url}/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>${staging.nexus.url}/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <scm>
        <connection>${lime.scm.url}</connection>
        <developerConnection>${lime.scm.url}</developerConnection>
        <url>${github.url}</url>
        <tag>master</tag>
    </scm>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>default-clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>false</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${project.basedir}/cdk.out</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <rules>
                        <requireMavenVersion>
                            <version>[3.8.8,)</version>
                        </requireMavenVersion>
                        <requireJavaVersion>
                            <version>[21.0.1,)</version>
                        </requireJavaVersion>
                        <requireReleaseDeps>
                            <onlyWhenRelease>true</onlyWhenRelease>
                        </requireReleaseDeps>
                        <dependencyConvergence/>
                        <bannedDependencies>
                            <excludes>
                                <exclude>org.hamcrest:hamcrest-all</exclude>
                                <!-- Old javax apis require EE9+ from now on -->
                                <exclue>javax.servlet</exclue>
                                <exclue>javax.xml.bind</exclue>
                                <exclue>javax.jms</exclue>
                                <exclue>javax.jms</exclue>
                                <exclue>javax.validation</exclue>
                            </excludes>
                            <searchTransitive>true</searchTransitive>
                        </bannedDependencies>
                    </rules>
                </configuration>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                    <!--
                      This allows us to use things like if in ant tasks.  We use ant to add some control flow to
                      maven builds.

                      <configuration>
                          <target xmlns:ac="antlib:net.sf.antcontrib">
                              <ac:if>
                                  ...
                  -->
                    <dependencies>
                        <dependency>
                            <groupId>ant-contrib</groupId>
                            <artifactId>ant-contrib</artifactId>
                            <version>1.0b3</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>ant</groupId>
                                    <artifactId>ant</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.4.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.4.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>2.18.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.12</version>
                </plugin>
                <plugin>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok-maven-plugin</artifactId>
                    <version>1.18.20.0</version>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring.boot.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <!--
                                  Supply key name with gpg.keyname property on command line if not default
                                  https://maven.apache.org/plugins/maven-gpg-plugin/sign-mojo.html#keyname
                                 -->
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.7.0</version>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>${staging.nexus.url}/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                        <executions>
                            <execution>
                                <id>nexus-deploy</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>deploy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>fast-build</id>
            <properties>
                <!-- Custom property for the fine-tuning of skip executions -->
                <lime.fast-build>true</lime.fast-build>
            </properties>
        </profile>
    </profiles>

</project>
