<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="https://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>net.osslabz</groupId>
    <artifactId>lnd-rest-client</artifactId>
    <version>1.0.1</version>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>lnd-http-client is a simple client to interact with Lightning Network Daemon (LND) via it's REST API.
    </description>
    <url>https://github.com/osslabz/lnd-rest-client</url>

    <properties>
        <osslabz.encoding>UTF-8</osslabz.encoding>
        <osslabz.java.version>17</osslabz.java.version>

        <project.build.sourceEncoding>${osslabz.encoding}</project.build.sourceEncoding>
        <project.reporting.outputEncoding>${osslabz.encoding}</project.reporting.outputEncoding>

        <maven.compiler.source>${osslabz.java.version}</maven.compiler.source>
        <maven.compiler.target>${osslabz.java.version}</maven.compiler.target>
        <maven.compiler.release>${osslabz.java.version}</maven.compiler.release>

        <project.build.outputTimestamp>2023-03-27T00:00:00Z</project.build.outputTimestamp>

        <okhttp.version>4.10.0</okhttp.version>
    </properties>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Raphael Vullriede</name>
            <email>raphael@osslabz.net</email>
            <organization>osslabz.net</organization>
            <organizationUrl>http://www.osslabz.net</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh://git@github.com/osslabz/lnd-rest-client.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/osslabz/lnd-rest-client.git</developerConnection>
        <url>https://github.com/osslabz/lnd-rest-client</url>
        <tag>main</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>${okhttp.version}</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
            <version>${okhttp.version}</version>
        </dependency>

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <version>2.1.1</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.10.1</version>
        </dependency>
        <dependency>
            <groupId>io.gsonfire</groupId>
            <artifactId>gson-fire</artifactId>
            <version>1.8.5</version>
        </dependency>

        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>1.5.24</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.12.0</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>


        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.7</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>


        <!-- default logging impl for tests -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <profiles>
        <profile>
            <id>osslabz-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</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>3.5.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <doclint>none</doclint>
                                    <failOnError>false</failOnError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</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.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>5.4.0</version>
                <executions>
                    <execution>
                        <id>generate-sources-lnd-http-api-lightning</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>
                                ${project.resources[0].directory}/lnrpc/lightning.swagger_modified.json
                            </inputSpec>
                            <generatorName>java</generatorName>
                            <library>okhttp-gson</library>
                            <modelPackage>net.osslabz.lnd.dto</modelPackage>
                            <apiPackage>net.osslabz.lnd.api</apiPackage>
                            <configOptions>
                                <dateLibrary>java8</dateLibrary>
                                <useJakartaEe>true</useJakartaEe>
                            </configOptions>
                            <output>${project.build.directory}/generated-sources/openapi</output>
                            <generateApis>true</generateApis>
                            <generateModelTests>false</generateModelTests>
                            <generateApiTests>false</generateApiTests>
                            <generateApiDocumentation>false</generateApiDocumentation>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-sources-lnd-http-api-invoices</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>
                                ${project.resources[0].directory}/lnrpc/invoices.swagger_modified.json
                            </inputSpec>
                            <generatorName>java</generatorName>
                            <library>okhttp-gson</library>
                            <modelPackage>net.osslabz.lnd.dto</modelPackage>
                            <apiPackage>net.osslabz.lnd.api</apiPackage>
                            <configOptions>
                                <dateLibrary>java8</dateLibrary>
                                <useJakartaEe>true</useJakartaEe>
                            </configOptions>
                            <output>${project.build.directory}/generated-sources/openapi</output>
                            <generateApis>true</generateApis>
                            <generateModelTests>false</generateModelTests>
                            <generateApiTests>false</generateApiTests>
                            <generateApiDocumentation>false</generateApiDocumentation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/openapi/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>initialize</phase>
                        <id>parse-version</id>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.floverfelt</groupId>
                <artifactId>find-and-replace-maven-plugin</artifactId>
                <version>1.1.0</version>
                <executions>
                    <execution>
                        <id>exec</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>find-and-replace</goal>
                        </goals>
                        <configuration>
                            <!-- Possible replacementType values: file-contents, filenames, directory-names. To run for multiple types, pass the values as a CSV list. -->
                            <replacementType>file-contents</replacementType>
                            <baseDir>target/generated-sources</baseDir>
                            <findRegex>javax.annotation</findRegex>
                            <replaceValue>jakarta.annotation</replaceValue>
                            <recursive>true</recursive>
                            <fileMask>.java</fileMask>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
</project>