<?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/maven-v4_0_0.xsd">

    <parent>
        <artifactId>oss-parent</artifactId>
        <groupId>org.sonatype.oss</groupId>
        <version>7</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.jooq</groupId>
    <artifactId>joou-java-6</artifactId>
    <version>0.9.5</version>
    <packaging>bundle</packaging>

    <name>jOOU</name>
    <description>jOOU is a recursive acronym that stands for jOOU Object Oriented Unsigned Types. It is a simple wrapper for UByte, UShort, UInteger, ULong types</description>
    <url>https://github.com/jOOQ/jOOU</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <developerConnection>https://github.com/jOOQ/jOOU</developerConnection>
        <url>https://github.com/jOOQ/jOOU</url>
        <connection>https://github.com/jOOQ/jOOU</connection>
    </scm>

    <build>
        <defaultGoal>deploy</defaultGoal>
        <finalName>${project.artifactId}-${project.version}</finalName>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <fork>true</fork>
                    <maxmem>512m</maxmem>
                    <meminitial>256m</meminitial>
                    <encoding>UTF-8</encoding>




                    <source>1.6</source>
                    <target>1.6</target>
                    <debug>true</debug>
                    <debuglevel>lines,vars,source</debuglevel>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                        <manifestEntries>
                            <Automatic-Module-Name>org.jooq.joou</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.5.0</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release-oss</id>

            <distributionManagement>
                <repository>
                    <id>sonatype-nexus-staging</id>
                    <name>Nexus Release Repository</name>
                    <url>https://central.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            
            <build>
                <plugins>
                    <plugin>
                        <inherited>true</inherited>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.1.2</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>

                        <configuration>
                            <excludeResources>true</excludeResources>
                            <useDefaultExcludes>true</useDefaultExcludes>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.6.3</version>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>bundle-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <maxmemory>1024</maxmemory>
                            <encoding>UTF-8</encoding>
                            <show>protected</show>
                            <notree>true</notree>
                            <!-- Explicit configuration of javadoc language to avoid defaulting to build system's configuration -->
                            <locale>en</locale>

                            <!-- Avoid running into Java 8's very restrictive doclint issues -->
                            <additionalparam>-Xdoclint:none</additionalparam>
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                        </configuration>
                    </plugin>

                    <!-- Copy API docs to new directory first (replacer plugin seems to be unable to create dirs) -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-folder</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/apidocs-ga</outputDirectory>
                                    <resources>
                                        <resource>
                                            <filtering>false</filtering>
                                            <directory>${project.build.directory}/apidocs</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Then, patch Google Analytics code inside. -->
                    <plugin>
                        <groupId>com.google.code.maven-replacer-plugin</groupId>
                        <artifactId>replacer</artifactId>
                        <version>1.5.3</version>
                        <executions>
                            <execution>
                                <id>replace-apidocs-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>

                                <configuration>
                                    <ignoreErrors>true</ignoreErrors>
                                    <basedir>${project.build.directory}/apidocs</basedir>
                                    <includes>
                                        <include>**/*.html</include>
                                    </includes>
                                    <replacements>
                                        <replacement>
                                            <token><![CDATA[</head>]]></token>
                                            <value><![CDATA[
                                                <meta name="robots" content="noindex">
                                                <link rel="canonical" href="https://www.jooq.org/products/jOOU/javadoc/latest">
                                                </head>
                                            ]]></value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>

                            <execution>
                                <id>replace-apidocs-ga</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>replace</goal>
                                </goals>

                                <configuration>

                                    <!-- There's an error when trying to find the top module's /target/apidocs-ga directory -->
                                    <ignoreErrors>true</ignoreErrors>
                                    <basedir>${project.build.directory}/apidocs-ga</basedir>
                                    <includes>
                                        <include>**/*.html</include>
                                    </includes>
                                    <replacements>
                                        <replacement>
                                            <token><![CDATA[</body>]]></token>
                                            <value><![CDATA[
                                                <!-- Google tag (gtag.js) -->
                                                <script async src="https://www.googletagmanager.com/gtag/js?id=G-PB08BGF2SR"></script>
                                                <script>
                                                window.dataLayer = window.dataLayer || [];
                                                function gtag(){dataLayer.push(arguments);}
                                                gtag('js', new Date());

                                                gtag('config', 'G-PB08BGF2SR');
                                                </script>
                                                </body>
                                            ]]></value>
                                        </replacement>
                                    </replacements>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>repack</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <delete file="${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar"/>
                                        <zip basedir="${project.build.directory}/apidocs" destfile="${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar"/>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                
                    <!-- New release mechanism: https://central.sonatype.org/publish/publish-portal-maven/ -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>sonatype-nexus-staging</publishingServerId>
                        </configuration>
                    </plugin>
                    
                    <!-- This is required by Maven Central -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/jOOQ/jOOU/issues</url>
    </issueManagement>

    <developers>
        <developer>
            <name>Lukas Eder</name>
        </developer>
        <developer>
            <name>Ed Schaller</name>
        </developer>
        <developer>
            <name>Jens Nerche</name>
        </developer>
    </developers>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
