<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>org.ow2.authzforce</groupId>
        <artifactId>authzforce-ce-parent</artifactId>
        <version>8.2.0</version>
    </parent>
    <artifactId>authzforce-ce-xacml-model</artifactId>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>AuthzForce - Java model (JAXB) for OASIS XACML Core Specification. This project also includes the OASIS
        XACML schema, standard XACML identifiers as Java enums, and JAXB-related utilities.
    </description>
    <url>${project.url}</url>
    <scm>
        <connection>scm:git:${git.url.base}/parent.git</connection>
        <developerConnection>scm:git:${git.url.base}/parent.git</developerConnection>
        <tag>HEAD</tag>
        <url>${git.url.base}/parent</url>
    </scm>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>${artifactId.prefix}-xmlns-model</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <!--
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <scope>test</scope>
        </dependency>
        -->
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <header>license/alv2-header.txt</header>
                    <includes>
                        <include>src/main/java/**</include>
                        <include>src/test/java/**</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <id>format-sources-license</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>format-test-sources-license</id>
                        <phase>process-test-sources</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <configuration>
                    <verbose>false</verbose>
                    <extension>true</extension>
                    <strict>false</strict>
                    <useDependenciesAsEpisodes>true</useDependenciesAsEpisodes>
                    <args>
                        <arg>-XsimpleEquals</arg>
                        <arg>-XsimpleHashCode</arg>
                        <arg>-XtoString</arg>
                        <!-- Replace -Xvalue-constructor, -Ximmutable and -constructorAccess=default with -immutable from immutable-xjc-plugin after this issue is fixed:
                        https://github.com/sabomichal/immutable-xjc/issues/54 -->
                        <!--
                        <arg>-immutable</arg>
                        -->
                        <arg>-Xvalue-constructor</arg>
                        <arg>-Ximmutable</arg>
                        <arg>-constructorAccess=default</arg>
                    </args>
                    <plugins>
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-basics</artifactId>
                            <version>${jaxb2-basics.version}</version>
                        </plugin>
                        <!-- Replace jaxb2-value-constructor and jaxb2-rich-contract-plugin with immutable-xjc-plugin after this issue is fixed:
                        https://github.com/sabomichal/immutable-xjc/issues/54
                        Then get rid of immutable sub-classes of XACML-schema-derived classes (in authzforce-ce-core-pdp-api for instance).
                        -->
                        <!--
                        <plugin>
                            <groupId>com.github.sabomichal</groupId>
                            <artifactId>immutable-xjc-plugin</artifactId>
                            <version>1.6.2</version>
                        </plugin>
                        -->
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-value-constructor</artifactId>
                            <version>${jaxb2-value-constructor.version}</version>
                        </plugin>
                        <plugin>
                            <groupId>net.codesup.util</groupId>
                            <artifactId>jaxb2-rich-contract-plugin</artifactId>
                            <version>2.0.1</version>
                        </plugin>
                    </plugins>
                    <bindingDirectory>src/main/jaxb</bindingDirectory>
                    <catalog>src/main/jaxb/catalog.xml</catalog>
                    <schemaDirectory>src/main/resources</schemaDirectory>
                    <schemaIncludes>
                        <include>xacml-core-v3-schema-wd-17.xsd</include>
                    </schemaIncludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!--
         Issues porting the maven-jaxb2-plugin to Java 11:
         - Plugin dev seems dead: https://github.com/highsource/maven-jaxb2-plugin/issues/193
         - Not compatible with new Jakarta XML Binding (Starting with 3.0.0, jakarta.xml.bind replaces javax.xml.bind packages): https://github.com/highsource/maven-jaxb2-plugin/issues/191
         - Not compatible with JDK 11+: https://github.com/highsource/maven-jaxb2-plugin/issues/190, https://github.com/highsource/maven-jaxb2-plugin/issues/167

         Alternative: mojohaus/jaxb2-maven-plugin
         Supporting new Jakarta-style JAXB API: https://github.com/mojohaus/jaxb2-maven-plugin/issues/138

        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        -->
            <!--
            <plugin>

                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.5.0</version>
                <configuration>
                    <verbose>true</verbose>
                    <extension>true</extension>
                    <strict>true</strict>
                    <laxSchemaValidation>true</laxSchemaValidation>
                    <sources>
                        <source>src/main/resources/xml.xsd</source>
                    </sources>
                    <xsdPathWithinArtifact>.</xsdPathWithinArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    -->
            <!-- Starting with Jaxb 3.0.0, package names have been changed to jakarta.xml.bind-->
            <!--
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>rename-old-jaxb-package-names-for-java-11</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <replace token= "javax.xml.bind" value="jakarta.xml.bind" dir="${project.basedir}/target/generated-sources/xjc">
                                    <include name="**/*.java" />
                                  </replace>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>false</skipTests>
                    <systemPropertyVariables>
                        <javax.xml.accessExternalSchema>all</javax.xml.accessExternalSchema>
                    </systemPropertyVariables>
                    <environmentVariables>
                        <!-- Test environment variable for DefaultEnvironmentPropertiesTest class -->
                        <AUTHZFORCE_DATA_DIR>/tmp/authzforce</AUTHZFORCE_DATA_DIR>
                    </environmentVariables>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <!-- verbosity level from 0 to 10 (10 is the most detailed), or -1 for debug. More info: http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html -->
                            <value>3</value>
                        </property>
                    </properties>
                    <includes>
                        <include>**/MainTest.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>