<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.honton.chas</groupId>
  <artifactId>exists-maven-plugin</artifactId>
  <version>0.15.0</version>
  <packaging>maven-plugin</packaging>

  <name>Artifact Exists Maven Plugin</name>
  <description>Check if a http resource exists, particularly artifacts in a remote repository</description>

  <url>https://github.com/chonton/${project.artifactId}</url>
  <inceptionYear>2016</inceptionYear>

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

  <developers>
    <developer>
      <name>chas honton</name>
      <email>chas@honton.org</email>
      <url>https://www.linkedin.com/in/chonton</url>
    </developer>
    <developer>
      <name>Pascal</name>
      <url>https://github.com/pascalgn</url>
    </developer>
    <developer>
      <name>Tom Anderegg</name>
      <url>https://github.com/tomandegg</url>
    </developer>
    <developer>
      <name>clembo590</name>
      <url>https://github.com/clembo590</url>
    </developer>
  </developers>

  <prerequisites>
    <maven>${maven.version}</maven>
  </prerequisites>

  <scm>
    <connection>scm:git:git://github.com/chonton/${project.artifactId}</connection>
    <developerConnection>scm:git:git@github.com:chonton/${project.artifactId}</developerConnection>
    <url>https://github.com/chonton/${project.artifactId}</url>
  </scm>

  <distributionManagement>
        <site>
          <id>github</id>
          <url>scm:git:ssh://git@github.com/chonton/${project.artifactId}.git</url>
        </site>

     </distributionManagement>

  <properties>
    <git-code-format-maven-plugin.version>5.3</git-code-format-maven-plugin.version>
    <javadoc-plugin.version>3.6.3</javadoc-plugin.version>
    <junit.version>5.10.1</junit.version>

    <maven.compiler.release>17</maven.compiler.release>
    <maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
    <maven.compiler.target>${maven.compiler.release}</maven.compiler.target>

    <!-- org.sonatype.central:central-publishing-maven-plugin instead of org.apache.maven.plugins:maven-deploy-plugin -->
    <maven.deploy.skip>true</maven.deploy.skip>
    <!-- use com.github.github:site-maven-plugin instead of org.apache.maven.plugins:maven-site-plugin -->
    <maven.site.deploy.skip>true</maven.site.deploy.skip>

    <maven.version>3.9.6</maven.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <!-- for convergence -->
  <dependencyManagement>
    <dependencies>

      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-classworlds</artifactId>
        <version>2.6.0</version>
      </dependency>

      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-component-annotations</artifactId>
        <version>2.1.0</version>
      </dependency>

      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-utils</artifactId>
        <version>3.5.1</version>
      </dependency>

      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.32</version>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </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-model</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</groupId>
      <artifactId>maven-repository-metadata</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-settings</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.9.0</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-provider-api</artifactId>
      <version>3.5.1</version>
    </dependency>

    <dependency>
      <groupId>org.eclipse.sisu</groupId>
      <artifactId>org.eclipse.sisu.plexus</artifactId>
      <version>0.3.5</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-sec-dispatcher</artifactId>
      <version>2.0</version>
    </dependency>

  </dependencies>

  <build>
    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>com.cosium.code</groupId>
          <artifactId>git-code-format-maven-plugin</artifactId>
          <version>${git-code-format-maven-plugin.version}</version>
          <dependencies>
            <dependency>
              <groupId>com.cosium.code</groupId>
              <artifactId>google-java-format</artifactId>
              <version>${git-code-format-maven-plugin.version}</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.3.2</version>
        </plugin>

        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version>
        </plugin>

        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.6.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.2.4</version>
        </plugin>

        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.6.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${javadoc-plugin.version}</version>
        </plugin>

        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>3.12.0</version>
        </plugin>

        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>

        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-scm-publish-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.12.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>

        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.2.5</version>
        </plugin>

        <plugin>
          <groupId>org.honton.chas</groupId>
          <artifactId>dependency-check-maven-plugin</artifactId>
          <version>1.1.0</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>

      </plugins>

    </pluginManagement>

    <plugins>

      <plugin>
        <groupId>com.cosium.code</groupId>
        <artifactId>git-code-format-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>format-code</id>
            <goals>
              <goal>format-code</goal>
            </goals>
            <phase>validate</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <version>[${maven.compiler.release},)</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>[${maven.version},)</version>
                </requireMavenVersion>
                <dependencyConvergence/>
                <reactorModuleConvergence/>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <executions>
          <!-- install in earlier than usual phase -->
          <execution>
            <goals>
              <goal>install</goal>
            </goals>
            <phase>integration-test</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <configuration>
          <addTestClassPath>true</addTestClassPath>
          <filterProperties>
            <localRepository>${project.build.directory}/it-repo</localRepository>
            <webserver.port>${deploy.webserver.port}</webserver.port>
          </filterProperties>
          <goals>
            <goal>verify</goal>
          </goals>
          <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
          <pomIncludes>
            <pomInclude>local/*/pom.xml</pomInclude>
            <pomInclude>remote/*/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <properties>
            <settings.security>${project.basedir}/src/it/settings-security.xml</settings.security>
          </properties>
          <settingsFile>src/it/settings.xml</settingsFile>
        </configuration>
        <executions>
          <execution>
            <id>install</id>
            <goals>
              <goal>install</goal>
            </goals>
            <phase>package</phase>
          </execution>
          <execution>
            <id>integration-tests</id>
            <goals>
              <goal>run</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <extractors>
            <extractor>java-annotations</extractor>
          </extractors>
          <goalPrefix>exists</goalPrefix>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <execution>
            <id>help-goal</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- publish site to github,
      1. mvn [clean install] site-deploy
      -->
      <plugin>
        <artifactId>maven-scm-publish-plugin</artifactId>
        <configuration>
          <content>target/site</content>
          <scmBranch>gh-pages</scmBranch>
          <tryUpdate>true</tryUpdate>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>publish-scm</goal>
            </goals>
            <phase>site-deploy</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.honton.chas</groupId>
        <artifactId>dependency-check-maven-plugin</artifactId>
        <version>1.1.0</version>
        <executions>
          <execution>
            <id>compile-scope</id>
            <goals>
              <goal>main</goal>
            </goals>
          </execution>
          <execution>
            <id>test-scope</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <ignoreDependencies>org.junit.jupiter:junit-jupiter</ignoreDependencies>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>true</skip>
            </configuration>
          </execution>
          <execution>
            <id>sign-artifacts</id>
            <goals>
              <goal>test</goal>
            </goals>
            <phase>pre-integration-test</phase>
            <configuration>
              <systemPropertyVariables>
                <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
                <projectGAV>${project.groupId}:${project.artifactId}:${project.version}</projectGAV>
              </systemPropertyVariables>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>reserve-network-port</id>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <configuration>
              <portNames>
                <portName>deploy.webserver.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>

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

      <plugin>
        <artifactId>maven-plugin-report-plugin</artifactId>
        <version>3.9.0</version>
        <configuration>
          <disableInternalJavadocLinkValidation>true</disableInternalJavadocLinkValidation>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.4.5</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>index</report>
              <report>team</report>
              <report>licenses</report>
              <report>dependency-info</report>
              <report>distribution-management</report>
              <report>ci-management</report>
              <report>scm</report>
              <report>summary</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

    </plugins>
  </reporting>

  <profiles>
    <!-- release to maven central
    mvn clean deploy -P release
    -->
    <profile>
      <id>release</id>
      <build>
        <plugins>

          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.7.0</version>
            <extensions>true</extensions>
            <configuration>
              <autoPublish>true</autoPublish>
              <publishingServerId>central</publishingServerId>
              <waitUntil>published</waitUntil>
            </configuration>
          </plugin>

        </plugins>

      </build>
    </profile>
  </profiles>

</project>
