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

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

    <groupId>org.wildfly.security</groupId>
    <artifactId>elytron-subsystem</artifactId>
    <version>1.0.0.Alpha3</version>

    <name>WildFly: Subsystem Artifact</name>

    <packaging>jar</packaging>

    <properties>
        <version.elytron>1.1.0.Beta1</version.elytron>

        <version.wildfly.core>2.0.0.CR8</version.wildfly.core>

        <version.org.jboss.jboss-dmr>1.3.0.Final</version.org.jboss.jboss-dmr>
        <version.org.jboss.logging.jboss-logging>3.2.1.Final</version.org.jboss.logging.jboss-logging>
        <version.org.jboss.modules.jboss-modules>1.4.3.Final</version.org.jboss.modules.jboss-modules>
        <version.org.jboss.logging.tools>1.2.0.Final</version.org.jboss.logging.tools>
        <version.org.jboss.msc.jboss-msc>1.2.6.Final</version.org.jboss.msc.jboss-msc>
        <version.org.jboss.staxmapper>1.2.0.Final</version.org.jboss.staxmapper>
        <version.org.wildfly.checkstyle-config>1.0.2.Final</version.org.wildfly.checkstyle-config>
        <version.org.wildfly.common>1.0.0.Alpha3</version.org.wildfly.common>
        <version.com.puppycrawl.tools.checkstyle>6.0</version.com.puppycrawl.tools.checkstyle>
        <version.junit>4.11</version.junit>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <module.name>org.wildfly.elytron</module.name>
        
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <scm>
        <connection>scm:git:https://github.com/wildfly-security/elytron-subsystem.git</connection>
        <developerConnection>scm:git:https://github.com/wildfly-security/elytron-subsystem.git</developerConnection>
        <url>https://github.com/wildfly-security/elytron-subsystem</url>
    </scm>
    
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <build>
        <!-- Maven will append the version to the finalName (which is the name
           given to the generated war, and hence the context root) -->
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <enableAssertions>true</enableAssertions>
                    <argLine>-Xmx512m</argLine>
                    <systemProperties>
                        <property>
                            <name>jboss.home</name>
                            <value>${jboss.home}</value>
                        </property>
                    </systemProperties>
                    <includes>
                        <include>**/*TestCase.java</include>
                    </includes>
                    <forkMode>once</forkMode>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <filters>
                        <filter>src/assemble/filter.properties</filter>
                    </filters>
                    <descriptors>
                        <descriptor>src/assemble/distribution.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>

            <plugin>
                <!-- 
                    This may not be retained, depends on how modules will be handled after the core split of WildFly.
                 -->            
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>false</inherited>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>build-dist</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <target>
                                <!-- Replace the '.' in ${module.name} with '/' to get its path  -->
                                <tempfile property="temp.file" />
                                <echo message="${module.name}" file="${temp.file}" />
                                <replace file="${temp.file}" token="." value="/" />
                                <loadfile srcfile="${temp.file}" property="module.path" />
                                <delete file="${temp.file}" />

                                <delete dir="target/module" />
                                <property name="module.dir" value="target/module/${module.path}/main" />

                                <copy file="src/main/resources/module/main/module.xml" tofile="${module.dir}/module.xml" />
                                <copy file="target/${project.artifactId}.jar" todir="${module.dir}" />

                                <echo>Module ${module.name} has been created in the target/module directory. Copy to your WildFly installation.</echo>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Checkstyle -->
            <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/>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.wildfly.checkstyle</groupId>
                        <artifactId>wildfly-checkstyle-config</artifactId>
                        <version>${version.org.wildfly.checkstyle-config}</version>
                    </dependency>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${version.com.puppycrawl.tools.checkstyle}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>check-style</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>checkstyle</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <excludePackageNames>*._private</excludePackageNames>
                </configuration>
            </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>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--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-checkstyle-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.12.1,)
                                        </versionRange>
                                        <goals>
                                            <goal>checkstyle</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller</artifactId>
            <version>${version.wildfly.core}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>*</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.wildfly.security</groupId>
            <artifactId>wildfly-elytron</artifactId>
            <version>${version.elytron}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>*</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jboss-dmr</artifactId>
            <version>${version.org.jboss.jboss-dmr}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.modules</groupId>
            <artifactId>jboss-modules</artifactId>
            <version>${version.org.jboss.modules.jboss-modules}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.msc</groupId>
            <artifactId>jboss-msc</artifactId>
            <version>${version.org.jboss.msc.jboss-msc}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging</artifactId>
            <version>${version.org.jboss.logging.jboss-logging}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>*</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-annotations</artifactId>
            <version>${version.org.jboss.logging.tools}</version>
            <scope>provided</scope>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>*</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.logging</groupId>
            <artifactId>jboss-logging-processor</artifactId>
            <version>${version.org.jboss.logging.tools}</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>staxmapper</artifactId>
            <version>${version.org.jboss.staxmapper}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.common</groupId>
            <artifactId>wildfly-common</artifactId>
            <version>${version.org.wildfly.common}</version>
            <scope>provided</scope>
        </dependency>

        <!-- TEST Dependencies -->
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-subsystem-test</artifactId>
            <type>pom</type>
            <scope>test</scope>
            <version>${version.wildfly.core}</version>
        </dependency>
                <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller-client</artifactId>
            <version>${version.wildfly.core}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <version>${version.junit}</version>
        </dependency>
    </dependencies>
</project>
