<?xml version="1.0"?>
<!--
  ~ Copyright (c) 2010-2017 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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 - schema</name>
    <groupId>com.evolveum.midpoint.infra</groupId>
    <artifactId>schema</artifactId>
    <packaging>jar</packaging>
    <parent>
        <artifactId>infra</artifactId>
        <groupId>com.evolveum.midpoint</groupId>
        <version>3.7</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>
    <dependencies>
        <dependency>
            <groupId>com.evolveum.midpoint.infra</groupId>
            <artifactId>prism</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>com.evolveum.midpoint.infra</groupId>
            <artifactId>util</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf.xjc-utils</groupId>
            <artifactId>cxf-xjc-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-xjc</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>stax</groupId>
            <artifactId>stax-api</artifactId>
        </dependency>
        <dependency>
			<groupId>net.sf.jasperreports</groupId>
			<artifactId>jasperreports</artifactId>
		</dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations-java5</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.apache.cxf</groupId>-->
            <!--<artifactId>cxf-rt-transports-http-jetty</artifactId>-->
        <!--</dependency>-->
        <!--<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-jms</artifactId>
            <exclusions>
				<exclusion>
					<groupId>com.sun.xml.bind</groupId>
					<artifactId>jaxb-xjc</artifactId>
				</exclusion>
			</exclusions>
        </dependency> -->
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </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>3.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-legacy</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <!-- Used to pull XSD files from the JAR -->
                <groupId>com.evolveum.midpoint.tools</groupId>
                <artifactId>schema-dist-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <id>schemadist-prism</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>schemadist</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.evolveum.midpoint.infra</groupId>
                                    <artifactId>prism</artifactId>
                                    <version>${project.version}</version>
                                    <type>jar</type>
                                </artifactItem>
                            </artifactItems>
                            <translateSchemaLocation>false</translateSchemaLocation>
                            <includes>**/*.xsd,**/*.dtd,**/*.wsdl</includes>
                            <outputDirectory>${project.basedir}/target/additional-schemas/prism</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>${cxf.version}</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
                            <wsdlRoot>${project.directory}/src/main/resources/xml</wsdlRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>src/main/resources/xml/ns/private/webservice/modelService.wsdl</wsdl>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
                                        <extraarg>-xjc-XhashCode</extraarg>
                                        <extraarg>
                                            -xjc-XhashCode-hashCodeStrategyClass=com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy
                                        </extraarg>
                                        <extraarg>-xjc-Xequals</extraarg>
                                        <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/types-3</extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/annotation-3</extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/query-3</extraarg>
                                        <!-- 										<extraargs>-version</extraargs> -->
                                        <extraarg>-xjc-Xmidpoint</extraarg>
                                    </extraargs>
                                </wsdlOption>
                                <wsdlOption>
                                    <!-- Besides generating stub for report web service, this WSDL includes all the other XSD files
                                         we need to compile. This is the only way we found to generate equals and hashCode methods with CXF.
                                         If you find anything better please correct it.

                                         It would be nice if these two web services could be in one WSDL file. Unfortunately it's not possible,
                                         as they are in different target namespaces. -->
                                    <wsdl>src/main/resources/xml/ns/private/webservice/reportService.wsdl</wsdl>
                                    <catalog>${basedir}/src/compile/resources/jax-ws-catalog.xml</catalog>
                                    <extraargs>
                                        <extraarg>-impl</extraarg>
                                        <extraarg>-verbose</extraarg>
                                        <extraarg>-validate</extraarg>
                                        <extraarg>-xjc-Xts</extraarg>
                                        <extraarg>-xjc-XhashCode</extraarg>
                                        <extraarg>
                                            -xjc-XhashCode-hashCodeStrategyClass=com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy
                                        </extraarg>
                                        <extraarg>-xjc-Xequals</extraarg>
                                        <extraarg>
                                            -xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
                                        </extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/types-3</extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/annotation-3</extraarg>
                                        <extraarg>-nexclude</extraarg>
                                        <extraarg>http://prism.evolveum.com/xml/ns/public/query-3</extraarg>
                                        <!-- 										<extraargs>-version</extraargs> -->
                                        <extraarg>-xjc-Xmidpoint</extraarg>
                                    </extraargs>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.cxf.xjcplugins</groupId>
                        <artifactId>cxf-xjc-ts</artifactId>
                        <version>${cxf-xjc.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-basics</artifactId>
                        <version>0.6.3</version>
                    </dependency>
                    <dependency>
                        <groupId>com.evolveum.midpoint.tools</groupId>
                        <artifactId>xjc-plugin</artifactId>
                        <version>3.7</version>
                    </dependency>
                    <dependency>
		                <groupId>com.sun.xml.bind</groupId>
		                <artifactId>jaxb-xjc</artifactId>
		                <version>${jaxb-xjc.version}</version>
		            </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.evolveum.midpoint.infra</groupId>
                <artifactId>prism-maven-plugin</artifactId>
                <version>3.7</version>
                <configuration>
                    <schemaFiles>
                        <schemaFile>src/main/resources/xml/ns/public/common/common-3.xsd</schemaFile>
                        <schemaFile>src/main/resources/xml/ns/public/common/api-types-3.xsd</schemaFile>
                        <schemaFile>src/main/resources/xml/ns/public/connector/icf-1/resource-schema-3.xsd</schemaFile>
                        <schemaFile>src/main/resources/xml/ns/public/model/scripting/scripting-3.xsd</schemaFile>
                    </schemaFiles>
                    <catalogFiles>
                        <catalogFile>src/compile/resources/jax-ws-catalog.xml</catalogFile>
                        <catalogFile>src/main/resources/META-INF/schemas-in-this-module.xml</catalogFile>   <!-- nextCatalog doesn't work for unknown reason -->
                    </catalogFiles>
                    <templateDir>src/main/schemadoc/templates</templateDir>
                </configuration>
                <executions>
                    <execution>
                        <id>schemadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>schemadoc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>localization/**</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>localization/**</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>target/additional-schemas</directory>
            </resource>
        </resources>
    </build>
</project>

