<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2010-2017 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<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>
    <name>midPoint Infrastructure - pure JAXB schema</name>
    <groupId>com.evolveum.midpoint.infra</groupId>
    <artifactId>schema-pure-jaxb</artifactId>
    <packaging>jar</packaging>
    <parent>
        <artifactId>infra</artifactId>
        <groupId>com.evolveum.midpoint</groupId>
        <version>4.0.3</version>
    </parent>
    <scm>
        <connection>https://github.com/Evolveum/midpoint.git</connection>
        <developerConnection>git@github.com:Evolveum/midpoint.git</developerConnection>
        <url>https://fisheye.evolveum.com/browse/midPoint</url>
    </scm>
    <distributionManagement>
      <repository>
        <id>evolveum-nexus</id>
        <name>Internal Releases</name>
        <url>https://nexus.evolveum.com/nexus/content/repositories/releases/</url>
      </repository>
      <snapshotRepository>
        <id>evolveum-nexus</id>
        <name>Internal Releases</name>
        <url>https://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
      </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
    </dependency>
    <!--<dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>-->

        <!-- This is needed only for equals methods. Simplify it now
        <dependency>
            <groupId>com.evolveum.midpoint.infra</groupId>
            <artifactId>util</artifactId>
            <version>2.3</version>
        </dependency>         -->
        <!--  Testing dependecies  -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.evolveum.midpoint.tools</groupId>
            <artifactId>test-ng</artifactId>
            <version>4.0.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
          </dependency>
    </dependencies>
    <build>
        <resources>
            <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>target/midpoint-schema</directory>
        </resource>
        </resources>
        <plugins>
            <plugin>
                <!-- Used to pull XSD files from the JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-schema-files</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.evolveum.midpoint.infra</groupId>
                                    <artifactId>schema</artifactId>
                                    <version>${project.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                            <includes>**/*.xsd,**/*.dtd</includes>
                            <excludes>prism-impl/xml/ns/test/**,xml/ns/test/**</excludes>
                            <outputDirectory>${project.basedir}/target/midpoint-schema</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>jaxb2-jdk-11</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>11</jdk>
            </activation>
            <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.5.0</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sources>
                        <source>${project.basedir}/target/midpoint-schema</source>
                    </sources>
                    <catalog>${basedir}/src/compile/resources/catalog.xml</catalog>
                    <laxSchemaValidation>true</laxSchemaValidation>
                    <verbose>false</verbose>
                    <xjcSourceExcludeFilters>
                        <!-- This is a workaround for xjc bug described here: https://java.net/projects/jaxb/lists/users/archive/2005-12/message/33 -->
                        <!-- It presents itself on Windows machines. -->
                        <!-- We simply exclude any imported files. So, after a new imported file is present, please add it into this list. -->
                        <filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
                            <patterns>
                                <pattern>annotation-3\.xsd</pattern>
                                <pattern>query-3\.xsd</pattern>
                                <pattern>\\types-3\.xsd</pattern>      <!-- to match types but not api-types -->
                                <pattern>/types-3\.xsd</pattern>       <!-- to match types but not api-types -->
                                <pattern>common-.*\.xsd</pattern>
                                <pattern>scripting-3\.xsd</pattern>
                                <pattern>resource-schema-3\.xsd</pattern>
                            </patterns>
                        </filter>
                    </xjcSourceExcludeFilters>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.sun.xsom</groupId>
                        <artifactId>xsom</artifactId>
                        <version>20190730e</version>
                    </dependency>
                    <dependency>
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                        <version>2.12.0</version>
                    </dependency>
                    <dependency>
                        <groupId>xalan</groupId>
                        <artifactId>xalan</artifactId>
                        <version>2.7.2</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
        </profile>
        <profile>
            <id>jaxb2-jdk-8</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>2.5.0</version>
                <executions>
                    <execution>
                        <id>xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sources>
                        <source>${project.basedir}/target/midpoint-schema</source>
                    </sources>
                    <catalog>${basedir}/src/compile/resources/catalog.xml</catalog>
                    <laxSchemaValidation>true</laxSchemaValidation>
                    <verbose>false</verbose>
                    <xjcSourceExcludeFilters>
                        <!-- This is a workaround for xjc bug described here: https://java.net/projects/jaxb/lists/users/archive/2005-12/message/33 -->
                        <!-- It presents itself on Windows machines. -->
                        <!-- We simply exclude any imported files. So, after a new imported file is present, please add it into this list. -->
                        <filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
                            <patterns>
                                <pattern>annotation-3\.xsd</pattern>
                                <pattern>query-3\.xsd</pattern>
                                <pattern>\\types-3\.xsd</pattern>      <!-- to match types but not api-types -->
                                <pattern>/types-3\.xsd</pattern>       <!-- to match types but not api-types -->
                                <pattern>common-.*\.xsd</pattern>
                                <pattern>scripting-3\.xsd</pattern>
                                <pattern>resource-schema-3\.xsd</pattern>
                            </patterns>
                        </filter>
                    </xjcSourceExcludeFilters>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                        <version>2.12.0</version>
                    </dependency>
                    <dependency>
                        <groupId>xalan</groupId>
                        <artifactId>xalan</artifactId>
                        <version>2.7.2</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
        </profile>
    </profiles>
</project>

