<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.dbmaster</groupId>
        <artifactId>dbmaster-parent</artifactId>
        <version>1.12.0</version>
    </parent>

    <artifactId>dbmaster-api</artifactId>
    <version>1.12.0</version>
    <packaging>jar</packaging>

    <name>DBMaster API</name>
    <description>Contains DBMaster public api. Helps to track api dependencies between dbmaster and its plugins</description>
    <url>https://github.com/dbmaster/dbmaster-api/tree/master/dbmaster-api</url>

    <properties>
        <release.version>1.12</release.version>
    </properties>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>schristin</id>
            <name>Slava Christin</name>
            <organization>Branegy Systems, Inc</organization>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/dbmaster/dbmaster-api.git</connection>
        <developerConnection>scm:git:ssh://github.com:dbmaster/dbmaster-api.git</developerConnection>
        <url>https://github.com/dbmaster/dbmaster-api/tree/master/dbmaster-api</url>
        <tag>v${project.version}-api</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>deploy-dbmaster-api</id>
            <properties>
                <maven.install.skip>false</maven.install.skip>
                <maven.deploy.skip>true</maven.deploy.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>public-deploy</id>
                                <phase>deploy</phase>
                                <configuration>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <version>${base.version}</version>
                                    <file>${project.build.directory}/${project.artifactId}-${release.version}.jar</file>
                                    <url>http://repo.dbmaster.io/nexus/content/repositories/public-maven</url>
                                    <repositoryId>dbmaster</repositoryId>
                                    <generatePom>true</generatePom>
                                    <packaging>jar</packaging>
                                    <uniqueVersion>false</uniqueVersion>
                                </configuration>
                                <goals>
                                    <goal>deploy-file</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <resources>
            <resource>
                <directory>src/main/groovy</directory>
                <includes>
                    <include>**/*.groovy</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <!-- extra OSGi manifest headers -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>io/dbmaster/api/groovy/package-info.class</include>
                                <include>dbmaster-tools.xsd</include>
                                <include>sample.xml</include>
                            </includes>
                            <archive>
                                <manifestEntries>
                                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                                    <Bundle-Description>${project.description}</Bundle-Description>
                                    <Bundle-Name>${project.name}</Bundle-Name>
                                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                                    <Bundle-Version>${project.version}</Bundle-Version>
                                    <Export-Package>io.dbmaster.api;version="${project.version}"</Export-Package>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>compile</classifier>
                            <excludes>
                                <exclude>io/dbmaster/api/groovy/package-info.class</exclude>
                                <exclude>dbmaster-tools.xsd</exclude>
                                <exclude>sample.xml</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.5</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <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>            
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>