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

<!--

    Copyright 2012 Alexey Ragozin

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.gridkit.lab</groupId>
    <artifactId>grid-lab-pom</artifactId>
    <version>2</version>
  </parent>

  <groupId>org.gridkit.jvmtool</groupId>
  <artifactId>jvmtool-umbrella-pom</artifactId>
  <version>0.20</version>
  <name>${project.groupId}::${project.artifactId}</name>
  <description>JVM tools, parent project</description>
  <packaging>pom</packaging>

  <modules>
    <module>sjk-cli</module>
    <module>sjk-stacktrace</module>
    <module>sjk-hflame</module>
    <module>sjk-win32</module>
    <module>sjk-core</module>
    <module>sjk-agent</module>
    <module>sjk-json</module>
    <module>sjk-test</module>
    <module>mxdump</module>
    <module>gcflow</module>
    <module>sjk</module>
    <module>sjk-plus</module>
    <module>ygc-bench</module>
  </modules>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>alexey.ragozin</id>
      <name>Alexey Ragozin</name>
      <email>alexey.ragozin@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/aragozin/jvm-tools.git</connection>
    <developerConnection>scm:git:https://github.com/aragozin/jvm-tools.git</developerConnection>
    <url>https://github.com/aragozin/jvm-tools</url>
    <tag>jvmtool-umbrella-pom-0.20</tag>
  </scm>

  <dependencyManagement>
    <dependencies>

      <!-- Local modules -->
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-cli</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-core</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-stacktrace</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-hflame</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>mxdump</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-json</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-agent</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>sjk-test</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.jvmtool</groupId>
        <artifactId>ygc-bench</artifactId>
        <version>${project.version}</version>
      </dependency>

      <!-- Perfkit modules -->
      <dependency>
        <groupId>org.perfkit.sjk.parsers</groupId>
        <artifactId>sjk-jfr5</artifactId>
        <version>0.5</version>
      </dependency>
      <dependency>
        <groupId>org.perfkit.sjk.parsers</groupId>
        <artifactId>sjk-jfr6</artifactId>
        <version>0.7</version>
      </dependency>
      <dependency>
        <groupId>org.perfkit.sjk.parsers</groupId>
        <artifactId>sjk-nps</artifactId>
        <version>0.9</version>
      </dependency>
      <dependency>
        <groupId>org.perfkit.sjk.parsers</groupId>
        <artifactId>sjk-jfr-standalone</artifactId>
        <version>0.7</version>
      </dependency>
      <dependency>
        <groupId>org.gridkit.lab</groupId>
        <artifactId>jvm-attach-api</artifactId>
        <version>1.5</version>
      </dependency>

      <!-- 3rd party modules -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>1.6.0</version>
      </dependency>
      <dependency>
        <groupId>com.carrotsearch</groupId>
        <artifactId>junit-benchmarks</artifactId>
        <version>0.7.2</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>

    <pluginManagement>
      <plugins>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.0</version>
          <configuration>
            <source>1.6</source>
            <target>1.6</target>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.4</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <pushChanges>true</pushChanges>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.9</version>
          <executions>
            <execution>
              <id>attach-javadoc</id>
              <goals>
                <goal>jar</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
          <configuration>
            <excludes>
              <exclude>java/**</exclude>
              <exclude>jdk/**</exclude>
            </excludes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>net.revelc.code.formatter</groupId>
          <artifactId>formatter-maven-plugin</artifactId>
          <version>2.11.0</version>
        </plugin>

        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>1.31.3</version>
          <configuration>
            <formats>
              <format>
                <!-- Java whitespace formatting -->
                <includes>
                  <include>src/**/java/**/*.java</include>
                </includes>
                <endWithNewline />
                <indent>
                  <spaces>true</spaces>
                  <tabs>false</tabs>
                  <spacesPerTab>4</spacesPerTab>
                </indent>
                <trimTrailingWhitespace />
              </format>
              <format>
                <!-- Java whitespace formatting -->
                <includes>
                  <include>**/pom.xml</include>
                </includes>
                <endWithNewline />
                <indent>
                  <spaces>true</spaces>
                  <tabs>false</tabs>
                  <spacesPerTab>2</spacesPerTab>
                </indent>
                <trimTrailingWhitespace />
              </format>
            </formats>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>

    <profile>
      <id>spotless-check</id>

      <activation>
        <property>
          <name>!disableSpotless</name>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>com.diffplug.spotless</groupId>
            <artifactId>spotless-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>spotless-check</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile>
      <id>enable-toolchain</id>

      <activation>
        <property>
          <name>!disableToolchain</name>
        </property>
      </activation>

      <build>
        <plugins>
          <!-- SJK is 1.6 compatible -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-toolchains-plugin</artifactId>
            <version>1.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>toolchain</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <toolchains>
                <jdk>
                  <version>1.6</version>
                  <vendor>sun</vendor>
                </jdk>
              </toolchains>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>fix-surefire</id>

      <activation>
        <jdk>[11,1000)</jdk>
      </activation>

      <build>
        <pluginManagement>
          <plugins>

            <plugin>
              <!-- Since Java 11 surefire is broken due to text leaking in std out, here is remedy for that. -->
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>3.0.0-M5</version>
              <configuration>
                <forkNode implementation="org.apache.maven.plugin.surefire.extensions.SurefireForkNodeFactory" />
                <!-- additional encantation to work around Java 11 nonsense -->
                <argLine>-Djdk.attach.allowAttachSelf=true --add-opens java.base/jdk.internal.perf=ALL-UNNAMED --add-opens jdk.attach/sun.tools.attach=ALL-UNNAMED -Dsjk.breakCage=false</argLine>
              </configuration>
            </plugin>

          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>fix-post-11-compile</id>

      <activation>
        <jdk>[12,1000)</jdk>
      </activation>

      <build>
        <pluginManagement>
          <plugins>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <configuration>
                <source>1.8</source>
                <target>1.8</target>
              </configuration>
            </plugin>

          </plugins>
        </pluginManagement>
      </build>

    </profile>

  </profiles>

</project>
