﻿<?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>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <groupId>io.github.ygqygq2</groupId>
    <artifactId>classfinal</artifactId>
    <version>2.0.2</version>
    <modules>
        <module>classfinal-core</module><!--主要代码在这里-->
        <module>classfinal-fatjar</module><!--单独运行的jar、javaagent-->
        <!--        <module>classfinal-web</module>&lt;!&ndash;webUI&ndash;&gt;-->
        <module>classfinal-maven-plugin</module><!--maven插件-->
    </modules>
    <packaging>pom</packaging>


    <name>ClassFinal</name>
    <description>Java class file encryption tool</description>
    <url>https://github.com/ygqygq2/classfinal</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
    </properties>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/ygqygq2/classfinal</url>
        <connection>scm:git:git://github.com/ygqygq2/classfinal.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/ygqygq2/classfinal.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <name>ygqygq2</name>
            <email>ygqygq2@qq.com</email>
            <organization>ygqygq2</organization>
            <organizationUrl>https://github.com/ygqygq2</organizationUrl>
        </developer>
        <developer>
            <name>roseboy</name>
            <email>roseboy@live.com</email>
            <roles>
                <role>Original Author</role>
            </roles>
        </developer>
    </developers>

    <distributionManagement>
        <snapshotRepository>
            <id>central</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>central</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <plugins>
            <!-- Source 插件（日常开发和发布都需要） -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- JavaDoc 插件（仅用于发布） -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <charset>UTF-8</charset>
                            <docencoding>UTF-8</docencoding>
                            <doclint>none</doclint>
                            <javadocExecutable>${javadocExecutable}</javadocExecutable>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- GPG 签名插件（仅用于发布） -->
                    <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>
                                    <passphrase>${env.GPG_PASSPHRASE}</passphrase>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- 新版 Central Portal 发布插件（仅用于正式版本） -->
                    <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>
                            <autoPublish>true</autoPublish>
                            <!-- 只发布非 SNAPSHOT 版本 -->
                            <skipPublishing>${project.version.contains("SNAPSHOT")}</skipPublishing>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>snapshot</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- 传统 OSSRH SNAPSHOT 部署 -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>3.1.1</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
