<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>com.monday-consulting.maven.plugins</groupId>
    <artifactId>fsm-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>2.0.2</version>
    <name>fsm-maven-plugin</name>
    <url>https://www.monday-consulting.com</url>

    <description>Maven plugin to generate XML descriptors for FirstSpirit modules.</description>
    <developers>
        <developer>
            <id>kassimhoelting</id>
            <name>Kassim Hoelting</name>
            <email>k.hoelting@monday-consulting.com</email>
            <organization>Monday Consulting GmbH</organization>
            <organizationUrl>http://www.monday-consulting.com</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Berlin</timezone>
        </developer>
        <developer>
            <id>mschel</id>
            <name>Marcel Scheland</name>
            <email>m.scheland@monday-consulting.com</email>
            <organization>Monday Consulting GmbH</organization>
            <organizationUrl>http://www.monday-consulting.com</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Berlin</timezone>
        </developer>
        <developer>
            <id>odegener</id>
            <name>Oliver Degener</name>
            <email>o.degener@monday-consulting.com</email>
            <organization>Monday Consulting GmbH</organization>
            <organizationUrl>http://www.monday-consulting.com</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
            <timezone>Europe/Berlin</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/monday-consulting/fsm-maven-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:monday-consulting/fsm-maven-plugin.git</developerConnection>
        <url>https://github.com/monday-consulting/fsm-maven-plugin</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus</id>
            <name>Sonatype Nexus snapshot repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus</id>
            <name>Sonatype Nexus release repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>

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

    <prerequisites>
        <maven>3.3.9</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <compile.source.jdk>11</compile.source.jdk>
        <compile.target.jdk>11</compile.target.jdk>

        <mavenVersion>3.3.9</mavenVersion>

        <junit.version>5.9.0</junit.version>

        <maven.plugin.plugin>3.6.4</maven.plugin.plugin>
        <maven.sonatype.nexus.plugin>1.6.13</maven.sonatype.nexus.plugin>
        <maven.jaxb2.plugin>1.5</maven.jaxb2.plugin>
        <maven.resources.plugin>3.3.1</maven.resources.plugin>
        <maven.gpg.plugin>3.1.0</maven.gpg.plugin>
        <maven.invoker.plugin>3.6.0</maven.invoker.plugin>
        <maven.clean.plugin>3.3.1</maven.clean.plugin>
        <maven.compiler.plugin>3.11.0</maven.compiler.plugin>
        <maven.jar.plugin>3.3.0</maven.jar.plugin>
        <maven.surefire.plugin>3.1.2</maven.surefire.plugin>
    </properties>

    <build>
        <pluginManagement>
            <plugins>

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

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin}</version>
                    <configuration>
                        <source>${compile.source.jdk}</source>
                        <target>${compile.target.jdk}</target>
                        <showWarnings>true</showWarnings>
                        <showDeprecation>true</showDeprecation>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin}</version>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Built-By>Monday Consulting GmbH</Built-By>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>${maven.jaxb2.plugin}</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                    <schemaFiles>fsm-plugin.xsd</schemaFiles>
                    <packageName>com.monday_consulting.maven.plugins.fsm.jaxb</packageName>
                    <clearOutputDir>true</clearOutputDir>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven.resources.plugin}</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/extra-resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources/</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven.plugin.plugin}</version>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin}</version>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>3.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>2.3.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-artifact-transfer</artifactId>
            <version>0.13.1</version>
        </dependency>
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>2.11.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.6.4</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.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>4.5.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin}</version>
                        <configuration>
                            <passphrase>${gpg.passphrase}</passphrase>
                            <keyname>${gpg.keyname}</keyname>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${maven.sonatype.nexus.plugin}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>sonatype-nexus</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>integrationTest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>${maven.invoker.plugin}</version>
                        <configuration>
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <streamLogs>true</streamLogs>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <!-- Debug Plugin Run -->
                            <!--
                            <mavenExecutable>${maven.home}/bin/mvnDebug</mavenExecutable>
                            -->
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.groovy</groupId>
                                <artifactId>groovy-xml</artifactId>
                                <version>4.0.13</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
