<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>int.esa.ccsds.mo</groupId>
  <artifactId>POM</artifactId>
  <version>2</version>
  <packaging>pom</packaging>
  <name>ESA MO POM</name>
  <description>ESA top level POM for CCSDS MO based artifacts</description>
  <url>http://github.com/esa/CCSDS_MO_POM</url>
  
  <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.github.com/esa/CCSDS_MO_POM/master/LICENCE.md</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:esa/CCSDS_MO_POM.git</connection>
    <developerConnection>scm:git:git@github.com:esa/CCSDS_MO_POM.git</developerConnection>
    <url>https://github.com/esa/CCSDS_MO_POM</url>
  </scm>
  
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/esa/CCSDS_MO_POM/issues</url>
  </issueManagement>
  
  <distributionManagement>
    <site>
      <id>Sonatype</id>
      <url>https://oss.sonatype.org/</url>
    </site>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>
  
  <developers>
    <developer>
      <id>SamCooper</id>
      <name>Sam Cooper</name>
      <email>sam.cooper@scisys.co.uk</email>
      <url>https://github.com/SamCooper</url>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <ccsds.specification.version>1.0.1</ccsds.specification.version>
    <esa.stubgen.version>1.1</esa.stubgen.version>
    <esa.api.version>1.0.1</esa.api.version>
    <esa.gen.encoder.version>1.0.1</esa.gen.encoder.version>
    <esa.string.encoder.version>1.0.1</esa.string.encoder.version>
    <esa.binary.encoder.version>1.0.1</esa.binary.encoder.version>
    <esa.binary_fixed.encoder.version>1.0</esa.binary_fixed.encoder.version>
    <esa.binary_split.encoder.version>1.0</esa.binary_split.encoder.version>
    <esa.gen.transport.version>1.0.1</esa.gen.transport.version>
    <esa.rmi.transport.version>1.0.1</esa.rmi.transport.version>
    <esa.support.lib.mal.version>1.0</esa.support.lib.mal.version>
    <esa.support.lib.com.version>1.0</esa.support.lib.com.version>
    <ccsds.specification.download.skip>true</ccsds.specification.download.skip>
    <ccsds.specification.download.group>${project.groupId}</ccsds.specification.download.group>
    <ccsds.specification.download.artifact>MOXML</ccsds.specification.download.artifact>
    <ccsds.specification.download.version>${ccsds.specification.version}</ccsds.specification.download.version>
    <ccsds.specification.download.directory>${project.build.directory}/xml</ccsds.specification.download.directory>
    <ccsds.specification.download.filter></ccsds.specification.download.filter>
    <ccsds.specification.download.ref-skip>true</ccsds.specification.download.ref-skip>
    <ccsds.specification.download.ref-group>${project.groupId}</ccsds.specification.download.ref-group>
    <ccsds.specification.download.ref-artifact>MOXML</ccsds.specification.download.ref-artifact>
    <ccsds.specification.download.ref-version>${ccsds.specification.version}</ccsds.specification.download.ref-version>
    <ccsds.specification.download.ref-directory>${project.build.directory}/xml-ref</ccsds.specification.download.ref-directory>
    <ccsds.specification.download.ref-filter>**/ServiceDefMAL.xml</ccsds.specification.download.ref-filter>
    <esa.stubgen.xmlDirectory>${project.build.directory}/xml</esa.stubgen.xmlDirectory>
    <esa.stubgen.xmlRefDirectory>${project.build.directory}/xml-ref/xml</esa.stubgen.xmlRefDirectory>
  </properties>
  
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>API_MAL</artifactId>
        <version>${esa.api.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>API_COM</artifactId>
        <version>${esa.api.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>MAL_IMPL</artifactId>
        <version>${esa.api.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ENCODING_GEN</artifactId>
        <version>${esa.gen.encoder.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ENCODING_STRING</artifactId>
        <version>${esa.string.encoder.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ENCODING_BINARY</artifactId>
        <version>${esa.binary.encoder.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ENCODING_BINARY_FIXED</artifactId>
        <version>${esa.binary_fixed.encoder.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>ENCODING_BINARY_SPLIT</artifactId>
        <version>${esa.binary_split.encoder.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>TRANSPORT_GEN</artifactId>
        <version>${esa.gen.transport.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>TRANSPORT_RMI</artifactId>
        <version>${esa.rmi.transport.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>SUPPORT_LIB_MAL</artifactId>
        <version>${esa.support.lib.mal.version}</version>
      </dependency>
      <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>SUPPORT_LIB_COM</artifactId>
        <version>${esa.support.lib.com.version}</version>
      </dependency>
      <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.12</version>
      </dependency>
      <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.2.7</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
  
  <build>
    <resources>
      <resource>
        <directory>${basedir}</directory>
        <includes>
          <include>LICENCE.md</include>
        </includes>
      </resource>
    </resources>
    
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.3.1</version>
          <executions>
            <execution>
              <id>enforce</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <DependencyConvergence/>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.9</version>
          <executions>
            <execution>
              <id>download-xml</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>unpack</goal>
              </goals>
              <configuration>
                <skip>${ccsds.specification.download.skip}</skip>
                <artifactItems>
                  <artifactItem>
                    <groupId>${ccsds.specification.download.group}</groupId>
                    <artifactId>${ccsds.specification.download.artifact}</artifactId>
                    <version>${ccsds.specification.download.version}</version>
                    <type>jar</type>
                    <overWrite>false</overWrite>
                    <outputDirectory>${ccsds.specification.download.directory}</outputDirectory>
                    <includes>${ccsds.specification.download.filter}</includes>
                  </artifactItem>
                </artifactItems>
                <overWriteSnapshots>true</overWriteSnapshots>
              </configuration>
            </execution>
            <execution>
              <id>download-ref-xml</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>unpack</goal>
              </goals>
              <configuration>
                <skip>${ccsds.specification.download.ref-skip}</skip>
                <artifactItems>
                  <artifactItem>
                    <groupId>${ccsds.specification.download.ref-group}</groupId>
                    <artifactId>${ccsds.specification.download.ref-artifact}</artifactId>
                    <version>${ccsds.specification.download.ref-version}</version>
                    <type>jar</type>
                    <overWrite>false</overWrite>
                    <outputDirectory>${ccsds.specification.download.ref-directory}</outputDirectory>
                    <includes>${ccsds.specification.download.ref-filter}</includes>
                  </artifactItem>
                </artifactItems>
                <overWriteSnapshots>true</overWriteSnapshots>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.9.1</version>
          <executions>
            <execution>
              <id>add-source</id>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>${project.build.directory}/generated-sources/stub</source>
                </sources>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>int.esa.ccsds.mo</groupId>
          <artifactId>StubGenerator</artifactId>
          <version>${esa.stubgen.version}</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>generate</goal>
              </goals>
              <configuration>
                <targetLanguages>
                  <targetLanguage>Java</targetLanguage>
                </targetLanguages>
                <xmlDirectory>${esa.stubgen.xmlDirectory}</xmlDirectory>
                <xmlRefDirectory>${esa.stubgen.xmlRefDirectory}</xmlRefDirectory>
              </configuration>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>int.esa.ccsds.mo</groupId>
              <artifactId>StubGenerator_Java</artifactId>
              <version>${esa.stubgen.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
            <source>1.5</source>
            <target>1.5</target>
            <!--            <compilerArgument>-Xlint:unchecked</compilerArgument>-->
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <archive>
              <manifest>
                <mainClass>${assembly.mainClass}</mainClass>
              </manifest>
            </archive>
            <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
          </configuration>
          <executions>
            <execution>
              <id>make-assembly</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.4</version>
          <configuration>
            <reportPlugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.1</version>
              </plugin>
            </reportPlugins>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>jaxb2-maven-plugin</artifactId>
          <version>1.6</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.4</version>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>deploy</phase>
              <goals>
                <goal>jar-no-fork</goal>
              </goals> 
            </execution>
          </executions>
        </plugin>
        <plugin> 
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId> 
          <version>2.10.1</version>
          <executions> 
            <execution> 
              <id>attach-javadocs</id>
              <phase>deploy</phase>
              <goals>
                <goal>jar</goal>
              </goals> 
            </execution> 
          </executions> 
        </plugin>
        <plugin> 
          <!-- explicitly define maven-deploy-plugin after other to force exec order -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId> 
          <version>2.8.2</version>
          <executions> 
            <execution> 
              <id>deploy</id>
              <phase>deploy</phase>
              <goals>
                <goal>deploy</goal>
              </goals> 
            </execution> 
          </executions> 
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.5</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>      
      </plugins>
    </pluginManagement>
  </build>


  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
          </plugin>
          <plugin> 
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId> 
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
