<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>io.github.enxign</groupId>
  <artifactId>exished</artifactId>
  <version>1.0.6</version>
  <packaging>jar</packaging>

  <name>exished</name>
  <description>A useful Java library</description>
  <url>https://github.com/enxign/exished</url>

  <licenses>
    <license>
      <name>Apache License 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>enxign</id>
      <name>enxign</name>
      <email>enxign@outlook.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/enxign/exished.git</connection>
    <developerConnection>scm:git:ssh://github.com/enxign/exished.git</developerConnection>
    <url>https://github.com/enxign/exished</url>
    <tag>HEAD</tag>
  </scm>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.test.skip>true</maven.test.skip>
    <gpg.keyname>B050B575E75CC0685C3C799C0401F98F52DACEE3</gpg.keyname>
    <groupIdPath>io/github/enxign</groupIdPath>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>2.16.1</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>  

  <dependencies>
    <!-- JUnit 5 (Jupiter) -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.10.0</version>
      <scope>test</scope>
    </dependency>

    <!-- Email -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-email</artifactId>
      <version>1.6.0</version>
    </dependency>
    <dependency>
      <groupId>javax.mail</groupId>
      <artifactId>mail</artifactId>
      <version>1.5.0-b01</version>
    </dependency>    

    <!-- Servlet API Session -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.1</version>
      <scope>provided</scope>
    </dependency>    

    <!-- Jackson (version managed by BOM) -->
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>

    <!-- Optional: JSON-Simple -->
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <version>1.1.1</version>
      <optional>true</optional>
    </dependency>
  </dependencies>

  <distributionManagement>
    <repository>
      <id>github</id>
      <url>https://maven.pkg.github.com/enxign/exished</url>
    </repository>
  </distributionManagement>

  <build>
    <plugins>
      <!-- ProGuard로 난독화된 jar 생성 -->
      <plugin>
        <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.7.0</version>
        <dependencies>
          <dependency>
            <groupId>com.guardsquare</groupId>
            <artifactId>proguard-base</artifactId>
            <version>7.6.1</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>proguard</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <proguardVersion>7.6.1</proguardVersion>
          <proguardConfig>${basedir}/proguard.pro</proguardConfig>
          <injar>${project.build.finalName}.jar</injar>
          <outjar>${project.build.finalName}.jar</outjar> <!-- 덮어쓰기 -->
          <obfuscate>true</obfuscate>
          <proguardInclude>../.proguard/proguard.conf</proguardInclude>
          <options>
            <option>-dontoptimize</option>
          </options>
        </configuration>
      </plugin>

      <!-- Maven Central 배포용 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>
          </execution>
        </executions>
      </plugin>
	  
	  <!-- 체크섬 생성 -->
	  <plugin>
      <groupId>net.nicoulaj.maven.plugins</groupId>
      <artifactId>checksum-maven-plugin</artifactId>
      <version>1.8</version>
      <executions>
        <execution>
          <id>create-checksums</id>
          <phase>verify</phase>
          <goals>
            <goal>files</goal>
          </goals>
          <configuration>
            <fileSets>
              <fileSet>
                <directory>${project.build.directory}</directory>
                <includes>
                  <include>*.jar</include>
                  <include>*.pom</include>
                  <include>*.war</include>
                </includes>
              </fileSet>
            </fileSets>
            <algorithms>
              <algorithm>md5</algorithm>
              <algorithm>sha1</algorithm>
            </algorithms>
          </configuration>
        </execution>
      </executions>
    </plugin>

      <!-- Maven Central Source -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Maven Central Javadoc -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.4.1</version>
        <configuration>
          <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
          <!-- <doclint>none</doclint>
          <failOnError>false</failOnError>
          <additionalparam>-Xdoclint:none</additionalparam> -->
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>    

      <!-- Maven Central 배포용 압축 -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <descriptors>
            <descriptor>../.assembly/central-upload.xml</descriptor>
          </descriptors>
          <finalName>${project.artifactId}-${project.version}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <id>make-zip</id>
            <phase>verify</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>      

      <!-- 기타 표준 플러그인 -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
      </plugin>
    </plugins>
  </build>
</project>