<?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>org.hotswapagent</groupId>
    <artifactId>hotswap-agent-parent</artifactId>
    <packaging>pom</packaging>
    <version>${revision}</version>

    <name>HotswapAgent</name>
    <description>Java unlimited runtime class and resource redefinition.</description>
    <url>http://hotswapagent.org/</url>

    <scm>
        <url>https://github.com/HotswapProjects/HotswapAgent</url>
        <connection>scm:git:git://github.com/HotswapProjects/HotswapAgent.git</connection>
        <developerConnection>scm:git:git@github.com:HotswapProjects/HotswapAgent.git</developerConnection>
    </scm>

    <issueManagement>
        <system>git</system>
        <url>https://github.com/HotswapProjects/HotswapAgent/issues</url>
    </issueManagement>
    <licenses>
        <license>
            <name>GNU General Public License (GPL)</name>
            <url>http://www.gnu.org/licenses/gpl.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <email>jiri.bubnik@gmail.com</email>
            <name>Jiri Bubnik</name>
            <url>http://jiribubnik.cz</url>
            <id>edudant</id>
        </developer>
        <developer>
            <email>lada.dvorak7@gmail.com</email>
            <name>Vladimir Dvorak</name>
            <url>https://github.com/skybber</url>
            <id>skybber</id>
        </developer>
    </developers>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.4</version>
                    <configuration>
                        <argLine>-XX:+AllowEnhancedClassRedefinition</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <!--<plugin>-->
                    <!--<groupId>org.eclipse.m2e</groupId>-->
                    <!--<artifactId>lifecycle-mapping</artifactId>-->
                    <!--<version>1.0.0</version>-->
                    <!--<configuration>-->
                        <!--<lifecycleMappingMetadata>-->
                            <!--<pluginExecutions>-->
                                <!--<pluginExecution>-->
                                    <!--<pluginExecutionFilter>-->
                                        <!--<groupId>-->
                                            <!--org.apache.maven.plugins-->
                                        <!--</groupId>-->
                                        <!--<artifactId>-->
                                            <!--maven-dependency-plugin-->
                                        <!--</artifactId>-->
                                        <!--<versionRange>-->
                                            <!--[2.8,)-->
                                        <!--</versionRange>-->
                                        <!--<goals>-->
                                            <!--<goal>properties</goal>-->
                                        <!--</goals>-->
                                    <!--</pluginExecutionFilter>-->
                                    <!--<action>-->
                                        <!--<execute />-->
                                    <!--</action>-->
                                <!--</pluginExecution>-->
                            <!--</pluginExecutions>-->
                        <!--</lifecycleMappingMetadata>-->
                    <!--</configuration>-->
                <!--</plugin>-->
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- executes test with -javaagent option -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                    <parallel>none</parallel>
                    <!--
                    <useSystemClassLoader>true</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                    <argLine>-javaagent:${org.hotswapagent:hotswap-agent-core:jar} -Xbootclasspath/a:"${org.hotswapagent:hotswap-agent-core:jar}:${project.build.OutputDirectory}"</argLine>
                     -->
                    <argLine>${dcevm.test.arguments} -javaagent:${project.basedir}/../../hotswap-agent-core/target/hotswap-agent-core-${project.version}.jar</argLine>
                    <jvm>${java.home}/bin/java</jvm>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.7.3</version>
                <configuration>
                    <flattenMode>ossrh</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>flatten-clean</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>

            <distributionManagement>
                <repository>
                    <id>central-hotswap-agent-release</id>
                    <url>https://central.sonatype.com/</url>
                </repository>
                <snapshotRepository>
                    <id>central-hotswap-agent-release</id>
                    <url>https://central.sonatype.com/</url>
                </snapshotRepository>
            </distributionManagement>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.10.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <failOnError>false</failOnError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <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>
                                <configuration>
                                    <keyname>jiri.bubnik@gmail.com</keyname>
                                    <passphraseServerId>gpg.passphrase</passphraseServerId>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.6.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central-hotswap-agent-release</publishingServerId>
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>default-tools</id>
            <activation>
                <jdk>(,11)</jdk>
            </activation>

            <dependencyManagement>
                <dependencies>
                    <!-- Tools jar is needed at runtime to allow JPDA hotswap -->
                    <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>${java.version}</version>
                        <scope>system</scope>
                        <systemPath>${java.home}/../lib/tools.jar</systemPath>
                        <optional>true</optional>
                    </dependency>                </dependencies>
            </dependencyManagement>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <!-- Test dependencies -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.13.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jmock</groupId>
                <artifactId>jmock-junit4</artifactId>
                <version>2.13.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.jmock</groupId>
                <artifactId>jmock-legacy</artifactId>
                <version>2.13.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm</artifactId>
                <version>9.9</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <properties>
        <revision>2.0.3</revision>
        <dcevm>dcevm</dcevm>
        <dcevm.test.arguments>-XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=external
            --add-exports java.base/sun.security.action=ALL-UNNAMED
            --add-exports java.base/sun.security.util=ALL-UNNAMED
            --add-opens java.base/java.lang.reflect=ALL-UNNAMED
            --add-opens=java.base/sun.nio.ch=ALL-UNNAMED</dcevm.test.arguments>
        <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>


</project>
