<?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>

    <artifactId>java-sdk</artifactId>
    <groupId>com.iohao.game.sdk</groupId>
    <version>21.2</version>
    <name>ioGameClient</name>
    <description>ioGame 网络游戏服务器框架 SDK</description>
    <url>http://game.iohao.com</url>

    <properties>
        <!-- jdk 版本 -->
        <java.version>21</java.version>
        <encoding>UTF-8</encoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- 网络库 : https://mvnrepository.com/artifact/io.netty/netty-all -->
        <netty.version>4.1.108.Final</netty.version>
        <!--
        jprotobuf是针对Java程序开发一套简易类库，目的是简化java语言对protobuf类库的使用
        https://github.com/jhunters/jprotobuf/
        https://mvnrepository.com/artifact/com.baidu/jprotobuf
        -->
        <jprotobuf.version>2.4.22</jprotobuf.version>
        <!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
        <protobuf-java.version>3.25.1</protobuf-java.version>
        <!-- lombok 消除冗长的 Java 代码 https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <lombok.version>1.18.30</lombok.version>
        <!-- slf4j https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
        <slf4j-api.version>2.0.11</slf4j-api.version>
        <!-- slf4j https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
        <logback.version>1.4.14</logback.version>

        <ioGame.version>21.8</ioGame.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>com.iohao.game</groupId>
            <artifactId>common-micro-kit</artifactId>
            <version>${ioGame.version}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.10.0</version>
            <scope>test</scope>
        </dependency>

        <!-- lombok 简化 java 代码 -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>${netty.version}</version>
        </dependency>

        <dependency>
            <groupId>com.baidu</groupId>
            <artifactId>jprotobuf</artifactId>
            <version>${jprotobuf.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.protobuf</groupId>
                    <artifactId>protobuf-java</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${protobuf-java.version}</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j-api.version}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <issueManagement>
        <system>Github Issue</system>
        <url>https://github.com/iohao/ioGameClient/issues</url>
    </issueManagement>

    <licenses>
        <license>
            <name>GNU Affero General Public License v3.0</name>
            <url>https://www.gnu.org/licenses/agpl-3.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>渔民小镇</name>
            <email>262610965@qq.com</email>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/iohao/ioGameClient</url>
        <connection>https://github.com/iohao/ioGameClient.git</connection>
        <developerConnection>https://github.com/iohao</developerConnection>
    </scm>

    <build>
        <plugins>
            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <configuration>
                    <classifier>javadoc</classifier>
                    <encoding>UTF-8</encoding>
                    <charset>UTF-8</charset>
                    <docencoding>UTF-8</docencoding>
                </configuration>
                <executions>
                    <execution>
                        <id>aggregate</id>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                        <phase>site</phase>
                    </execution>
                </executions>
            </plugin>

            <!--
                       编译插件
                       mvn compile
                       To compile your test sources, you'll do:
                       mvn test-compile
                       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerVersion>${java.version}</compilerVersion>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <!-- maven 3.6.2及之后加上编译参数，可以让我们在运行期获取方法参数名称。 -->
                    <parameters>true</parameters>
                    <skip>true</skip>
                    <!-- JDK9+ with module-info.java -->
                    <annotationProcessorPaths>

                        <!-- lombok 消除冗长的 Java 代码 -->
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>

                    </annotationProcessorPaths>
                </configuration>
            </plugin>


            <!-- 打包时跳过单元测试 https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

            <!-- 打包源码 https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addBuildEnvironmentEntries>true</addBuildEnvironmentEntries>
                        </manifest>
                        <manifestSections>
                            <manifestSection>
                                <name>hope</name>
                                <manifestEntries>
                                    <id>Public ownership of means of production</id>
                                </manifestEntries>
                            </manifestSection>
                            <manifestSection>
                                <name>zhu luo yi</name>
                                <manifestEntries>
                                    <id>渔民小镇</id>
                                </manifestEntries>
                            </manifestSection>
                        </manifestSections>

                    </archive>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <!-- mvn clean deploy -P oss-release -Dmaven.test.skip=true -e -->
        <profile>
            <id>oss-release</id>

            <build>
                <plugins>

                    <!-- Gpg Signature -->
                    <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>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- 自动发布 -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>oss-ioGame</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <!-- false 手动关闭 release -->
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                        <dependencies>
                            <!--
                            apparently this needs to be exactly this version
                            https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream
                            -->
                            <dependency>
                                <groupId>com.thoughtworks.xstream</groupId>
                                <artifactId>xstream</artifactId>
                                <version>1.4.15</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <!-- Javadoc -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                            <doclint>none</doclint>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <repository>
            <!-- 这里的id要与 maven setting.xml 中 server 的 id 一致 -->
            <id>oss-ioGame</id>
            <name>Nexus Release Repository</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
            <uniqueVersion>true</uniqueVersion>
        </repository>
    </distributionManagement>
</project>