<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>
    <groupId>org.jfrog.buildinfo</groupId>
    <artifactId>artifactory-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>3.2.3</version>
    <name>Artifactory Maven plugin</name>
    <url>https://www.jfrog.com/confluence/display/JFROG/Maven+Artifactory+Plugin</url>
    <description>A Maven plugin to resolve artifacts from Artifactory, deploy artifacts to Artifactory, capture and
        publish build info.
    </description>

    <properties>
        <maven.min.version>3.3.9</maven.min.version>
        <buildinfo.version>2.26.4</buildinfo.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <skipITs>true</skipITs>
    </properties>

    <repositories>
        <repository>
            <id>releases</id>
            <name>jfrog-dependencies</name>
            <url>https://oss.jfrog.org/artifactory/jfrog-dependencies</url>
        </repository>
        <repository>
            <snapshots/>
            <id>snapshots</id>
            <name>libs-snapshot</name>
            <url>https://oss.jfrog.org/artifactory/libs-snapshot</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>releases</id>
            <name>jfrog-dependencies</name>
            <url>https://oss.jfrog.org/artifactory/jfrog-dependencies</url>
        </pluginRepository>
        <pluginRepository>
            <snapshots/>
            <id>snapshots</id>
            <name>plugins-snapshot</name>
            <url>https://oss.jfrog.org/artifactory/plugins-snapshot</url>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>

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

    <organization>
        <name>JFrog</name>
        <url>https://jfrog.com</url>
    </organization>

    <scm>
        <connection>scm:git:git://github.com/jfrog/artifactory-maven-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:jfrog/artifactory-maven-plugin.git</developerConnection>
        <url>https://github.com/jfrog/artifactory-maven-plugin</url>
    </scm>

    <developers>
        <developer>
            <name>JFrog</name>
            <email>eco-system@jfrog.com</email>
        </developer>
    </developers>

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

    <issueManagement>
        <system>jira</system>
        <url>https://www.jfrog.com/jira/browse/NMAP</url>
    </issueManagement>

    <dependencies>
        <!--Maven Core-->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.min.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.min.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <version>${maven.min.version}</version>
        </dependency>

        <!--Build Info-->
        <dependency>
            <groupId>org.jfrog.buildinfo</groupId>
            <artifactId>build-info-extractor</artifactId>
            <version>${buildinfo.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jfrog.buildinfo</groupId>
            <artifactId>build-info-api</artifactId>
            <version>${buildinfo.version}</version>
        </dependency>

        <!--Apache Commons-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.11</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.4</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.9.0</version>
        </dependency>

        <!--Annotations-->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.6.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-component-annotations</artifactId>
            <version>2.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.12</version>
            <scope>provided</scope>
        </dependency>

        <!--Tests-->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-compat</artifactId>
            <version>${maven.min.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-testing</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <version>3.3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-verifier</artifactId>
            <version>1.7.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>2.11.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-guava</artifactId>
            <version>2.11.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-netty</artifactId>
            <version>5.11.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.6.0</version>
            </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>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--Unit tests-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <excludes>
                        <exclude>**/*ITest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!--Integration tests-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <systemPropertyVariables>
                        <!--Set MockServer log level to WARNING-->
                        <mockserver.logLevel>WARN</mockserver.logLevel>
                    </systemPropertyVariables>
                    <includes>
                        <include>**/*ITest.java</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <activation>
                <!--
                    In order to allow to install the plugin before using it in deployment,
                    we activate the 'release' profile only if Artifactory URL is specified.
                -->
                <property>
                    <name>ARTIFACTORY_URL</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jfrog.buildinfo</groupId>
                        <artifactId>artifactory-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>build-info</id>
                                <goals>
                                    <goal>publish</goal>
                                </goals>
                                <configuration>
                                    <publisher>
                                        <contextUrl>${ARTIFACTORY_URL}</contextUrl>
                                        <username>${ARTIFACTORY_USERNAME}</username>
                                        <password>${ARTIFACTORY_PASSWORD}</password>
                                        <repoKey>oss-release-local</repoKey>
                                        <snapshotRepoKey>oss-snapshot-local</snapshotRepoKey>
                                    </publisher>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Use this profile to sign and upload the JAR to Maven Central -->
            <id>upload-to-central</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <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>
        </profile>
    </profiles>
</project>
