<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.github.codemonstur</groupId>
    <artifactId>maven-check-license</artifactId>
    <version>1.2.0</version>
    <packaging>maven-plugin</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>A maven plugin for checking licenses of dependencies</description>
    <url>https://github.com/codemonstur/maven-check-license</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/codemonstur/maven-check-license.git</connection>
        <developerConnection>scm:git:https://github.com/codemonstur/maven-check-license.git</developerConnection>
        <url>https://github.com/codemonstur/maven-check-license</url>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <id>codemonstur</id>
            <name>Jurgen Voorneveld</name>
            <email>jegvoorneveld@gmail.com</email>
        </developer>
    </developers>

    <properties>
        <module.name>com.github.codemonstur.maven-check-license</module.name>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <maven.version>3.6.3</maven.version>

        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.release>17</maven.compiler.release>

        <version.library.maven>3.9.6</version.library.maven>
        <version.library.maven-annotations>3.13.1</version.library.maven-annotations>
        <version.library.junit>5.10.1</version.library.junit>
        <version.library.mockito>5.23.0</version.library.mockito>

        <version.plugin.license-check>1.0.0</version.plugin.license-check>
        <version.plugin.check-cves>1.0.2</version.plugin.check-cves>
        <version.plugin.surefire>3.5.5</version.plugin.surefire>
        <version.plugin.plugin>3.13.1</version.plugin.plugin>
        <version.plugin.nexus-staging>1.7.0</version.plugin.nexus-staging>
        <version.plugin.source>3.3.0</version.plugin.source>
        <version.plugin.javadoc>3.12.0</version.plugin.javadoc>
        <version.plugin.gpg>3.2.8</version.plugin.gpg>
        <version.plugin.publish>0.10.0</version.plugin.publish>
    </properties>

    <build>
        <finalName>${project.artifactId}</finalName>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.plugin.surefire}</version>
                <configuration>
                    <argLine>-Xshare:off</argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${version.plugin.plugin}</version>
                <configuration>
                    <goalPrefix>hc:</goalPrefix>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${version.plugin.source}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${version.plugin.javadoc}</version>
                <configuration>
                    <doclint>all,-missing</doclint>
                </configuration>
                <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>
                <version>${version.plugin.gpg}</version>
                <configuration>
                    <passphrase>${gpg.passphrase}</passphrase>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals><goal>sign</goal></goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${version.plugin.publish}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>true</autoPublish>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${version.library.maven}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${version.library.maven}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${version.library.maven-annotations}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${version.library.junit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${version.library.mockito}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>licenses</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>

                    <plugin>
                        <groupId>com.github.codemonstur</groupId>
                        <artifactId>maven-check-license</artifactId>
                        <version>${version.plugin.license-check}</version>
                        <executions>
                            <execution><goals><goal>check-licenses</goal></goals></execution>
                        </executions>
                        <configuration>
                            <rules>
                                <rule>url:equal:http://www.opensource.org/licenses/bsd-license.php</rule>
                                <rule>url:equal:http://opensource.org/licenses/BSD-3-Clause</rule>
                                <rule>url:regex:(http|https)://(www.)?opensource.org/licenses/(MIT|mit-license.php)</rule>
                                <rule>name:equal:The MIT License</rule>
                                <rule>name:regex:(The )?Apache(\s|-)(Software )?(License |License, )?(Version |version )?2\.0</rule>
                                <rule>url:equal:http://www.eclipse.org/org/documents/edl-v10.php</rule>
                                <rule>url:equal:http://www.mozilla.org/MPL/2.0/</rule>
                            </rules>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

        <profile>
            <id>security</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.codemonstur</groupId>
                        <artifactId>maven-check-cves</artifactId>
                        <version>${version.plugin.check-cves}</version>
                        <executions>
                            <execution><goals><goal>check</goal></goals></execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>