<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>cc.mallet</groupId>
  <artifactId>mallet</artifactId>
  <version>2.1.0</version>
  <packaging>jar</packaging>
  <name>MAchine Learning for LanguagE Toolkit (MALLET)</name>
  <description>
    MALLET is a Java-based package for statistical natural language processing,
    document classification, clustering, topic modeling, information extraction,
    and other machine learning applications to text.
  </description>
  <url>http://mallet.cs.umass.edu/</url>

  <licenses>
    <license>
      <name>Apache 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/mimno/Mallet</url>
    <connection>scm:git:git://github.com/mimno/Mallet.git</connection>
    <developerConnection>scm:git:git@github.com:mimno/Mallet.git</developerConnection>
  </scm>

  <developers>
    <developer>
      <id>david.mimno</id>
      <name>David Mimno</name>
      <email>mimno@cornell.edu</email>
    </developer>
    <developer>
      <id>gregory.druck</id>
      <name>Gregory Druck</name>
      <email>gdruck@cs.umass.edu</email>
    </developer>
  </developers>

  <properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <encoding>UTF-8</encoding>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <error-prone.version>2.24.1</error-prone.version>
    <maven-jacoco-plugin.version>0.8.11</maven-jacoco-plugin.version>
    <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
    <maven-source-plugin.version>2.2.1</maven-source-plugin.version>
    <maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version>
  </properties>

  <build>

    <sourceDirectory>src/main/java</sourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>

    <plugins>

      <!-- Compile project using Google Error-Prone -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven-compiler-plugin.version}</version>
            <configuration>
                <source>17</source>
                <target>17</target>
                <showWarnings>true</showWarnings>
                <compilerArgs>
                    <arg>-Xlint:all</arg>
                </compilerArgs>
            </configuration>
        </plugin>

        <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-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Javadoc Generation -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.6.3</version>
            <configuration>
                <doclint>none</doclint>
                <source>17</source>
            </configuration>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>


        <!-- Code Coverage Reports -->
        <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>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

      <!-- GPG signing for Maven Central -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.2.7</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Maven Central Portal Publishing -->
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.6.0</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
          <autoPublish>true</autoPublish>
          <waitUntil>published</waitUntil>
        </configuration>
      </plugin>

      <!-- Copy dependencies for bin/mallet script -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.6.1</version>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/dependency</outputDirectory>
              <includeScope>runtime</includeScope>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Unit tests -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <!-- Parallel execution disabled: some tests capture System.out -->
          <skipTests>false</skipTests>
          <includes>
            <include>**/*Test.java</include>
            <include>**/Test*.java</include>
          </includes>
          <systemProperties>
            <property>
              <name>java.util.logging.config.file</name>
              <value>src/test/resources/logging.properties</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.google.errorprone</groupId>
      <artifactId>error_prone_annotations</artifactId>
      <version>${error-prone.version}</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.carrotsearch/hppc -->
    <dependency>
      <groupId>com.carrotsearch</groupId>
      <artifactId>hppc</artifactId>
      <version>0.8.1</version>
    </dependency>
  </dependencies>


  <profiles>
    <profile>
      <id>publish-on-github-packages</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven-source-plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <distributionManagement>
        <repository>
          <id>github</id>
          <name>GitHub Packages</name>
          <url>https://maven.pkg.github.com/mimno/mallet</url>
        </repository>
      </distributionManagement>
    </profile>

      <!-- Optional Error Prone profile -->
      <profile>
          <id>errorprone</id>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>${maven-compiler-plugin.version}</version>
                      <configuration>
                          <release>17</release>
                          <showWarnings>true</showWarnings>
                          <compilerArgs>
                              <arg>-Xplugin:ErrorProne</arg>
                              <arg>-Xep:ClassName</arg>
                              <arg>-Xep:DepAnn</arg>
                              <arg>-Xep:EmptyIf</arg>
                              <arg>-Xep:NoAllocation</arg>
                              <arg>-Xep:NumericEquality</arg>
                              <arg>-Xep:NonCanonicalStaticMemberImport</arg>
                              <arg>-Xep:PrimitiveArrayPassedToVarargsMethod</arg>
                              <arg>-Xep:StringEquality</arg>
                              <arg>-Xep:Var</arg>
                              <arg>-Xep:WildcardImport</arg>
                              <arg>-XepDisableWarningsInGeneratedCode</arg>
                          </compilerArgs>
                          <annotationProcessorPaths>
                              <path>
                                  <groupId>com.google.errorprone</groupId>
                                  <artifactId>error_prone_core</artifactId>
                                  <version>${error-prone.version}</version>
                              </path>
                          </annotationProcessorPaths>
                      </configuration>
                      <dependencies>
                          <dependency>
                              <groupId>com.google.errorprone</groupId>
                              <artifactId>error_prone_core</artifactId>
                              <version>${error-prone.version}</version>
                          </dependency>
                      </dependencies>
                  </plugin>
              </plugins>
          </build>
      </profile>


  </profiles>
</project>
