<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <!-- Basics -->
  <groupId>com.github.ekryd.sortpom</groupId>
  <artifactId>sortpom-parent</artifactId>
  <version>2.15.0</version>
  <packaging>pom</packaging>
  <name>SortPom</name>
  <description>A Maven plugin that sorts the pom.xml file.</description>

  <modules>
    <module>sorter</module>
    <module>maven-plugin</module>
  </modules>

  <properties>
    <compileSource>1.8</compileSource>
    <junit.jupiter.version>5.8.0-M1</junit.jupiter.version>
    <mockito.version>3.8.0</mockito.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <slf4j.version>2.0.0-alpha1</slf4j.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.8.0</version>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>3.8.1</version>
      </dependency>
      <dependency>
        <groupId>org.jdom</groupId>
        <artifactId>jdom</artifactId>
        <!-- No, this version will never be updated -->
        <version>1.1.3</version>
      </dependency>

      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.6.0</version>
        <scope>provided</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Common test dependencies -->
    <dependency>
      <groupId>com.github.ekryd.reflection-utils</groupId>
      <artifactId>reflection-utils</artifactId>
      <version>1.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <version>2.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-inline</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.github.ekryd.echo-maven-plugin</groupId>
          <artifactId>echo-maven-plugin</artifactId>
          <version>1.3.2</version>
        </plugin>
        <plugin>
          <groupId>com.github.ekryd.sortpom</groupId>
          <artifactId>sortpom-maven-plugin</artifactId>
          <version>2.14.1</version>
          <configuration>
            <createBackupFile>false</createBackupFile>
            <predefinedSortOrder>custom_1</predefinedSortOrder>
            <lineSeparator>\n</lineSeparator>
            <encoding>${project.build.sourceEncoding}</encoding>
            <sortProperties>true</sortProperties>
            <keepBlankLines>true</keepBlankLines>
            <sortDependencies>scope,groupId,artifactId</sortDependencies>
            <indentSchemaLocation>true</indentSchemaLocation>
          </configuration>
        </plugin>
        <plugin>
          <!-- References plugin (not directly used) -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <!-- References plugin (not directly used) -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <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-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <configuration>
            <source>${compileSource}</source>
            <target>${compileSource}</target>
          </configuration>
        </plugin>
        <plugin>
          <!-- References plugin (not directly used) -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.2</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <!-- Used for Maven integration testing -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.2.2</version>
          <configuration>
            <!-- for jacoco to analyze integration test runs, the jar-file has to be in the local repository used by the invoker plugin when running tests -->
            <extraArtifacts>
              <extraArtifact>org.jacoco:org.jacoco.agent:0.8.5:jar:runtime</extraArtifact>
            </extraArtifacts>
            <!-- skip any .mavenrc file to override what the jacoco agent defined in the invoker.mavenOpts variable -->
            <environmentVariables>
              <MAVEN_SKIP_RC>1</MAVEN_SKIP_RC>
            </environmentVariables>
          </configuration>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <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-plugin-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
        <plugin>
          <!-- Define versions for standard plugins -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>2.8.1</version>
        </plugin>
        <plugin>
          <!-- Coverage -->
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.6</version>
          <configuration>
            <excludes>
              <exclude>**/*HelpMojo.class</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>3.8.0.2131</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>com.github.ekryd.echo-maven-plugin</groupId>
        <artifactId>echo-maven-plugin</artifactId>
        <inherited>false</inherited>
        <executions>
          <execution>
            <id>welcome</id>
            <goals>
              <goal>echo</goal>
            </goals>
            <configuration>
              <fromFile>misc/welcome.txt</fromFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-plugin-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.3.9</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>1.8</version>
                </requireJavaVersion>
                <requirePluginVersions>
                  <message>Best Practice is to always define plugin versions!</message>
                  <banLatest>true</banLatest>
                  <banRelease>true</banRelease>
                  <banSnapshots>true</banSnapshots>
                </requirePluginVersions>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <executions>
          <execution>
            <id>default-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <execution>
            <id>help-goal</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- Release management -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.0.0-M1</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <arguments>-Pdistribution</arguments>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <!-- Coverage -->
        <groupId>org.eluder.coveralls</groupId>
        <artifactId>coveralls-maven-plugin</artifactId>
        <version>4.3.0</version>
        <dependencies>
          <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.4.0-b180830.0359</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <!-- Coverage -->
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <!-- create the invoker.mavenOpts variable, containing what is needed for the agent to run during the integration tests. -->
          <execution>
            <id>pre-integration-test</id>
            <goals>
              <goal>prepare-agent-integration</goal>
            </goals>
            <configuration>
              <propertyName>invoker.mavenOpts</propertyName>
            </configuration>
          </execution>
          <!-- merge the two data files of jacoco (the one for the unit tests, the other for the integration tests) into only one file, and generate only one report (disabling the two others) -->
          <execution>
            <id>merge</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>post-integration-test</phase>
            <configuration>
              <fileSets>
                <fileSet implementation="org.apache.maven.shared.model.fileset.FileSet">
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>*.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
              <destFile>${project.build.directory}/jacocoAll.exec</destFile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- Release handling -->
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.8</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <!-- Misc -->
  <url>https://github.com/Ekryd/sortpom/</url>
  <inceptionYear>2009</inceptionYear>

  <licenses>
    <license>
      <name>New BSD License</name>
      <url>http://en.wikipedia.org/wiki/BSD_licenses</url>
      <distribution>repo</distribution>
      <comments>Whatever</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>bjorn.ekryd</id>
      <name>Björn Ekryd</name>
      <email>bjorn.ekryd(at)gmail(dot)com</email>
      <url>http://www.linkedin.com/in/bjornekryd</url>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/Ekryd/sortpom.git</connection>
    <developerConnection>scm:git:https://github.com/Ekryd/sortpom.git</developerConnection>
    <url>https://github.com/Ekryd/sortpom</url>
    <tag>sortpom-parent-2.15.0</tag>
  </scm>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/Ekryd/sortpom/issues</url>
  </issueManagement>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <!-- Profiles -->
  <profiles>
    <profile>
      <id>distribution</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
              <minmemory>128m</minmemory>
              <maxmemory>512</maxmemory>
              <breakiterator>true</breakiterator>
              <quiet>true</quiet>
              <source>${compileSource}</source>
              <verbose>false</verbose>
              <linksource>true</linksource>
              <links>
                <!-- JSE -->
                <link>http://docs.oracle.com/javase/8/docs/api/</link>
              </links>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
