<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2014 Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags.
  ~
  ~ 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.
  -->

<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.jboss.modules</groupId>
    <artifactId>jboss-modules</artifactId>
    <version>2.1.6.Final</version>
    <name>JBoss Modules</name>

    <parent>
        <groupId>org.jboss</groupId>
        <artifactId>jboss-parent</artifactId>
        <version>47</version>
    </parent>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://repository.jboss.org/licenses/apache-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
        <license>
            <name>Indiana University Extreme! Lab Software License 1.1.1</name>
            <url>http://www.bearcave.com/software/java/xml/xmlpull_license.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <version.javadoc.plugin>3.4.1</version.javadoc.plugin>
        <version.junit>4.13.2</version.junit>
        <version.org.jacoco>0.8.12</version.org.jacoco>
        <version.org.jboss.shrinkwrap>1.2.6</version.org.jboss.shrinkwrap>
        <version.org.wildfly.checkstyle-config>1.0.8.Final</version.org.wildfly.checkstyle-config>
        <version.org.jboss.bridger>1.6.Final</version.org.jboss.bridger>
        <version.surefire.plugin>3.0.0-M7</version.surefire.plugin>
        <jdk.min.version>11</jdk.min.version>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>target/generated-resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                    <configuration>
                        <configLocation>wildfly-checkstyle/checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        <useFile/>
                        <excludes>**/MXParser.java</excludes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.wildfly.checkstyle</groupId>
                            <artifactId>wildfly-checkstyle-config</artifactId>
                            <version>${version.org.wildfly.checkstyle-config}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>check-style</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>checkstyle</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <!-- Compiler -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <release>11</release>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Surefire -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                     <!-- Modules ignores Class-Path -->
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                    <reuseForks>false</reuseForks>
                    <!-- org.jboss.modules.util package is defined in tests folder -->
                    <argLine>@{argLine} --add-exports=org.jboss.modules/org.jboss.modules.util=ALL-UNNAMED</argLine>
                </configuration>
            </plugin>

            <!-- JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>org.jboss.modules.Main</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Multi-Release>true</Multi-Release>
                            <Jar-Version>${project.version}</Jar-Version>
                            <Jar-Name>${project.artifactId}</Jar-Name>
                            <Agent-Class>org.jboss.modules.ModularAgent</Agent-Class>
                            <Premain-Class>org.jboss.modules.ModularAgent</Premain-Class>
                            <Can-Redefine-Classes>true</Can-Redefine-Classes>
                            <Can-Retransform-Classes>true</Can-Retransform-Classes>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <detectJavaApiLink>false</detectJavaApiLink>
                    <excludePackageNames>org.jboss.modules._private</excludePackageNames>
                </configuration>
            </plugin>

            <!-- Bridger -->
            <plugin>
                <groupId>org.jboss.bridger</groupId>
                <artifactId>bridger</artifactId>
                <version>${version.org.jboss.bridger}</version>
                <executions>
                     <!-- run after "compile", runs bridger on main classes -->
                     <execution>
                         <id>weave</id>
                         <phase>process-classes</phase>
                         <goals>
                             <goal>transform</goal>
                         </goals>
                     </execution>
                </executions>
            </plugin>

            <!-- Code Coverage -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.org.jacoco}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-code-coverage-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.jboss.shrinkwrap</groupId>
            <artifactId>shrinkwrap-impl-base</artifactId>
            <version>${version.org.jboss.shrinkwrap}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
