<?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>com.techempower</groupId>
	<artifactId>wildfly-ee7</artifactId>
	<version>0.1</version>
	<packaging>war</packaging>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<version.compiler.plugin>3.7.0</version.compiler.plugin>
		<version.war.plugin>3.2.0</version.war.plugin>
		<version.wildfly>12.0.0.Final</version.wildfly>
		<version.mysql.connector>5.1.45</version.mysql.connector>
		<version.javaee.api>7.0</version.javaee.api>
		<version.jboss.spec.javaee.7.0>1.0.3.Final</version.jboss.spec.javaee.7.0>
	</properties>

	<repositories>
		<repository>
			<id>jboss-public-repository-group</id>
			<name>JBoss Public Maven Repository Group</name>
			<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
			<layout>default</layout>
			<releases>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</releases>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>never</updatePolicy>
			</snapshots>
		</repository>
	</repositories>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.jboss.spec</groupId>
				<artifactId>jboss-javaee-7.0</artifactId>
				<version>${version.jboss.spec.javaee.7.0}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.wildfly</groupId>
				<artifactId>wildfly-parent</artifactId>
				<version>${version.wildfly}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>

		<dependency>
			<groupId>javax</groupId>
			<artifactId>javaee-api</artifactId>
			<version>${version.javaee.api}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.spec.javax.servlet</groupId>
			<artifactId>jboss-servlet-api_3.1_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.resteasy</groupId>
			<artifactId>resteasy-jaxrs</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>io.undertow</groupId>
			<artifactId>undertow-servlet</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.spec.javax.ejb</groupId>
			<artifactId>jboss-ejb-api_3.2_spec</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.jboss.logging</groupId>
			<artifactId>jboss-logging</artifactId>
			<scope>provided</scope>
		</dependency>

	</dependencies>

	<build>
		<finalName>${project.artifactId}</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>${version.war.plugin}</version>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${version.compiler.plugin}</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<optimize>true</optimize>
					<debug>false</debug>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>benchmark</id>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-war-plugin</artifactId>
						<version>${version.war.plugin}</version>
						<configuration>
							<failOnMissingWebXml>false</failOnMissingWebXml>
							<outputDirectory>${project.build.directory}/wildfly-${version.wildfly}/standalone/deployments</outputDirectory>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<version>2.8</version>
						<executions>
							<execution>
								<phase>initialize</phase>
								<id>unpack-wildfly-server</id>
								<goals>
									<goal>unpack</goal>
								</goals>
								<configuration>
									<artifactItems>
										<artifactItem>
											<groupId>org.wildfly</groupId>
											<artifactId>wildfly-dist</artifactId>
											<version>${version.wildfly}</version>
											<type>zip</type>
											<overWrite>false</overWrite>
											<outputDirectory>${project.build.directory}</outputDirectory>
										</artifactItem>
									</artifactItems>
								</configuration>
							</execution>
							<execution>
								<phase>initialize</phase>
								<id>copy-mysql-driver</id>
								<goals>
									<goal>copy</goal>
								</goals>
								<configuration>
									<artifactItems>
										<artifactItem>
											<groupId>mysql</groupId>
											<artifactId>mysql-connector-java</artifactId>
											<version>${version.mysql.connector}</version>
											<type>jar</type>
											<outputDirectory>${project.build.directory}/wildfly-${version.wildfly}/standalone/deployments</outputDirectory>
										</artifactItem>
									</artifactItems>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-resources-plugin</artifactId>
						<version>2.6</version>
						<executions>
							<execution>
								<phase>initialize</phase>
								<id>copy-mysql-datasource</id>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/wildfly-${version.wildfly}/standalone/deployments</outputDirectory>
									<resources>
										<resource>
											<directory>${basedir}/server-resources/datasources</directory>
											<filtering>true</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
