<?xml version="1.0" encoding="UTF-8"?>
<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>se.sunet.ati</groupId>
    <artifactId>ati-parent</artifactId>
    <version>2</version>
    <relativePath>../ati-parent/pom.xml</relativePath>
  </parent>

  <groupId>se.sunet.ati.ladok</groupId>
  <artifactId>ati-ladok3-dto</artifactId>
  <version>0.75</version>
  <packaging>bundle</packaging>

  <name>ATI Ladok 3 Data Transfer Objects</name>
  <description>Ladok 3 Data Transfer Objects as an OSGi-bundle. Generated from schemas provided by the Ladok 3 project.</description>
  <url>https://github.com/uppsala-university/ati-ladok3-dto</url>

  <scm>
    <connection>scm:git:https://github.com/uppsala-university/ati-ladok3-dto.git</connection>
    <developerConnection>scm:git:https://github.com/uppsala-university/ati-ladok3-dto.git</developerConnection>
    <url>https://github.com/uppsala-university/ati-ladok3-dto</url>
    <tag>ati-ladok3-dto-0.75</tag>
  </scm>

  <properties>
    <cxf.version>3.0.5</cxf.version>
  </properties>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/target/generated/src/main/java</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-xjc-plugin</artifactId>
        <version>${cxf.version}</version>
        <configuration>
          <extensions>
            <!-- Getters with default values if given in schema -->
            <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:${cxf.version}</extension>

            <!-- Insert toString method for DTOs -->
            <extension>org.apache.cxf.xjcplugins:cxf-xjc-ts:${cxf.version}</extension>
          </extensions>
        </configuration>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>xsdtojava</goal>
            </goals>
            <configuration>
              <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
              <xsdOptions>
                <xsdOption>
                  <!-- Schemas and doc found @ https://www.mit.ladok.se/restdoc/ -->
                  <xsdDir>${basedir}/src/main/resources/xsd/</xsdDir>
                  <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
                  <extensionArgs>
                    <!-- No header, easier to diff -->
                    <extensionArg>-no-header</extensionArg>
                  </extensionArgs>
                  <extensionArgs>
                    <arg>-encoding</arg>
                    <arg>${project.build.sourceEncoding}</arg>
                    <arg>-npa</arg>
                    <arg>-extension</arg>
                  </extensionArgs>
                  <extensionArgs>
                    <arg>-encoding</arg>
                    <arg>${project.build.sourceEncoding}</arg>
                    <arg>-npa</arg>
                    <arg>-extension</arg>
                    <arg>-Xts:style:multiline</arg>
                    <arg>-Xinject-code</arg>
                  </extensionArgs>
                </xsdOption>
              </xsdOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <!-- Extend/override configuration from parent pom.xml -->
        <configuration>
          <instructions>
            <Export-package>se.ladok.schemas.*</Export-package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.6</version>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf.xjc-utils</groupId>
      <artifactId>cxf-xjc-runtime</artifactId>
      <version>${cxf.version}</version>
    </dependency>
  </dependencies>
</project>
