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

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
    <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
    <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
    <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
    <central-publishing-plugin.version>0.11.0</central-publishing-plugin.version>
    <maven-pmd-plugin.version>3.26.0</maven-pmd-plugin.version>
    <spotbugs-maven-plugin.version>4.8.6.6</spotbugs-maven-plugin.version>
    <maven-jxr-plugin.version>3.1.1</maven-jxr-plugin.version>
    <maven-jacoco-plugin.version>0.8.15</maven-jacoco-plugin.version>
    <gpg.keyname>2EAECBE3B77F5D0A55278EC1B5E0F3D37C8A1537</gpg.keyname>
    <sonar.organization>jmotif</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
  </properties>

  <dependencies>
    <dependency>
      <groupId>net.seninp</groupId>
      <artifactId>jmotif-sax</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>2.0.9</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.3.14</version>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.beust</groupId>
      <artifactId>jcommander</artifactId>
      <version>1.78</version>
    </dependency>
    <dependency>
      <groupId>com.apporiented</groupId>
      <artifactId>hierarchical-clustering</artifactId>
      <version>1.1.0</version>
    </dependency>
  </dependencies>

  <organization>
    <name>JMotif</name>
    <url>https://github.com/jMotif</url>
  </organization>

  <groupId>net.seninp</groupId>
  <artifactId>jmotif-gi</artifactId>
  <version>2.0.2</version>

  <name>jmotif-gi</name>
  <description>An implementation of grammar inference algorithms for JMotif libraries.</description>
  <url>https://github.com/jMotif/GI</url>

  <licenses>
    <license>
      <name>GNU General Public License v2.0</name>
      <url>http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Pavel Senin</name>
      <email>seninp@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <url>http://github.com/jMotif/gi.git</url>
    <connection>scm:git:git://git@github.com/jMotif/gi.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/jMotif/gi.git</developerConnection>
    <tag>HEAD</tag>
  </scm>

  <distributionManagement>
    <repository>
      <id>github</id>
      <name>GitHub Packages</name>
      <url>https://maven.pkg.github.com/jMotif/GI</url>
    </repository>
  </distributionManagement>

  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <configuration>
          <release>21</release>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <argLine>${argLine} -Xms512m -Xmx1024m</argLine>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${maven-jacoco-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>**/clusterrule/**</exclude>
            <exclude>**/tinker/**</exclude>
            <exclude>**/cli/**</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>test</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>CodeCoverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin.version}</version>
            <configuration>
              <argLine>${argLine} -Xms512m -Xmx1024m</argLine>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${maven-jacoco-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- ************************ -->
    <profile>
      <id>release</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc-plugin.version}</version>
            <configuration>
              <!-- JDK 9+ javadoc (doclint) rejects legacy HTML4 and out-of-sequence
                   headings in some vendored/legacy sources. Maven Central only requires
                   the javadoc jar to EXIST, not to be lint-clean, so disable doclint and
                   don't fail the build on doc warnings. -->
              <doclint>none</doclint>
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Publishes to Maven Central via the Sonatype Central Portal
               (central.sonatype.com), replacing the retired OSSRH + nexus-staging
               flow (oss.sonatype.org shut down 2025-06-30). publishingServerId must
               match the <server> id in settings.xml (here: 'central').
               autoPublish=false uploads and validates the deployment, leaving the
               final release as a manual Publish click in the Portal UI. -->
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${central-publishing-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>false</autoPublish>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven-gpg-plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>${gpg.keyname}</keyname>
                  <!-- GnuPG 2.4 + gpg-plugin 3.x: the passphrase is supplied by
                       gpg-agent (loopback pinentry) or the MAVEN_GPG_PASSPHRASE
                       env var, not a settings.xml server entry. Force loopback
                       so signing works in a non-interactive / CI shell. -->
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- ************************ -->
    <profile>
      <id>single</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
            <configuration>
              <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
              </descriptorRefs>
              <archive>
                <manifest>
                  <mainClass>net.seninp.gi.rulepruner.RulePrunerPrinter</mainClass>
                </manifest>
              </archive>
              <!-- <filters> <filter>src/assembly/filter.properties</filter> </filters> <descriptors> 
                <descriptor>src/assembly/distribution.xml</descriptor> </descriptors> -->
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id> <!-- this is used for inheritance merges -->
                <phase>package</phase> <!-- bind to the packaging phase -->
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>quality</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>${spotbugs-maven-plugin.version}</version>
            <configuration>
              <effort>Max</effort>
              <includeFilterFile>config/spotbugs-include.xml</includeFilterFile>
              <failOnError>true</failOnError>
            </configuration>
            <executions>
              <execution><id>spotbugs-check</id><phase>verify</phase><goals><goal>check</goal></goals></execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>${maven-pmd-plugin.version}</version>
            <configuration>
              <rulesets><ruleset>config/pmd-ruleset.xml</ruleset></rulesets>
              <targetJdk>21</targetJdk>
              <printFailingErrors>true</printFailingErrors>
              <failOnViolation>true</failOnViolation>
            </configuration>
            <executions>
              <execution><id>pmd-check</id><phase>verify</phase><goals><goal>check</goal></goals></execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>${maven-pmd-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>${maven-jxr-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
      </plugin>
    </plugins>
  </reporting>


</project>
