<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>com.h2database</groupId>-->
    <!--  <artifactId>h2</artifactId>-->
    <!--  <version>1.4.197-SNAPSHOT</version>-->

    <groupId>ai.platon.pulsar</groupId>
    <artifactId>pulsar-h2</artifactId>
    <version>1.4.197</version>
    <packaging>jar</packaging>
    <name>Pulsar H2 Database Engine</name>
    <url>http://www.h2database.com</url>
    <description>H2 Database Engine</description>

    <licenses>
        <license>
            <name>MPL 2.0</name>
            <url>https://www.mozilla.org/en-US/MPL/2.0/</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>EPL 1.0</name>
            <url>https://opensource.org/licenses/eclipse-1.0.php</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <!--    <scm>-->
    <!--        <connection>scm:git:https://github.com/h2database/h2database</connection>-->
    <!--        <url>https://github.com/h2database/h2database</url>-->
    <!--    </scm>-->

    <scm>
        <connection>scm:git:https://github.com/platonai/pulsar-h2.git</connection>
        <developerConnection>scm:git:https://github.com/platonai/pulsar-h2.git</developerConnection>
        <url>https://github.com/platonai/pulsar-h2</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>

    <repositories>
        <repository>
            <id>Central</id>
            <url>https://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>jcenter</id>
            <name>JCenter</name>
            <url>https://jcenter.bintray.com/</url>
        </pluginRepository>
    </pluginRepositories>

    <developers>
        <developer>
            <id>thomas.tom.mueller</id>
            <name>Thomas Mueller</name>
            <email>thomas.tom.mueller at gmail dot com</email>
        </developer>

        <developer>
            <name>Vincent Zhang</name>
            <email>ivincent.zhang@gmail.com</email>
            <organization>platon.ai</organization>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <properties>
        <central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <derby.version>10.10.1.1</derby.version>
        <osgi.version>4.2.0</osgi.version>
        <slf4j.version>1.6.0</slf4j.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

        <!-- START COMPILE DEPENDENCIES !-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>3.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>${osgi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.enterprise</artifactId>
            <version>${osgi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.locationtech.jts</groupId>
            <artifactId>jts-core</artifactId>
            <version>1.15.0</version>
        </dependency>
        <!-- END COMPILE DEPENDENCIES !-->


        <!-- START TEST DEPENDENCIES !-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.3.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbynet</artifactId>
            <version>${derby.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.4.1209.jre6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!-- END TEST DEPENDENCIES !-->

        <!--  JDK dependencies  -->
        <!--    <dependency>-->
        <!--      <groupId>com.sun</groupId>-->
        <!--      <artifactId>tools</artifactId>-->
        <!--      <version>1.7</version>-->
        <!--      <scope>system</scope>-->
        <!--      <systemPath>${tools.jar}</systemPath>-->
        <!--    </dependency>-->
    </dependencies>

    <!-- The test code creates proxy files using javac or tools.jar. Through maven we need to tell it
         where to possibly find tools.jar and annoyingly its called classes.jar on OSX -->
    <!--  <profiles>-->
    <!--    <profile>-->
    <!--      <id>default-tools.jar</id>-->
    <!--      <activation>-->
    <!--        <file>-->
    <!--          <exists>${java.home}/../lib/tools.jar</exists>-->
    <!--        </file>-->
    <!--      </activation>-->
    <!--      <properties>-->
    <!--        <tools.jar>${java.home}/../lib/tools.jar</tools.jar>-->
    <!--      </properties>-->
    <!--    </profile>-->
    <!--    <profile>-->
    <!--      <id>default-tools.jar-mac</id>-->
    <!--      <activation>-->
    <!--        <file>-->
    <!--          <exists>${java.home}/../Classes/classes.jar</exists>-->
    <!--        </file>-->
    <!--      </activation>-->
    <!--      <properties>-->
    <!--        <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>-->
    <!--      </properties>-->
    <!--    </profile>-->
    <!--  </profiles>-->

    <build>
        <sourceDirectory>src/main</sourceDirectory>
        <testSourceDirectory>src/test</testSourceDirectory>
        <!-- Resources do not follow maven project layout. We need to manually copy them -->
        <resources>
            <resource>
                <directory>src/main</directory>
                <includes>
                    <include>**/*.prop</include>
                    <include>**/*.png</include>
                    <include>**/*.jsp</include>
                    <include>**/*.ico</include>
                    <include>**/*.gif</include>
                    <include>**/*.css</include>
                    <include>**/*.js</include>
                    <include>org/h2/res/help.csv</include>
                    <include>org/h2/res/javadoc.properties</include>
                    <include>org/h2/server/pg/pg_catalog.sql</include>
                    <include>META-INF/**</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test</directory>
                <includes>
                    <include>org/h2/test/scripts/testSimple.in.txt</include>
                    <include>org/h2/test/scripts/testScript.sql</include>
                    <include>org/h2/samples/newsfeed.sql</include>
                    <include>org/h2/samples/optimizations.sql</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <mainClass>org.h2.tools.Console</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Automatic-Module-Name>com.h2database</Automatic-Module-Name>
                            <Multi-Release>true</Multi-Release>
                            <Premain-Class>org.h2.util.Profiler</Premain-Class>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <!-- Add tools folder to test sources but consider moving them to src/test -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/tools</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Make sure neither we nor one of our dependencies uses anything outside JDK 1.7 -->
            <!-- commented out for now because it fails to build under JDK1.8+ because we are manually adding the tools jar
                  <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M1</version>
                    <executions>
                      <execution>
                        <id>check-java-version</id>
                        <goals>
                          <goal>enforce</goal>
                        </goals>
                        <configuration>
                          <rules>
                            <enforceBytecodeVersion>
                              <maxJdkVersion>1.7</maxJdkVersion>
                            </enforceBytecodeVersion>
                            <checkSignatureRule implementation="org.codehaus.mojo.animal_sniffer.enforcer.CheckSignatureRule">
                              <signature>
                                <groupId>org.codehaus.mojo.signature</groupId>
                                <artifactId>java17</artifactId>
                                <version>1.0</version>
                              </signature>
                            </checkSignatureRule>
                          </rules>
                          <fail>true</fail>
                        </configuration>
                      </execution>
                    </executions>
                    <dependencies>
                      <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>1.0-beta-6</version>
                      </dependency>
                      <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>animal-sniffer-enforcer-rule</artifactId>
                        <version>1.16</version>
                      </dependency>
                    </dependencies>
                  </plugin>
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
                <configuration>
                    <skip>true</skip>
                    <includes>
                        <include>TestAllJunit.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.1</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>

        </plugins>
    </build>


    <profiles>
        <!-- Deployment profile -->
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <!-- Attach sources for Central requirements -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Generate and attach javadocs for Central requirements -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.12.0</version>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- GPG signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <configuration>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Calculate checksums -->
                    <plugin>
                        <groupId>net.nicoulaj.maven.plugins</groupId>
                        <artifactId>checksum-maven-plugin</artifactId>
                        <version>1.11</version>
                        <executions>
                            <execution>
                                <id>source-release-checksum</id>
                                <goals>
                                    <goal>files</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <algorithms>
                                <algorithm>SHA-512</algorithm>
                                <algorithm>SHA-256</algorithm>
                            </algorithms>
                            <csvSummary>false</csvSummary>
                            <fileSets>
                                <fileSet>
                                    <directory>${project.build.directory}</directory>
                                    <includes>
                                        <include>${project.artifactId}-${project.version}-sources.jar</include>
                                        <include>${project.artifactId}-${project.version}-javadoc.jar</include>
                                        <include>${project.artifactId}-${project.version}.jar</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                            <failIfNoFiles>false</failIfNoFiles>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>


</project>
