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

    <parent>
        <groupId>com.weedow</groupId>
        <artifactId>schema-org-parent</artifactId>
        <version>0.2.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>schema-org-generator-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>

    <name>schema-org-generator-maven-plugin</name>
    <description>Maven plugin to generate Java models from Schema.org</description>
    <url>https://github.com/Kobee1203/schema-org-java</url>

    <properties>
        <maven-plugin-api.version>3.8.6</maven-plugin-api.version>
        <maven-plugin-annotations.version>3.7.0</maven-plugin-annotations.version>
        <maven-project.version>2.2.1</maven-project.version>

        <maven-plugin-plugin.version>3.7.0</maven-plugin-plugin.version>
        <maven-site-plugin.version>3.12.1</maven-site-plugin.version>
        <maven-invoker-plugin.version>3.3.0</maven-invoker-plugin.version>
        <mrm-maven-plugin.version>1.4.1</mrm-maven-plugin.version>
        <maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
        <maven-it-extension.version>0.11.0</maven-it-extension.version>

        <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/../report/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
    </properties>

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

        <dependency>
            <groupId>com.weedow</groupId>
            <artifactId>schema-org-generator</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

        <!-- Tests Dependencies -->

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.soebes.itf.jupiter.extension</groupId>
            <artifactId>itf-jupiter-extension</artifactId>
            <version>${maven-it-extension.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.soebes.itf.jupiter.extension</groupId>
            <artifactId>itf-assertj</artifactId>
            <version>${maven-it-extension.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.8.6</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
            </testResource>
            <testResource>
                <directory>src/test/resources-its</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

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

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin-plugin.version}</version>
                <executions>
                    <execution>
                        <id>generate-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generated-helpmojo</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
            https://github.com/khmarbaise/maven-it-extension
            https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html
            -->
            <plugin>
                <groupId>com.soebes.itf.jupiter.extension</groupId>
                <artifactId>itf-maven-plugin</artifactId>
                <version>${maven-it-extension.version}</version>
                <executions>
                    <execution>
                        <id>installing</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>install</goal>
                            <goal>resources-its</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M7</version>
                <configuration>
                    <!-- ! currently needed to run integration tests. -->
                    <systemProperties>
                        <maven.version>${maven.version}</maven.version>
                        <maven.home>${maven.home}</maven.home>
                    </systemProperties>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>${maven-invoker-plugin.version}</version>
                <configuration>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                </configuration>
                <executions>
                    <execution>
                        <id>prepare-integration-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>install</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <addTestClassPath>true</addTestClassPath>
                            <streamLogs>true</streamLogs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${maven-antrun-plugin.version}</version>
                <executions>
                    <execution>
                        <id>cleanup-local-integration-repo</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <replaceregexp match="\$\{revision\}" replace="${project.version}" flags="g" byline="true">
                                    <fileset dir="${project.build.directory}/local-repo/com/weedow/" includes="**/*.pom" />
                                </replaceregexp>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>mrm-maven-plugin</artifactId>
                <version>${mrm-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>start</goal>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repositories>
                        <mockRepo>
                            <source>src/it-repo</source>
                        </mockRepo>
                        <localRepo>
                            <source>${project.build.directory}/local-repo</source>
                        </localRepo>
                        <proxyRepo />
                    </repositories>
                </configuration>
            </plugin>
            -->
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
                                    <includeScope>runtime</includeScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>