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

    <parent>
        <groupId>org.basepom</groupId>
        <artifactId>basepom-oss</artifactId>
        <version>33</version>
    </parent>

    <groupId>org.basepom.maven</groupId>
    <artifactId>dependency-versions-check-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>3.0.0</version>

    <description>
        The dependency-versions-check plugin verifies that all resolved
        versions of artifacts are at least the versions specified by
        the project dependencies.

        The Maven dependency resolution process will substitute versions for
        the different artifacts in a dependency tree and sometimes chooses incompatible
        versions which leads to difficult to detect problems.

        This plugin resolves all dependencies and collects any requested version. It evaluates
        whether the resolved versions are compatible to the requested versions and reports possible
        conflicts.
    </description>

    <url>https://github.com/basepom/dependency-versions-check-maven-plugin</url>

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

    <scm>
        <connection>scm:git:git://github.com/basepom/dependency-versions-check-maven-plugin.git</connection>
        <developerConnection>scm:git:git://github.com/basepom/dependency-versions-check-maven-plugin.git</developerConnection>
        <url>https://github.com/basepom/dependency-versions-maven-check-plugin</url>
        <tag>dependency-versions-check-maven-plugin-3.0.0</tag>
    </scm>

    <developers>
        <developer>
            <id>tomdz</id>
            <name>Thomas Dudziak</name>
            <url>http://tomdz.org</url>
            <timezone>-8</timezone>
        </developer>
        <developer>
            <id>hgschmie</id>
            <name>Henning Schmiedehausen</name>
        </developer>
    </developers>

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/basepom/dependency-versions-check-maven-plugin/issues</url>
    </issueManagement>

    <properties>
        <project.build.systemJdk>11</project.build.systemJdk>
        <project.build.targetJdk>8</project.build.targetJdk>

        <dep.maven-api.version>3.6.3</dep.maven-api.version>
        <dep.maven-resolver.version>1.4.2</dep.maven-resolver.version>
        <dep.plexus.version>2.1.0</dep.plexus.version>
        <dep.plugin.plugin.version>3.6.0</dep.plugin.plugin.version>
        <dep.slf4j.version>1.7.30</dep.slf4j.version>
        <dep.guava.version>29.0-jre</dep.guava.version>
        <dep.junit5.version>5.7.0</dep.junit5.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.errorprone</groupId>
                <artifactId>error_prone_annotations</artifactId>
                <version>2.4.0</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- Maven provided dependencies -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${dep.maven-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${dep.plugin.plugin.version}</version>
            <scope>provided</scope>
        </dependency>

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

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

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

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

        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-component-annotations</artifactId>
            <version>${dep.plexus.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${dep.slf4j.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Maven APIs -->

        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-util</artifactId>
            <version>${dep.maven-resolver.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-shared-utils</artifactId>
            <version>3.3.3</version>
        </dependency>

        <!-- other dependencies -->

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${dep.guava.version}</version>
        </dependency>

        <!-- Test code -->

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

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

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${dep.plugin.plugin.version}</version>
                    <configuration>
                        <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.plexus</groupId>
                    <artifactId>plexus-component-metadata</artifactId>
                    <version>${dep.plexus.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <rules combine.children="append">
                        <requireProperty>
                            <property>project.build.targetJdk</property>
                            <regex>^8$</regex>
                            <regexMessage>Project must be built with JDK8 target.</regexMessage>
                        </requireProperty>
                    </rules>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-component-metadata</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-metadata</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <configuration>
                    <excludeRoots combine.children="append">
                        <excludeRoot>target/generated-sources/plugin</excludeRoot>
                    </excludeRoots>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.basepom.maven</groupId>
                <artifactId>duplicate-finder-maven-plugin</artifactId>
                <configuration>
                    <exceptions>
                        <!--
                            different parts of maven use different things to resolve dependencies.
                            Classworlds somehow sorts that out, but the duplicate finder does not know that.
                            So exclude this conflict.
                        -->
                        <exception>
                            <conflictingDependencies>
                                <dependency>
                                    <groupId>org.apache.maven.resolver</groupId>
                                    <artifactId>maven-resolver-util</artifactId>
                                </dependency>
                                <dependency>
                                    <groupId>org.eclipse.aether</groupId>
                                    <artifactId>aether-util</artifactId>
                                </dependency>
                            </conflictingDependencies>
                            <packages>
                                <package>org.eclipse.aether.util</package>
                            </packages>
                        </exception>
                    </exceptions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>plugin-test</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>${project.artifactId}</artifactId>
                        <version>${project.version}</version>
                        <configuration>
                            <transitiveConflictFailsBuild>false</transitiveConflictFailsBuild>
                            <directConflictFailsBuild>true</directConflictFailsBuild>
                            <fastResolution>false</fastResolution>
                            <conflictOnly>false</conflictOnly>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                    <goal>list</goal>
                                </goals>
                                <phase>validate</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
