<?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>dev.metaschema.java</groupId>
        <artifactId>metaschema-framework</artifactId>
        <version>3.0.0.M2</version>
    </parent>

    <artifactId>metaschema-maven-plugin</artifactId>

    <packaging>maven-plugin</packaging>

    <name>Metaschema Maven Plugin</name>
    <description>A Maven plugin for generating Java bindings, and XML and JSON schemas.</description>

    <url>${site.url}/${project.artifactId}/</url>

    <distributionManagement>
        <site>
            <id>pages</id>
            <url>${site.url}/${project.artifactId}/</url>
        </site>
    </distributionManagement>

	<scm>
		<url>${scm.url}/tree/develop/metaschema-maven-plugin</url>
	  <tag>v3.0.0.M2</tag>
    </scm>

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

    <dependencies>
        <dependency>
			<groupId>${project.groupId}</groupId>
            <artifactId>metaschema-core</artifactId>
        </dependency>
        <dependency>
			<groupId>${project.groupId}</groupId>
            <artifactId>metaschema-databind</artifactId>
        </dependency>
        <dependency>
			<groupId>${project.groupId}</groupId>
            <artifactId>metaschema-schema-generator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${mojo.maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${mojo.maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${mojo.maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
            <version>${mojo.maven.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>file-management</artifactId>
            <version>3.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>${dependency.plexus-utils.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-build-api</artifactId>
            <version>${dependency.plexus-build-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources/maven-plugin</directory>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <!-- Add reads to allow accessing Maven API packages from the unnamed module.
                             This works around Maven's split package issues (maven-core and maven-artifact
                             both export overlapping packages) that prevent full JPMS compatibility. -->
                        <compilerArgs>
                            <arg>--add-reads</arg>
                            <arg>dev.metaschema.maven.plugin=ALL-UNNAMED</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <!-- Add reads to allow accessing Maven API packages from the unnamed module.
                             This mirrors the compiler configuration for JPMS compatibility. -->
                        <additionalJOptions>
                            <additionalJOption>--add-reads</additionalJOption>
                            <additionalJOption>dev.metaschema.maven.plugin=ALL-UNNAMED</additionalJOption>
                        </additionalJOptions>
                    </configuration>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-plugin-plugin</artifactId>
                                        <versionRange>[3.6.0,)</versionRange>
                                        <goals>
                                            <goal>descriptor</goal>
                                            <goal>helpmojo</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <goalPrefix>metaschema</goalPrefix>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>default-addPluginArtifactMetadata</id>
                        <phase>package</phase>
                        <goals>
                            <goal>addPluginArtifactMetadata</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-mojo</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                        <configuration>
                        	<outputDirectory>${project.build.directory}/generated-sources/maven-plugin</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-generated-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/maven-plugin</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-plugin-report-plugin</artifactId>
            <version>3.15.2</version>
            </plugin>
        </plugins>
    </reporting>
    <profiles>
        <profile>
            <id>run-its</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <configuration>
                            <debug>true</debug>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                            </pomIncludes>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <showErrors>true</showErrors>
                            <writeJunitReport>true</writeJunitReport>
                            <addTestClassPath>true</addTestClassPath>
                        </configuration>
                        <executions>
                            <execution>
                                <id>default-cli</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>