<!--

    Copyright (C) 2017 Red Hat, Inc.

    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>
  <parent>
    <groupId>io.atlasmap</groupId>
    <artifactId>atlas-runtime</artifactId>
    <version>1.32.2</version>
    <relativePath>..</relativePath>
  </parent>

  <artifactId>atlas-model</artifactId>
  <packaging>bundle</packaging>
  <name>Atlas :: Model</name>

  <properties>
    <xjb.folder>src/main/resources</xjb.folder>
    <xjb.file>atlas-model-v2.xjb</xjb.file>
    <xsd.folder>src/main/resources</xsd.folder>
    <xsd.file>atlas-model-v2.xsd</xsd.file>
    <osgi.export.pkg>io.atlasmap.v2</osgi.export.pkg>
    <osgi.import.pkg>com.fasterxml.jackson.annotation;version="[2.6,3)",javax.xml.bind;version="[2.2,3)",javax.xml.bind.annotation;version="[2.2,3)",javax.xml.namespace</osgi.import.pkg>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.xml</groupId>
      <artifactId>jaxb-impl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <schemaDirectory>${xsd.folder}</schemaDirectory>
              <bindingDirectory>${xjb.folder}</bindingDirectory>
              <schemaExcludes>
                <schemaExclude>**/atlas-actions-v2.xsd</schemaExclude>
              </schemaExcludes>
              <args><arg>-Xannotate</arg><arg>-Xinheritance</arg></args>
              <plugins>
                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-basics</artifactId>
                  <version>0.11.1</version>
                </plugin>
                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-basics-annotate</artifactId>
                  <version>1.0.4</version>
                </plugin>
                <plugin>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-databind</artifactId>
                </plugin>
              </plugins>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${xsd.folder}/${xsd.file}</file>
                  <type>xsd</type>
                </artifact>
                <artifact>
                  <file>${xsd.folder}/atlas-actions-v2.xsd</file>
                  <type>xsd</type>
                  <classifier>actions</classifier>
                </artifact>
                <artifact>
                  <file>${xjb.folder}/${xjb.file}</file>
                  <type>xjb</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
