<?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>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.java-websocket</groupId>
            <artifactId>Java-WebSocket</artifactId>
            <version>1.5.2</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20210307</version> <!-- 请自行选择合适的版本 -->
        </dependency>
        <dependency>
            <groupId>io.github.gdtegex</groupId>
            <artifactId>GRGCRXProtocol</artifactId>
            <version>1.0.1</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <!-- 编译插件，设置源码以及编译的jdk版本 -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
            <!-- Source -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Javadoc -->
            <!-- Gpg Signature -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <mainClass>TestMain</mainClass>
                                    <addClasspath>true</addClasspath>
                                </manifest>
                            </archive>
                        </configuration>
                    </execution>
                    <execution>
                        <id>test-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- ljjun added to assembly jar with dependencies-->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>TestMain</mainClass>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Launch4j Maven Plugin -->
            <plugin>
                <groupId>com.akathist.maven.plugins.launch4j</groupId>
                <artifactId>launch4j-maven-plugin</artifactId>
                <version>2.1.2</version>
                <executions>
                    <execution>
                        <id>l4j-gui</id>
                        <phase>package</phase>
                        <goals>
                            <goal>launch4j</goal>
                        </goals>
                        <configuration>
                            <headerType>gui</headerType>
                            <outfile>target/GRGCR6NetSDK.exe</outfile>
                            <jar>target/${project.artifactId}-${project.version}-jar-with-dependencies.jar</jar>
                            <dontWrapJar>false</dontWrapJar>
                            <errTitle>GRGCR6NetSDK</errTitle>
                            <classPath>
                                <mainClass>TestMain</mainClass>
                                <addDependencies>true</addDependencies>
                            </classPath>
                            <jre>
                                <minVersion>1.8.0</minVersion>
                                <path>%JAVA_HOME%</path>
                                <bundledJre64Bit>false</bundledJre64Bit>
                                <bundledJreAsFallback>false</bundledJreAsFallback>
                                <jdkPreference>preferJre</jdkPreference>
                                <runtimeBits>64/32</runtimeBits>
                                <initialHeapSize>128</initialHeapSize>
                                <maxHeapSize>512</maxHeapSize>
                                <opts>
                                    <opt>-Dfile.encoding=UTF-8</opt>
                                </opts>
                            </jre>
                            <versionInfo>
                                <fileVersion>1.0.0.0</fileVersion>
                                <txtFileVersion>1.0.0.0</txtFileVersion>
                                <fileDescription>GRG CR6 SDK Test Tool</fileDescription>
                                <copyright>Copyright © 2024</copyright>
                                <productVersion>1.0.0.0</productVersion>
                                <txtProductVersion>1.0.0.0</txtProductVersion>
                                <productName>GRG CR6 SDK Test Tool</productName>
                                <internalName>GRGCR6NetSDK</internalName>
                                <originalFilename>GRGCR6NetSDK.exe</originalFilename>
                            </versionInfo>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- 老账号的配置：Gpg Signature -->
            <!--将组件部署到OSSRH并将其发布到Central Repository-->
            <!--<plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>${serverId}</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>-->
            <!--新账号的配置：将组件部署到OSSRH并将其发布到Central Repository-->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.4.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <tokenAuth>true</tokenAuth>
                </configuration>
            </plugin>

            <!-- Copy test classes to main classes -->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>copy-test-classes</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.build.testOutputDirectory}</directory>
                                    <includes>
                                        <include>TestMain.class</include>
                                        <include>TestMain$*.class</include>
                                        <include>Button1Worker.class</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <snapshotRepository>
            <!-- 与settings.xml的server.id保持一致 -->
            <id>${serverId}</id>
            <url>https://central.sonatype.com/</url>
        </snapshotRepository>
        <!-- 老账号配置
        <snapshotRepository>
            &lt;!&ndash;这个id和settings.xml中servers.server.id要相同，因为上传jar需要登录才有权限&ndash;&gt;
            <id>${serverId}</id>
            <name>OSS Snapshots Repository</name>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            &lt;!&ndash;这个id和settings.xml中servers.server.id要相同，因为上传jar需要登录才有权限&ndash;&gt;
            <id>${serverId}</id>
            <name>OSS Staging Repository</name>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>-->
    </distributionManagement>
    <groupId>io.github.gdtegex</groupId>
    <artifactId>GRGCR6NetSDK</artifactId>
    <!-- 发布到这个上OSSRH:项目中的version,不要带上SNAPSHOT，这样就可以直接发布到中央仓库
         如果带上了，会发布到私服的snapshots下面，可以搜索进行查看,
         但是发布到Maven Central的新版本是不支持SNAPSHOT会被校验这个的，如果带来SNAPSHOT则推送失败，所以需要去掉version这个SNAPSHOT。 -->
    <version>1.0.2</version>
    <packaging>jar</packaging>
    <!--描述一定要有-->
    <description>GRGCR6NetSDK</description>

    <!--项目访问url -->
    <url>https://github.com/gdtegex/GRGPayment</url>
    <scm>
        <!--项目访问url -->
        <url>https://github.com/gdtegex/GRGPayment</url>
        <!--项目访问url.git结尾 -->
        <connection>scm:git:https://github.com/gdtegex/GRGPayment.git</connection>
        <!--项目访问url.git结尾 -->
        <developerConnection>scm:git:https://github.com/gdtegex/GRGPayment.git</developerConnection>
    </scm>

    <developers>
        <developer>
            <id>gdtegex</id>
            <name>gdtegex</name>
            <email>gdtegex@163.com</email>
            <!--项目访问url -->
            <url>https://github.com/gdtegex/GRGPayment</url>
            <timezone>+8</timezone>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
</project>