<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2016 Original Authors
  ~
  ~ 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">
    <parent>
        <artifactId>docker-client-project</artifactId>
        <groupId>io.fabric8</groupId>
        <version>1.3.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.fabric8</groupId>
    <artifactId>docker-model</artifactId>
    <name>Fabric8 :: Docker :: Model</name>
    <packaging>bundle</packaging>

    <properties>
        <osgi.import>
            !io.fabric8.docker.api.builder,
            !io.fabric8.docker.api.model.*,
            *
        </osgi.import>
        <osgi.export>
            io.fabric8.docker.api.builder,
            io.fabric8.docker.api.model,
            io.fabric8.docker.api.model.serialize,
            io.fabric8.docker.api.model.blkiodev,
            io.fabric8.docker.api.model.nat,
            io.fabric8.docker.api.model.network,
            io.fabric8.docker.api.model.registry,
            io.fabric8.docker.api.model.runconfig,
            io.fabric8.docker.api.model.stringutils,
            io.fabric8.docker.api.model.ulimit
        </osgi.export>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>builder-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>io.sundr</groupId>
            <artifactId>dsl-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.skyscreamer</groupId>
            <artifactId>jsonassert</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <version>${jsonschema2pojo.version}</version>
                <configuration>
                    <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
                    <targetPackage>io.fabric8.docker.api.model</targetPackage>
                    <includeConstructors>true</includeConstructors>
                    <includeJsr303Annotations>true</includeJsr303Annotations>
                    <includeToString>false</includeToString>
                    <includeHashcodeAndEquals>false</includeHashcodeAndEquals>
                    <outputDirectory>${basedir}/target/generated-sources</outputDirectory>
                    <customAnnotator>io.fabric8.docker.model.annotator.DockerTypeAnnotator</customAnnotator>
                </configuration>
                <executions>
                    <execution>
                        <id>generate</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-model-annotator</artifactId>
                        <version>${project.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                            <target>
                                <echo>removing the duplicate generated class</echo>
                                <delete file="${basedir}/target/generated-sources/io/fabric8/docker/api/model/NetIPNet.java" verbose="true" />
                                <delete file="${basedir}/target/generated-sources/io/fabric8/docker/api/model/LxcConfig.java" verbose="true" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.9.1</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${build.outputDirectory}/schema/docker-schema.json</file>
                                    <type>json</type>
                                    <classifier>schema</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.5</version>
                <configuration>
                    <passphrase>${gpg.passphrase}</passphrase>
                    <useAgent>true</useAgent>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>