<?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>
    <groupId>hu.blackbelt.osgi.liquibase</groupId>
    <artifactId>osgi-liquibase</artifactId>
    <version>1.2.0</version>
    <packaging>bundle</packaging>
    
    <name>OSGi liquibase</name>
    <description>OSGi version of Liquibase</description>
    
    <properties>
        <project-shortname>osgi-liquibase</project-shortname>
        <project-repositoryId>BlackBeltTechnology/osgi-liquibase
        </project-repositoryId>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <liquibase.version>4.4.3</liquibase.version>
    </properties>
    <url>https://github.com/BlackBeltTechnology/{project.artifactId}</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <issueManagement>
      <url>https://github.com/${project-repositoryId}/issues</url>
      <system>GitHub Issues</system>
    </issueManagement>

    <scm>
      <connection>scm:git:git@github.com:${project-repositoryId}.git
      </connection>
      <!--suppress UnresolvedMavenProperty -->
        <developerConnection>scm:git:ssh://${git.username}@github.com:${project-repositoryId}.git
      </developerConnection>
      <url>http://github.com/${project-repositoryId}</url>
    </scm>

    <developers>
        <developer>
            <id>borcsokj</id>
            <name>Börcsök József</name>
            <email>jozsef.borcsok@blackbelt.hu</email>
            <url>https://bitbucket.org/borcsokj</url>
            <organization>BlackBelt Technology</organization>
            <organizationUrl>http://www.blackbelt.hu</organizationUrl>
        </developer>
        
        <developer>
            <id>robson</id>
            <name>Csákány Róbert</name>
            <email>robert.csakany@blackbelt.hu</email>
            <url>https://github.com/robertcsakany</url>
            <organization>BlackBelt Technology</organization>
            <organizationUrl>http://www.blackbelt.hu</organizationUrl>
        </developer>
        
    </developers>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.5.0</version>
                <extensions>true</extensions>
                <executions>
                    <!-- This execution makes sure that the manifest is available
                     when the tests are executed -->
                    <execution>
                        <id>generate-manifest</id>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                        <configuration>
                            <exportScr>true</exportScr>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Export-Package>hu.blackbelt.osgi.liquibase.*;version=${project.version},liquibase;version=${liquibase.version},liquibase.*;version=${liquibase.version}</Export-Package>
                        <Import-Package>
                            *;resolution:=optional
                        </Import-Package>
                        <Embed-Dependency>
                            groupId=org.liquibase;artifactId=liquibase-core;inline=!liquibase/servicelocator/ServiceLocator.class|liquibase/ext/logging/LiquibaseLogger.class,
                            groupId=org.yaml;artifactId=snakeyaml;inline=true,
                            groupId=org.apache.commons;artifactId=commons-lang3;inline=true
                        </Embed-Dependency>
                        <Automatic-Module-Name>hu.blackbelt.osgi.liquibase.logging</Automatic-Module-Name>
                        <Main-Class>liquibase.integration.commandline.Main</Main-Class>
                        <Liquibase-Package>
                            liquibase.change,
                            liquibase.command,
                            liquibase.changelog,
                            liquibase.database,
                            liquibase.parser,
                            liquibase.precondition,
                            liquibase.datatype,
                            liquibase.serializer,
                            liquibase.sqlgenerator,
                            liquibase.executor,
                            liquibase.snapshot,
                            liquibase.logging,
                            liquibase.diff,
                            liquibase.structure,
                            liquibase.structurecompare,
                            liquibase.lockservice,
                            liquibase.sdk.database,
                            liquibase.ext,
                            liquibase.pro,
                            com.datical.liquibase,
                            hu.blackbelt.osgi.liquibase.logging
                        </Liquibase-Package>
                    </instructions>
                </configuration>
            </plugin>
            
            <!-- Needed if you use versionAsInProject() -->
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>depends-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>generate-depends-file</id>
                        <goals>
                            <goal>generate-depends-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.2</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component.annotations</artifactId>
            <version>1.3.0</version>
        </dependency>
        
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.metatype.annotations</artifactId>
            <version>1.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.13</version>
        </dependency>
        <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>${liquibase.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
    </dependencies>
    
    <profiles>
        <profile>
            <id>sign-artifacts</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                    <passphraseServerId>${gpg.keyname}</passphraseServerId>
                                    <!-- This is necessary for gpg to not try to use the pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>generate-github-release-body</id>
            <activation>
                <property>
                    <name>github_release</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>template-github-release-body</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${basedir}/.release</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${project.basedir}</directory>
                                            <filtering>true</filtering>
                                            <includes>
                                                <include>.releasetemplate</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>release-dummy</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>dummy-distribution</id>
                    <url>file:///tmp/maven-snapshot/</url>
                </snapshotRepository>
                <repository>
                    <id>dummy-distribution</id>
                    <url>file:///tmp/maven-release/</url>
                </repository>
            </distributionManagement>
        </profile>

        <profile>
            <id>release-judong</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>judong-nexus-distribution</id>
                    <!--suppress UnresolvedMavenProperty -->
                    <url>${env.JUDONG_MAVEN_UPSTREAM_SNAPSHOT}</url>
                </snapshotRepository>
                <repository>
                    <id>judong-nexus-distribution</id>
                    <!--suppress UnresolvedMavenProperty -->
                    <url>${env.JUDONG_MAVEN_UPSTREAM_RELEASE}</url>
                </repository>
            </distributionManagement>
        </profile>
        
        <profile>
            <id>release-central</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>
</project>
