<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 2012 - 2015 by Stefan Ferstl <st.ferstl@gmail.com>

  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.github.ferstl</groupId>
  <artifactId>pedantic-pom-enforcers</artifactId>
  <version>2.2.0</version>
  <packaging>jar</packaging>
  <name>Pedantic POM Enforcers</name>
  <description>
    The Pedantic POM Enforcers consist of several Maven enforcer rules that help you keep your
    project setup consistent and organized.
  </description>
  <url>https://github.com/ferstl/pedantic-pom-enforcers</url>
  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <ciManagement>
    <system>travis-ci</system>
    <url>https://travis-ci.org/ferstl/pedantic-pom-enforcers</url>
  </ciManagement>
  <issueManagement>
    <system>github</system>
    <url>${project.url}/issues</url>
  </issueManagement>

  <developers>
    <developer>
      <id>ferstl</id>
      <name>Stefan Ferstl</name>
      <email>st.ferstl@gmail.com</email>
      <url>https://github.com/ferstl</url>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:ferstl/pedantic-pom-enforcers.git</connection>
    <developerConnection>scm:git:git@github.com:ferstl/pedantic-pom-enforcers.git</developerConnection>
    <url>${project.url}</url>
    <tag>pedantic-pom-enforcers-2.2.0</tag>
  </scm>

  <distributionManagement>
    <repository>
      <id>${distribution.release.id}</id>
      <url>${distribution.release.url}</url>
    </repository>
    <snapshotRepository>
      <id>${distribution.snapshot.id}</id>
      <url>${distribution.snapshot.url}</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <!-- Plugin versions. -->
    <license-maven-plugin.version>4.2</license-maven-plugin.version>
    <maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
    <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
    <maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
    <maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
    <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
    <maven-install-plugin.version>3.1.1</maven-install-plugin.version>
    <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
    <maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
    <maven-release-plugin.version>3.0.1</maven-release-plugin.version>
    <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
    <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
    <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
    <coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
    <jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
    <takari-lifecycle-plugin.version>2.0.0</takari-lifecycle-plugin.version>

    <!-- Other settings. -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.version>3.9.3</maven.version>
    <pedantic-pom-enforcers-doclet.version>1.0.5-SNAPSHOT</pedantic-pom-enforcers-doclet.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>32.1.1-jre</version>
    </dependency>
    <dependency>
      <groupId>com.googlecode.java-diff-utils</groupId>
      <artifactId>diffutils</artifactId>
      <version>1.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <version>2.3.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.enforcer</groupId>
      <artifactId>enforcer-api</artifactId>
      <version>${maven-enforcer-plugin.version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <artifactId>junit</artifactId>
          <groupId>junit</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.takari.maven.plugins</groupId>
      <artifactId>takari-plugin-integration-testing</artifactId>
      <version>2.9.2</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.takari.maven.plugins</groupId>
      <artifactId>takari-plugin-testing</artifactId>
      <version>2.9.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>java-hamcrest</artifactId>
      <version>2.0.0.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>3.12.4</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>${license-maven-plugin.version}</version>
          <configuration>
            <header>${basedir}/src/etc/header.txt</header>
            <strictCheck>true</strictCheck>
            <mapping>
              <java>SLASHSTAR_STYLE</java>
            </mapping>
            <includes>
              <include>src/main/**</include>
              <include>src/test/java/**</include>
            </includes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>io.takari.maven.plugins</groupId>
          <artifactId>takari-lifecycle-plugin</artifactId>
          <version>${takari-lifecycle-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>${maven-clean-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>${maven-deploy-plugin.version}</version>
        </plugin>

        <!-- Obey the own rules! (Has to be disabled because the maven-release-plugin doesn't like depending on the artifact
          which it is releasing. And no, putting it into an inactive profile doesn't work either To verify the POM structure, uncomment
          the section below and run mvn enforcer:enforce . -->
        <!-- plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>${maven-enforcer-plugin.version}</version>
          <configuration> <rules> <compound implementation="com.github.ferstl.maven.pomenforcers.CompoundPedanticEnforcer"> <enforcers>POM_SECTION_ORDER,DEPENDENCY_MANAGEMENT_ORDER,DEPENDENCY_ORDER,PLUGIN_MANAGEMENT_ORDER,PLUGIN_CONFIGURATION,PLUGIN_MANAGEMENT_LOCATION</enforcers>
          </compound> </rules> <fail>true</fail> </configuration> <dependencies> <dependency> <groupId>com.github.ferstl</groupId>
          <artifactId>pedantic-pom-enforcers</artifactId> <version>${project.version}</version> </dependency> </dependencies> </plugin -->

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>${maven-gpg-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>${maven-install-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${maven-javadoc-plugin.version}</version>
          <configuration>
            <source>8</source>
            <doclint>none</doclint>
            <tags>
              <tag>
                <name>id</name>
                <placement>a</placement>
                <head>Enforcer Rule ID:</head>
              </tag>
              <tag>
                <name>configParam</name>
                <placement>a</placement>
                <head>Enforcer Configuration Parameter</head>
              </tag>
              <tag>
                <name>default</name>
                <placement>a</placement>
                <head>Default Value:</head>
              </tag>
            </tags>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>${maven-release-plugin.version}</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <useReleaseProfile>false</useReleaseProfile>
            <arguments>-Pdeploy-to-sonatype-oss</arguments>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven-resources-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>${maven-source-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${maven-surefire-plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.eluder.coveralls</groupId>
          <artifactId>coveralls-maven-plugin</artifactId>
          <version>${coveralls-maven-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>org.glassfish.jaxb</groupId>
              <artifactId>jaxb-runtime</artifactId>
              <version>2.3.5</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco-maven-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>io.takari.maven.plugins</groupId>
        <artifactId>takari-lifecycle-plugin</artifactId>
        <executions>
          <execution>
            <id>testProperties</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>testProperties</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>generate-wiki</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>create-wiki</id>
                <phase>initialize</phase>
                <goals>
                  <goal>javadoc</goal>
                </goals>
                <configuration>
                  <doclet>com.github.ferstl.doclet.PedanticEnforcerDoclet</doclet>
                  <useStandardDocletOptions>false</useStandardDocletOptions>
                  <additionalOptions>-outputDirectory "${project.basedir}/../${project.artifactId}.wiki"</additionalOptions>
                  <reportOutputDirectory>${project.basedir}/../${project.artifactId}.wiki</reportOutputDirectory>
                  <destDir>..</destDir>
                  <docletArtifact>
                    <groupId>com.github.ferstl</groupId>
                    <artifactId>pedantic-pom-enforcers-doclet</artifactId>
                    <version>${pedantic-pom-enforcers-doclet.version}</version>
                  </docletArtifact>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>deploy-to-sonatype-oss</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <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>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
