<?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>

    <!-- The Basics -->
    <groupId>com.draeger.medical</groupId>
    <artifactId>BICEPS</artifactId>
    <version>1.2.0</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>net.sf.beanlib</groupId>
            <artifactId>beanlib</artifactId>
            <version>5.0.2beta</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.fastinfoset</groupId>
            <artifactId>FastInfoset</artifactId>
            <version>1.2.13</version>
        </dependency>
        <dependency>
            <groupId>com.draeger.medical</groupId>
            <artifactId>JDPWS</artifactId>
            <version>0.10.1</version>
        </dependency>
        <dependency>
            <groupId>com.draeger.medical</groupId>
            <artifactId>MDPWS</artifactId>
            <version>0.6.1</version>
        </dependency>
        <!-- for jaxb2:xjc -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-basics-runtime</artifactId>
            <version>0.6.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb2_commons</groupId>
            <artifactId>jaxb2-namespace-prefix</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <!-- for tests -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <biceps.xsd.forceRegenerate>true</biceps.xsd.forceRegenerate>

    <biceps.xsd.dir>${project.build.resources[0].directory}/xsd/v2</biceps.xsd.dir>
    <biceps.xslt.dir>${project.build.resources[0].directory}/xslt</biceps.xslt.dir>
	<biceps.xsd.model.dir>com/draeger/medical/biceps/common/messages/xsd/v2</biceps.xsd.model.dir>
    <biceps.xsd.model.package>com.draeger.medical.biceps.common.model</biceps.xsd.model.package>
    <biceps.xsd.model.targetdir>${project.build.outputDirectory}/${biceps.xsd.model.dir}</biceps.xsd.model.targetdir>
    <biceps.xsd.model.targetname>BICEPS_Model.xsd</biceps.xsd.model.targetname>
    <biceps.xsd.dim.targetname>BICEPS_ParticipantModel.xsd</biceps.xsd.dim.targetname>
    <biceps.xsd.ext.targetname>ExtensionPoint.xsd</biceps.xsd.ext.targetname>

    <checkstyle.config.location>build-tools/checkstyle/checkstyle.xml</checkstyle.config.location>
    <checkstyle.suppressions.location>build-tools/checkstyle/suppressions.xml</checkstyle.suppressions.location>
  </properties>


  <!-- Build Settings -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <!-- compilerArguments are ignore in Maven 3.0+ by default,
                    force old compiler usage. See:
                    https://jira.codehaus.org/browse/MCOMPILER-201 -->
          <forceJavacCompilerUse>true</forceJavacCompilerUse>
          <compilerArgument>-XDignore.symbol.file</compilerArgument>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.3</version>
        <executions>
          <execution>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <transformationSets>
            <transformationSet>
              <dir>${biceps.xsd.dir}</dir>
              <includes>
                <include>ExtensionPoint.xsd</include>
              </includes>
              <stylesheet>${biceps.xslt.dir}/CreateModelXSD.xslt</stylesheet>
              <outputDir>${biceps.xsd.model.targetdir}</outputDir>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.MergeFileMapper">
                  <targetName>${biceps.xsd.ext.targetname}</targetName>
                </fileMapper>
              </fileMappers>
            </transformationSet>
            <transformationSet>
              <dir>${biceps.xsd.dir}</dir>
              <includes>
                <include>BICEPS_ParticipantModel.xsd</include>
              </includes>
              <stylesheet>${biceps.xslt.dir}/CreateModelXSD.xslt</stylesheet>
              <outputDir>${biceps.xsd.model.targetdir}</outputDir>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.MergeFileMapper">
                  <targetName>${biceps.xsd.dim.targetname}</targetName>
                </fileMapper>
              </fileMappers>
            </transformationSet>
            <transformationSet>
              <dir>${biceps.xsd.dir}</dir>
              <includes>
                <include>BICEPS_MessageModel.xsd</include>
              </includes>
              <stylesheet>${biceps.xslt.dir}/CreateModelXSD.xslt</stylesheet>
              <outputDir>${biceps.xsd.model.targetdir}</outputDir>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.MergeFileMapper">
                  <targetName>${biceps.xsd.model.targetname}</targetName>
                </fileMapper>
              </fileMappers>
            </transformationSet>
          </transformationSets>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>transform</goal>
            </goals>
            <!-- xsd file generation must be done before the "generate-sources" phase -->
            <phase>initialize</phase>
          </execution>
        </executions>
      </plugin>
	  <!-- Copy binding.xjb to target folder -->
	  <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <!-- here the phase you need -->
            <phase>initialize</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${biceps.xsd.model.targetdir}/../../bindings</outputDirectory>
              <resources>          
                <resource>
                  <directory>${biceps.xsd.dir}/../../bindings</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>
      <!-- JAXB xjc plugin that invokes the xjc compiler to compile XML schema into Java classes.-->
      <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <version>0.10.0</version>
        <executions>
          <execution>
            <id>jaxb-model</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <!-- The schema directory or xsd files. -->
              <locale>en-us</locale>
              <forceRegenerate>${biceps.xsd.forceRegenerate}</forceRegenerate>
              <readOnly>true</readOnly>
              <schemaDirectory>${biceps.xsd.model.targetdir}</schemaDirectory>
              <schemaIncludes>
                <include>${biceps.xsd.model.targetname}</include>
              </schemaIncludes>
              <schemaExcludes>
                <exclude>*.xjb</exclude>
              </schemaExcludes>
			  <bindingDirectory>${biceps.xsd.model.targetdir}/../../bindings</bindingDirectory>
			  <bindingIncludes>
				<include>bindings.xjb</include>
			  </bindingIncludes>
              <!-- The package in which the source files will be generated. -->
              <generatePackage>${biceps.xsd.model.package}</generatePackage>
              <!-- The working directory to create the generated java source files. -->
              <generateDirectory>${project.build.directory}/generated-sources/jaxb/model</generateDirectory>
              <args>
                <arg>-npa</arg>
                <arg>-no-header</arg>
                <arg>-Xsetters</arg>
                <arg>-Xsetters-mode=accessor</arg>
                <arg>-Xcommons-lang</arg>
                <!--arg>-Xnamespace-prefix</arg-->
              </args>
              <plugins>
                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-basics</artifactId>
                  <version>0.6.5</version>
                </plugin>
                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-commons-lang</artifactId>
                  <version>2.4</version>
                </plugin>
              </plugins>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.1</version>
        <configuration>
          <additionalparam>${javadoc.opts}</additionalparam>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <excludes>
            <exclude>**/MDIBFileReaderUtilTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.16</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>6.2</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>3.0.5-SNAPSHOT</version>
        <configuration>
          <excludeFilterFile>build-tools/findbugs/excludeFilter.xml</excludeFilterFile>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>checkstyle</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.5</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.9</version>
      </plugin>
    </plugins>
  </reporting>


  <!-- More Project Information -->
  <name>BICEPS</name>
  <url>https://sourceforge.net/projects/opensdc/</url>


  <!-- Environment Settings -->
  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>nexus-isp-releases</id>
      <name>ISP Nexus Releases</name>
      <url>https://sourcecode.isp.uni-luebeck.de/nexus/content/repositories/releases</url>
      <layout>default</layout>
    </repository>
    <repository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>nexus-isp-snapshots</id>
      <name>ISP Nexus Snapshots</name>
      <url>https://sourcecode.isp.uni-luebeck.de/nexus/content/repositories/snapshots</url>
      <layout>default</layout>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
  </pluginRepositories>
  <distributionManagement>
    <repository>
      <id>nexus-isp</id>
      <name>ISP Nexus Releases</name>
      <url>https://sourcecode.isp.uni-luebeck.de/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
      <id>nexus-isp</id>
      <name>ISP Nexus Snapshots</name>
      <url>https://sourcecode.isp.uni-luebeck.de/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
    <site>
      <id>biceps.website</id>
      <name>BICEPS Website</name>
      <url></url>
    </site>
  </distributionManagement>
  <profiles>
    <!--    JAXB does not generate valid doclet comments when using jdk8
              http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html -->
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
  </profiles>
</project>
