<?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>dev.aspectj</groupId>
  <artifactId>agent-embedder-maven-plugin</artifactId>
  <version>1.0</version>
  <packaging>maven-plugin</packaging>

  <organization>
    <name>AspectJ.dev</name>
    <url>https://github.com/dev-aspectj</url>
  </organization>

  <name>Agent Embedder Maven Plugin</name>
  <description>
    Embeds java agents into an executable JAR file, executing them automatically during application start on JRE 9+
  </description>
  <inceptionYear>2024</inceptionYear>

  <url>https://github.com/dev-aspectj/agent-embedder-maven-plugin</url>
  <licenses>
    <license>
      <name>GNU Lesser General Public License v2.1 or later</name>
      <url>https://spdx.org/licenses/LGPL-2.1-or-later.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <parent.java.home>${java.home}</parent.java.home>
    <maven-plugin-tools.version>3.10.2</maven-plugin-tools.version>
    <groovy.version>4.0.19</groovy.version>
    <maven-plugin-plugin.version>3.11.0</maven-plugin-plugin.version>
    <doxiaVersion>2.0.0-M8</doxiaVersion>
    <doxiaSitetoolsVersion>2.0.0-M16</doxiaSitetoolsVersion>
    <maven-fluido-skin.version>1.11.1</maven-fluido-skin.version>
  </properties>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/dev-aspectj/agent-embedder-maven-plugin/issues/</url>
  </issueManagement>
  <ciManagement>
    <system>GitHub</system>
    <url>https://github.com/dev-aspectj/agent-embedder-maven-plugin/actions</url>
  </ciManagement>

  <scm>
    <connection>scm:git:https://github.com/dev-aspectj/agent-embedder-maven-plugin.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/dev-aspectj/agent-embedder-maven-plugin.git</developerConnection>
    <url>https://github.com/dev-aspectj/agent-embedder-maven-plugin</url>
  </scm>

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

  <developers>
    <developer>
      <id>kriegaex</id>
      <name>Alexander Kriegisch</name>
      <email>kriegaex@aspectj.dev</email>
      <organization>Scrum-Master.de - Agile Project Management</organization>
      <organizationUrl>https://scrum-master.de</organizationUrl>
      <roles>
        <role>Maintainer</role>
        <role>Java Developer</role>
      </roles>
    </developer>
  </developers>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-bom</artifactId>
        <version>2.3-groovy-4.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>${maven-plugin-plugin.version}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>3.2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>3.2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${maven-plugin-tools.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Mandatory dependencies for using Spock -->
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-junit4</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- Optional dependencies for using Spock -->
    <dependency> <!-- use a specific Groovy version rather than the one specified by spock-core -->
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency> <!-- enables mocking of classes (in addition to interfaces) -->
      <groupId>net.bytebuddy</groupId>
      <artifactId>byte-buddy</artifactId>
      <version>1.14.10</version>
      <scope>test</scope>
    </dependency>
    <dependency> <!-- enables mocking of classes without default constructor (together with ByteBuddy or CGLIB) -->
      <groupId>org.objenesis</groupId>
      <artifactId>objenesis</artifactId>
      <version>3.3</version>
      <scope>test</scope>
    </dependency>
    <dependency> <!-- only required if Hamcrest matchers are used -->
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>2.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.google.jimfs</groupId>
      <artifactId>jimfs</artifactId>
      <version>1.3.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.marschall</groupId>
      <artifactId>memoryfilesystem</artifactId>
      <version>2.8.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.obsidiandynamics.pojotester</groupId>
      <artifactId>core</artifactId>
      <version>0.9.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.12.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.6.0</version>
          <configuration>
            <quiet>true</quiet>
            <!-- Amend mojo-parent default config, avoiding errors concerning modules vs. unnamed module packages -->
            <source>8</source>
            <!-- Reproducible builds, https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
            <notimestamp>true</notimestamp>
            <!--
              Avoid non-English javadoc generation. Due to https://bugs.openjdk.org/browse/JDK-8222793 reoccurring at
              least in JDKs 19-21 and also being broken in some older JDKs, we cannot rely on just setting the locale
              parameter, but also need the 'user.language' and 'user.country' parameters in 'additionalJOptions' as a
              workaround.
            -->
            <locale>en</locale>
            <additionalJOptions>
              <additionalJOption>-J-Dfile.encoding=UTF-8</additionalJOption>
              <additionalJOption>-J-Duser.language=en</additionalJOption>
              <additionalJOption>-J-Duser.country=US</additionalJOption>
            </additionalJOptions>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.12.1</version>
          <configuration>
            <generateReports>true</generateReports>
            <generateSitemap>true</generateSitemap>
            <relativizeDecorationLinks>false</relativizeDecorationLinks>
            <locales>en</locales>
            <inputEncoding>UTF-8</inputEncoding>
            <outputEncoding>UTF-8</outputEncoding>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${maven-plugin-plugin.version}</version>
          <executions>
            <execution>
              <id>help-mojo</id>
              <goals>
                <goal>helpmojo</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-report-plugin</artifactId>
          <version>${maven-plugin-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.2.5</version>
          <configuration>
            <skip>false</skip>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.6.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.1.0</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <!--
            Other than Maven Deploy, this plugin cannot just be added to the 'build/plugins' section of the parent POM
            once and (de-)activated with a simple property like 'maven.deploy.skip' on a per-module basis. See also
            https://issues.sonatype.org/browse/OSSRH-68966. Consequently, we do not add it to the parent but separately
            to each module meant to be published.
          -->
          <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://s01.oss.sonatype.org/</nexusUrl>
            <!-- Activate in order to directly release to Maven Central after successful staging -->
            <autoReleaseAfterClose>false</autoReleaseAfterClose>
          </configuration>
          <dependencies>
            <!--
              Plugin version 1.6.8 does not work on JDK 16+ without special MAVEN_OPTS opening certain modules,
              because the XStream version used needs it. One workaround is to use a more recent XStream version.
              Attention: Do *not* upgrade to e.g. 1.4.18, because it causes exceptions during deployment.
              TODO: remove plugin dependency after OSSRH-66257, NEXUS-26993 are fixed.
            -->
            <dependency>
              <groupId>com.thoughtworks.xstream</groupId>
              <artifactId>xstream</artifactId>
              <version>1.4.15</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>${maven-plugin-tools.version}</version>
        <executions>
          <execution>
            <id>help-mojo</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>compileTests</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.5</version>
        <configuration>
          <useFile>false</useFile>
          <statelessTestsetReporter
            implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
            <disable>false</disable>
            <version>3.0</version>
            <usePhrasedFileName>false</usePhrasedFileName>
            <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
            <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
            <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
          </statelessTestsetReporter>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>run-its</id>
      <activation>
        <!--
          CAVEAT: 'activeByDefault=true' does not work reliably and immediately deactivate the profile, as soon as
          other profiles are activated explicitly or via activation conditions, either in this POM or in the Mojohaus
          parent. See https://stackoverflow.com/a/5309576/1082681, https://issues.apache.org/jira/browse/MNG-4917.

          Therefore, we activate it based on a file which always exists. Thanks, Maven! :-/
          Note: ${project.basedir} is not supported during profile activation, use ${basedir} instead.
        -->
        <file>
          <exists>${basedir}/pom.xml</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>3.6.0</version>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <projectsDirectory>src/it</projectsDirectory>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <postBuildHookScript>verify</postBuildHookScript>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <goals>
                <goal>clean</goal>
                <goal>verify</goal>
              </goals>
              <setupIncludes>
                <setupInclude>RemoveFinalAgent/pom.xml</setupInclude>
              </setupIncludes>
              <settingsFile>src/it/settings.xml</settingsFile>
              <!-- Activate to debug ITs -->
              <debug>false</debug>
              <showErrors>true</showErrors>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- GPG Signature on release -->
    <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>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>default-jar-no-fork</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-report-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

</project>
