<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<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>35</version>
        <relativePath />
    </parent>

    <groupId>org.wildfly.archetype</groupId>
    <artifactId>wildfly-subsystem-src</artifactId>
    <version>20.0.0.Final</version>

    <name>WildFly Archetypes: Subsystem Archetype</name>

    <packaging>jar</packaging>

    <properties>
        <version.wildfly.core>11.1.1.Final</version.wildfly.core>
        <version.junit>4.12</version.junit>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <module.name>${module}</module.name>
    </properties>

    <scm>
        <connection>scm:git:https://github.com/wildfly/archetypes.git</connection>
        <developerConnection>scm:git:https://github.com/wildfly/archetypes.git</developerConnection>
        <url>https://github.com/wildfly/archetypes/</url>
    </scm>

    <licenses>
        <license>
            <name>LGPL 2.1</name>
            <url>http://www.gnu.org/licenses/lgpl-2.1.html</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>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <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>
                <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>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.core</groupId>
                <artifactId>wildfly-controller</artifactId>
                <version>${version.wildfly.core}</version>
            </dependency>
            <dependency>
                <groupId>org.wildfly.core</groupId>
                <artifactId>wildfly-server</artifactId>
                <version>${version.wildfly.core}</version>
            </dependency>
            <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>junit</groupId>
                <artifactId>junit</artifactId>
                <scope>test</scope>
                <version>${version.junit}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-controller</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.core</groupId>
            <artifactId>wildfly-subsystem-test</artifactId>
            <type>pom</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
