<?xml version="1.0" encoding="UTF-8"?>
<!--

     Copyright 2022 Manik Magar

     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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  
  <groupId>com.github.manikmagar</groupId>
  <artifactId>semver4j</artifactId>
  <version>0.2.0</version>
  
  <properties>
    <java.version>11</java.version>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <maven.compiler.release>${java.version}</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.github.repository>manikmagar/semver4j</project.github.repository>
    <repository.url>git@github.com:${project.github.repository}.git</repository.url>
  </properties>

  <name>Semver4J</name>
  <description>Create, Parse, and Validate Semantic Version strings</description>
  <inceptionYear>2022</inceptionYear>
  <url>https://github.com/manikmagar/semver4j</url>

  <scm>
    <connection>scm:git:${repository.url}</connection>
    <developerConnection>scm:ssh:${repository.url}</developerConnection>
    <tag>HEAD</tag>
    <url>${repository.url}</url>
  </scm>

  <licenses>
    <license>
      <name>Apache-2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <organization>
    <name>Manik Magar</name>
    <url>https://github.com/manikmagar</url>
  </organization>

  <developers>
    <developer>
      <id>manikmagar</id>
      <name>Manik Magar</name>
      <url>https://manik.magar.me</url>
    </developer>
  </developers>

  <issueManagement>
    <system>github.com</system>
    <url>https://github.com/${project.github.repository}/issues</url>
  </issueManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>5.8.1</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.23.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.bsideup.jabel</groupId>
      <artifactId>jabel-javac-plugin</artifactId>
      <version>1.0.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <!-- Keep alphabetic order -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.github.manikmagar</groupId>
          <artifactId>git-versioner-maven-plugin</artifactId>
          <version>0.3.0</version>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>4.1</version>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>2.27.2</version>
          <configuration>
            <formats>
              <format>
                <includes>
                  <include>*.md</include>
                  <include>.gitignore</include>
                </includes>
                <!-- define the steps to apply to those files -->
                <trimTrailingWhitespace/>
                <endWithNewline/>
                <indent>
                  <tabs>true</tabs>
                  <spacesPerTab>4</spacesPerTab>
                </indent>
              </format>
            </formats>
            <!-- define a language-specific format -->
            <java>
              <eclipse>
                <version>4.13.0</version>                     <!-- optional -->
              </eclipse>
            </java>
          </configuration>
          <executions>
            <execution>
              <id>checkSpotlessx</id>
              <goals>
                <goal>check</goal>
              </goals>
              <phase>compile</phase>
            </execution>
            <execution>
              <id>applySpotless</id>
              <goals>
                <goal>apply</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>net.revelc.code</groupId>
          <artifactId>impsort-maven-plugin</artifactId>
          <version>1.6.2</version>
          <configuration>
            <groups>java.,javax.,org.,com.</groups>
            <removeUnused>true</removeUnused>
            <staticAfter>true</staticAfter>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <configuration>
            <parameters>true</parameters>
            <!-- Make sure we're not using Java 9+ APIs -->
            <release>8</release>
            <source>11</source>
            <target>11</target>
            <!-- The following setting can be avoided on Java 14 and higher -->
            <compilerArgs>
              <arg>-Xplugin:jabel</arg>
            </compilerArgs>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.0.0-M3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.github.manikmagar</groupId>
        <artifactId>git-versioner-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>set-version</id>
            <goals>
              <goal>set</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>qa</id>
      <activation>
        <property>
          <name>!quick</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.manikmagar</groupId>
            <artifactId>git-versioner-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <configuration>
              <header>etc/license.txt</header>
              <strictCheck>true</strictCheck>
              <aggregate>true</aggregate>
              <excludes>
                <exclude>LICENSE.txt</exclude>
                <exclude>**/.dontdelete</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>checkSpotlessx</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>compile</phase>
              </execution>
              <execution>
                <id>applySpotless</id>
                <goals>
                  <goal>apply</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>net.revelc.code</groupId>
            <artifactId>impsort-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>sort-imports</id>
                <goals>
                  <goal>sort</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-plugin-versions</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireJavaVersion>
                      <version>[${java.version},)</version>
                    </requireJavaVersion>
                    <requirePluginVersions>
                       <banLatest>true</banLatest>
                       <banRelease>true</banRelease>
                       <banSnapshots>true</banSnapshots>
                       <phases>clean,deploy,site</phases>
                    </requirePluginVersions>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
    <id>format</id>
    <activation>
      <property>
        <name>format</name>
      </property>
    </activation>
    <properties>
      <skipTests>true</skipTests>
      <quick>true</quick>
    </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>applySpotless</id>
                <goals>
                  <goal>apply</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>format</id>
                <goals>
                  <goal>format</goal>
                </goals>
                <phase>process-sources</phase>
              </execution>
              <execution>
                <id>check</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
  </profile>
    <profile>
      <id>quick</id>
      <activation>
        <property>
          <name>quick</name>
        </property>
      </activation>
      <properties>
        <skipTests>true</skipTests>
      </properties>
    </profile>
    <profile>
      <id>intellij-idea-only</id>
      <activation>
        <property>
          <name>idea.maven.embedder.version</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <release>11</release>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>deploy</id>
      <activation>
        <property>
          <name>deploy</name>
        </property>
      </activation>
<!--      <properties>-->
<!--        <quick>true</quick>-->
<!--      </properties>-->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <attach>true</attach>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.jreleaser</groupId>
            <artifactId>jreleaser-maven-plugin</artifactId>
            <version>1.3.1</version>
            <configuration>
              <configFile>jreleaser.yml</configFile>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <repository>
          <id>build-stage</id>
          <layout>default</layout>
          <url>file://${project.build.directory}/staging-deploy</url>
        </repository>
      </distributionManagement>
    </profile>
  </profiles>
</project>
