<?xml version="1.0" encoding="UTF-8"?>

<!--
    Licensed under the European Space Agency Public License, Version 2.0
    You may not use this file except in compliance with the License.

    Except as expressly set forth in this License, the Software is provided to
    You on an "as is" basis and without warranties of any kind, including without
    limitation merchantability, fitness for a particular purpose, absence of
    defects or errors, accuracy or non-infringement of intellectual property rights.
 
    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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
  
    <parent>
        <groupId>int.esa.ccsds.mo</groupId>
        <artifactId>parent</artifactId>
        <version>12.0</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>
  
    <artifactId>generator-interfaces</artifactId>
    <version>12.0</version>
    <packaging>jar</packaging>
  
    <name>ESA MO API Generator - Interfaces</name>
  
    <organization>
        <name>ESA</name>
        <url>http://www.esa.int</url>
    </organization>
  
    <licenses>
        <license>
            <name>The European Space Agency Public License, Version 2.0</name>
            <url>https://raw.githubusercontent.com/esa/mo-services-java/master/LICENCE.md</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:esa/mo-services-java.git</connection>
        <developerConnection>scm:git:git@github.com:esa/mo-services-java.git</developerConnection>
        <url>https://github.com/esa/mo-services-java</url>
    </scm>
  
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/esa/mo-services-java/issues</url>
    </issueManagement>
  
    <properties>
        <ccsds.specification.download.skip>false</ccsds.specification.download.skip>
        <ccsds.specification.download.directory>${project.build.directory}</ccsds.specification.download.directory>
        <ccsds.specification.download.filter>**/ServiceSchema-v003-backwards-compatible-hybrid.xsd,**/COMSchema.xsd</ccsds.specification.download.filter>
    </properties>

    <dependencies>
        <!-- The 2 dependencies below are needed otherwise the compilation, when
        executed as threaded, will have a race condition and therefore might fail -->
        <dependency>
            <groupId>int.esa.ccsds.mo</groupId>
            <artifactId>xml-ccsds-mo-prototypes</artifactId>
            <version>12.0</version>
        </dependency>
        <dependency>
            <groupId>int.esa.ccsds.mo</groupId>
            <artifactId>xml-ccsds-mo-standards</artifactId>
            <version>12.0</version>
        </dependency>
        <!-- The dependencies below are needed for Java 9 and higher -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>
  
    <build>
        <resources>
            <resource>
                <directory>${basedir}/..</directory>
                <includes>
                    <include>LICENCE.md</include>
                </includes>
            </resource>
        </resources>
    
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-mo-xsd</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
                            <clearOutputDir>false</clearOutputDir>
                            <noPackageLevelAnnotations>true</noPackageLevelAnnotations>
                            <packageName>esa.mo.xsd</packageName>
                            <sources>
                                <source>${project.build.directory}/xsd</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>process-w3c-xsd</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                        <configuration>
                            <clearOutputDir>false</clearOutputDir>
                            <packageName>w3c.xsd</packageName>
                            <laxSchemaValidation>true</laxSchemaValidation>
                            <sources>
                                <source>${project.build.directory}/xsd-ref/XMLSchema.xsd</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/stub</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>2.0.2</version>
                <executions>
                    <execution>
                        <id>get-xsd</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <url>http://www.w3.org/2009/XMLSchema</url>
                            <fromFile>XMLSchema.xsd</fromFile>
                            <toDir>${project.build.directory}/xsd-ref</toDir>
                        </configuration>
                    </execution>
                    <execution>
                        <id>get-dtd</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <url>http://www.w3.org/2009/XMLSchema</url>
                            <fromFile>XMLSchema.dtd</fromFile>
                            <toDir>${project.build.directory}/xsd-ref</toDir>
                        </configuration>
                    </execution>
                    <execution>
                        <id>get-dtd-types</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>download-single</goal>
                        </goals>
                        <configuration>
                            <url>http://www.w3.org/2009/XMLSchema</url>
                            <fromFile>datatypes.dtd</fromFile>
                            <toDir>${project.build.directory}/xsd-ref</toDir>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
  
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin> 
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId> 
                        <executions> 
                            <execution> 
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <excludePackageNames>w3c.xsd</excludePackageNames>
                                </configuration>
                            </execution>
                        </executions> 
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
