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

  <groupId>com.github.nhirakawa</groupId>
  <artifactId>basepom</artifactId>
  <version>15</version>

  <packaging>pom</packaging>

  <name>basepom</name>

  <description>basepom for my personal projects</description>

  <properties>
    <enforcer.skip>false</enforcer.skip>
    <executable.class/>
    <plugin.maven.clean.version>3.3.1</plugin.maven.clean.version>
    <plugin.maven.compiler.java.version>17</plugin.maven.compiler.java.version>
    <plugin.maven.compiler.version>3.11.0</plugin.maven.compiler.version>
    <plugin.maven.dependency.phase>verify</plugin.maven.dependency.phase>
    <plugin.maven.dependency.version>3.6.0</plugin.maven.dependency.version>
    <plugin.maven.deploy.version>3.1.1</plugin.maven.deploy.version>
    <plugin.maven.enforcer.phase>verify</plugin.maven.enforcer.phase>
    <plugin.maven.enforcer.version>3.4.1</plugin.maven.enforcer.version>
    <plugin.maven.gpg.version>3.1.0</plugin.maven.gpg.version>
    <plugin.maven.help.version>3.4.0</plugin.maven.help.version>
    <plugin.maven.install.version>3.1.1</plugin.maven.install.version>
    <plugin.maven.javadoc.version>3.6.0</plugin.maven.javadoc.version>
    <plugin.maven.release.version>3.0.1</plugin.maven.release.version>
    <plugin.maven.shade.version>3.5.1</plugin.maven.shade.version>
    <plugin.maven.site.version>4.0.0-M10</plugin.maven.site.version>
    <plugin.maven.sortpom.phase>verify</plugin.maven.sortpom.phase>
    <plugin.maven.sortpom.version>3.3.0</plugin.maven.sortpom.version>
    <plugin.maven.source.version>3.3.0</plugin.maven.source.version>
    <plugin.maven.versions.version>2.16.1</plugin.maven.versions.version>
    <plugin.nexus.staging.maven.version>1.6.13</plugin.nexus.staging.maven.version>
    <plugin.prettier.java.version>1.5.0</plugin.prettier.java.version>
    <plugin.prettier.maven.fail>true</plugin.prettier.maven.fail>
    <plugin.prettier.maven.skip>false</plugin.prettier.maven.skip>
    <plugin.prettier.maven.version>0.21</plugin.prettier.maven.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <zasdf/>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>${plugin.maven.clean.version}</version>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>${plugin.nexus.staging.maven.version}</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>${plugin.maven.release.version}</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${plugin.maven.compiler.version}</version>
        <configuration>
          <source>${plugin.maven.compiler.java.version}</source>
          <target>${plugin.maven.compiler.java.version}</target>
          <release>${plugin.maven.compiler.java.version}</release>
          <showWarnings>true</showWarnings>
          <compilerArgs>
            <art>-Xlint</art>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>${plugin.maven.dependency.version}</version>
        <executions>
          <execution>
            <id>analyze</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <phase>${plugin.maven.dependency.phase}</phase>
            <configuration>
              <failOnWarning>true</failOnWarning>
              <ignoreNonCompile>true</ignoreNonCompile>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.ekryd.sortpom</groupId>
        <artifactId>sortpom-maven-plugin</artifactId>
        <version>${plugin.maven.sortpom.version}</version>
        <configuration>
          <predefinedSortOrder>custom_1</predefinedSortOrder>
          <lineSeparator>\n</lineSeparator>
          <encoding>${project.build.sourceEncoding}</encoding>
          <sortProperties>true</sortProperties>
          <keepBlankLines>true</keepBlankLines>
          <sortDependencies>scope,groupId,artifactId</sortDependencies>
          <createBackupFile>false</createBackupFile>
          <verifyFail>Stop</verifyFail>
          <expandEmptyElements>false</expandEmptyElements>
          <spaceBeforeCloseEmptyElement>false</spaceBeforeCloseEmptyElement>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-help-plugin</artifactId>
        <version>${plugin.maven.help.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${plugin.maven.enforcer.version}</version>
        <executions>
          <execution>
            <id>enforce</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>${plugin.maven.enforcer.phase}</phase>
            <configuration>
              <rules>
                <banDuplicatePomDependencyVersions/>
                <dependencyConvergence/>
                <reactorModuleConvergence/>
                <requireJavaVersion>
                  <version>17.0</version>
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>3.9.0</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>${plugin.maven.versions.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>${plugin.maven.deploy.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>${plugin.maven.install.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>${plugin.maven.site.version}</version>
      </plugin>
    </plugins>
  </build>

  <url>https://github.com/nhirakawa/basepom</url>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>nhirakawa</id>
      <name>Nick Hirakawa</name>
      <email>nickhirakawa@gmail.com</email>
      <url>https://github.com/nhirakawa</url>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:ssh://git@github.com/nhirakawa/basepom</connection>
    <developerConnection>scm:git:ssh://git@github.com/nhirakawa/basepom</developerConnection>
    <url>https://github.com/nhirakawa/basepom</url>
    <tag>basepom-15</tag>
  </scm>

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

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${plugin.maven.source.version}</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>${plugin.maven.javadoc.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${plugin.maven.gpg.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ci</id>
      <activation>
        <property>
          <name>env.CI</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.hubspot.maven.plugins</groupId>
            <artifactId>prettier-maven-plugin</artifactId>
            <version>${plugin.prettier.maven.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
                <configuration>
                  <skip>${plugin.prettier.maven.skip}</skip>
                  <fail>${plugin.prettier.maven.fail}</fail>
                  <prettierJavaVersion>${plugin.prettier.java.version}</prettierJavaVersion>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.github.ekryd.sortpom</groupId>
            <artifactId>sortpom-maven-plugin</artifactId>
            <version>${plugin.maven.sortpom.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>verify</goal>
                </goals>
                <phase>${plugin.maven.sortpom.phase}</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>local</id>
      <activation>
        <property>
          <name>!env.CI</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>com.hubspot.maven.plugins</groupId>
            <artifactId>prettier-maven-plugin</artifactId>
            <version>${plugin.prettier.maven.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>write</goal>
                </goals>
                <phase>validate</phase>
                <configuration>
                  <skip>${plugin.prettier.maven.skip}</skip>
                  <prettierJavaVersion>${plugin.prettier.java.version}</prettierJavaVersion>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.github.ekryd.sortpom</groupId>
            <artifactId>sortpom-maven-plugin</artifactId>
            <version>${plugin.maven.sortpom.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>sort</goal>
                </goals>
                <phase>${plugin.maven.sortpom.phase}</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>executable</id>
      <activation>
        <file>
          <exists>.executable</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>${plugin.maven.shade.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>shade</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <createDependencyReducedPom>false</createDependencyReducedPom>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                      <mainClass>${executable.class}</mainClass>
                    </transformer>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>error-prone</id>
      <activation>
        <property>
          <name>error.prone.enabled</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <compilerArgs>
                <arg>-XDcompilePolicy=simple</arg>
                <arg>-Xplugin:ErrorProne -XepDisableWarningsInGeneratedCode -XepExcludedPaths:.*/generated-sources/.* -Xep:RemoveUnusedImports:ERROR -Xep:UnusedMethod:ERROR -Xep:UnusedNestedClass:ERROR -Xep:UnusedTypeParameter:ERROR -Xep:UnusedVariable:ERROR -Xep:FallThrough:ERROR -Xep:FutureReturnValueIgnored:ERROR -Xep:InstanceOfAndCastMatchWrongType:ERROR -Xep:IntLongMath:ERROR -Xep:MissingCasesInEnumSwitch:ERROR -Xep:MissingOverride:ERROR -Xep:ModifiedButNotUsed:ERROR -Xep:ModifyCollectionInEnhancedForLoop:ERROR -Xep:ObjectToString:ERROR -Xep:OptionalNotPresent:ERROR -Xep:OrphanedFormatString:ERROR -Xep:ReferenceEquality:ERROR -Xep:MissingBraces:ERROR</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
              </compilerArgs>
              <fork>false</fork>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
