<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  wcm.io
  %%
  Copyright (C) 2014 wcm.io
  %%
  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.
  #L%
  -->

<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>

  <parent>
    <groupId>io.wcm.maven</groupId>
    <artifactId>io.wcm.maven.parent</artifactId>
    <version>2.0.0</version>
    <relativePath />
  </parent>

  <groupId>io.wcm.maven.plugins</groupId>
  <artifactId>wcmio-content-package-maven-plugin</artifactId>
  <version>2.0.4</version>
  <packaging>maven-plugin</packaging>

  <name>Content Package Maven Plugin</name>
  <description>Upload and download content packages.</description>
  <url>${site.url}/${site.url.module.prefix}/</url>

  <scm>
    <connection>scm:git:https://github.com/wcm-io/io.wcm.maven.plugins.wcmio-content-package-maven-plugin.git</connection>
    <developerConnection>scm:git:https://github.com/wcm-io/io.wcm.maven.plugins.wcmio-content-package-maven-plugin.git</developerConnection>
    <url>https://github.com/wcm-io/io.wcm.maven.plugins.wcmio-content-package-maven-plugin</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <site.url.module.prefix>tooling/maven/plugins/wcmio-content-package-maven-plugin</site.url.module.prefix>
    <maven.version>3.0.5</maven.version>

    <!-- Enable reproducible builds -->
    <project.build.outputTimestamp>2022-01-27T08:58:24Z</project.build.outputTimestamp>

    <!-- Enable recording of coverage during execution of maven-invoker-plugin -->
    <jacoco.propertyName>invoker.mavenOpts</jacoco.propertyName>
    <jacoco.includes>org.jacoco.maven.*</jacoco.includes>
  </properties>

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

  <dependencies>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <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-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>io.wcm.tooling.commons</groupId>
      <artifactId>io.wcm.tooling.commons.crx-packmgr-helper</artifactId>
      <version>2.0.4</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>31.0.1-jre</version>
      <scope>compile</scope>
    </dependency>
    <!-- Add logging bridge to capture debug logging from Apache HTTP client 4 -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <version>1.7.32</version>
      <scope>compile</scope>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.35</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <goalPrefix>wcmio-content-package</goalPrefix>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <execution>
            <id>generated-helpmojo</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

       <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
              <goal>prepare-agent-integration</goal>
              <goal>report</goal>
              <goal>report-integration</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <configuration>
          <projectsDirectory>src/it</projectsDirectory>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <pomIncludes>
            <pomInclude>**/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <streamLogsOnFailures>true</streamLogsOnFailures>
          <extraArtifacts>
            <extraArtifact>org.jacoco:org.jacoco.agent:${jacoco-maven-plugin.version}:jar:runtime</extraArtifact>
          </extraArtifacts>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Set property ${releasedVersion.version} for current project - to be used in maven site -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>released-version</id>
            <goals>
              <goal>released-version</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <topSiteURL>${site.deploy.url}</topSiteURL>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-publish-plugin</artifactId>
        <configuration>
          <subDirectory>${site.url.module.prefix}</subDirectory>
          <skipDeletedFiles>true</skipDeletedFiles>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <requirements>
            <maven>${maven.version}</maven>
            <others>
              <property>
                <name>CRX</name>
                <value>2.3</value>
              </property>
            </others>
          </requirements>
        </configuration>
      </plugin>

    </plugins>
  </reporting>

  <distributionManagement>
    <site>
      <id>${site.deploy.id}</id>
      <url>${site.deploy.url}</url>
    </site>
  </distributionManagement>

</project>
