<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.meeuw.math</groupId>
  <artifactId>mihxil-math-parent</artifactId>
  <name>Math - parent</name>
  <packaging>pom</packaging>
  <version>0.7.0</version>

  <description>Math related utilities. Measurements (with error indication)</description>
  <url>https://github.com/mihxil/math</url>

  <modules>
    <module>mihxil-configuration</module>
    <module>mihxil-math</module>
    <module>mihxil-math-theories</module>

    <module>mihxil-physics</module>
    <module>mihxil-statistics</module>
    <module>mihxil-algebra</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <java.target.version>8</java.target.version>
    <!-- compile time -->
    <lombok.version>1.18.22</lombok.version>

    <!-- optional -->
    <big-math.version>2.3.0</big-math.version>
    <checkerframework.version>3.21.1</checkerframework.version>

    <!-- test dependencies -->
    <log4j.version>2.17.1</log4j.version>
    <jqwik.version>1.6.2</jqwik.version>
    <junit.version>5.8.2</junit.version>
    <jacoco.version>0.8.7</jacoco.version>
    <assertj.version>3.22.0</assertj.version>
    <reflections.version>0.10.2</reflections.version>
  </properties>


  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>mihxil</id>
      <name>Michiel Meeuwissen</name>
      <email>michiel.meeuwissen+github@gmail.com</email>
      <url>https://meeuw.org</url>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>

  <dependencyManagement>
    <dependencies>
       <dependency>
        <groupId>org.meeuw.configuration</groupId>
        <artifactId>mihxil-configuration</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-math</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-math-theories</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-math-test</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-algebra</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-physics</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.meeuw.math</groupId>
        <artifactId>mihxil-statistics</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.obermuhlner</groupId>
        <artifactId>big-math</artifactId>
        <version>${big-math.version}</version>
        <optional>true</optional>
      </dependency>
      <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>2.0.1.Final</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>net.jqwik</groupId>
        <artifactId>jqwik</artifactId>
        <version>${jqwik.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-jul</artifactId>
        <version>${log4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.reflections</groupId>
        <artifactId>reflections</artifactId>
        <version>${reflections.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>

    <dependency>
      <groupId>org.checkerframework</groupId>
      <artifactId>checker-qual</artifactId>
      <version>${checkerframework.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.jqwik</groupId>
      <artifactId>jqwik</artifactId>
      <scope>test</scope>
    </dependency>


  <!--  <dependency>
      <groupId>org.mapstruct</groupId>
      <artifactId>mapstruct-processor</artifactId>
      <version>1.3.0.Final</version>
    </dependency>-->
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-jul</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <scm>
    <connection>scm:git:${project.scm.url}</connection>
    <developerConnection>scm:git:${project.scm.url}</developerConnection>
    <url>https://github.com/mihxil/math</url>
    <tag>0.7.0</tag>
  </scm>

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


  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>17</source>
          <target>17</target>
          <compilerArgs>
            <arg>-AprintErrorStack</arg>
            <arg>-Awarns</arg>
          </compilerArgs>
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
        <executions>
          <execution>
            <id>default-compile</id>
            <configuration>
              <!-- compile everything to ensure module-info contains right entries -->
              <source>17</source>
              <release>17</release>
            </configuration>
          </execution>
          <execution>
            <id>base-compile</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <!-- recompile everything for target VM except the module-info.java -->
            <configuration>
              <excludes>
                <exclude>module-info.java</exclude>
              </excludes>
              <source>${java.target.version}</source>
              <release>${java.target.version}</release>
            </configuration>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <source>17</source>
              <release>17</release>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.0.5</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <branchName>${project.version}</branchName>
          <tagNameFormat>@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
          <configuration>
            <testFailureIgnore>true</testFailureIgnore>
            <useModulePath>false</useModulePath>
            <excludes>
              <exclude />
            </excludes>
            <includes>
              <include>**/*Test.java</include>
              <include>%regex[.*Test[\$\.].*]</include>
            </includes>
            <systemPropertyVariables>
              <projectArtifactId>${project.artifactId}</projectArtifactId>

              <!--
               logging in tests cases is arranged with log4j2
               code itself may log with jul (to avoid dependencies).
               This makes it log to log4j2
              -->
              <java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager>
            </systemPropertyVariables>
            <argLine>@{argLine} -Dfile.encoding=UTF-8</argLine>
            <properties>
              <configurationParameters>
                jqwik.database=jqwik-database
                jqwik.tries.default=200
                jqwik.maxdiscardratio.default=5
                jqwik.reporting.usejunitplatform=true
                jqwik.failures.after.default=PREVIOUS_SEED
                jqwik.reporting.onlyFailures=true
                jqwik.edgecases.default=MIXIN
                jqwik.shrinking.default=OFF
              </configurationParameters>
            </properties>
            <redirectTestOutputToFile>true</redirectTestOutputToFile>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>ch.obermuhlner</groupId>
              <artifactId>big-math</artifactId>
              <version>${big-math.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.version}</version>
          <configuration>
            <append>true</append>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>no-deploy</id>
      <build>
        <defaultGoal>clean test</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>agent</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <append>true</append>
                </configuration>
              </execution>
              <execution>
                <id>post-unit-test</id>
                <phase>test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <activation>
        <property>
          <name>!deploy</name>
        </property>
      </activation>
      <modules>
        <module>mihxil-math-test</module>
        <module>report-aggregation</module>
      </modules>
    </profile>
    <profile>
      <id>deploy</id>
      <activation>
        <property>
          <name>deploy</name>
        </property>
      </activation>
      <build>
        <defaultGoal>deploy</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.8</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-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>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</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>3.3.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
