<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>dk.nsi.minlog</groupId>
		<artifactId>registration</artifactId>
		<version>1.1.0</version>
	</parent>

	<groupId>dk.nsi.minlog.registration</groupId>
	<artifactId>minlog-registration-ear</artifactId>
	<packaging>ear</packaging>

	<dependencies>
		<dependency>
			<groupId>dk.nsi.minlog.registration</groupId>
			<artifactId>minlog-registration-app</artifactId>
			<version>1.1.0</version>
			<type>ejb</type>
		</dependency>
		<!--suppress MavenDuplicateDependenciesInspection -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		<dependency>
			<groupId>dk.sosi.seal</groupId>
			<artifactId>seal</artifactId>
			<version>2.1.1</version>
			<exclusions>
				<exclusion>
					<groupId>axis</groupId>
					<artifactId>axis</artifactId>
				</exclusion>
				<exclusion>
					<groupId>xalan</groupId>
					<artifactId>xalan</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>

	<build>
		<finalName>minlog-registration</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-ear-plugin</artifactId>
				<version>2.7</version>
				<configuration>
					<defaultLibBundleDir>lib</defaultLibBundleDir>
					<modules>
						<ejbModule>
							<bundleFileName>minlog-registration.jar</bundleFileName>
							<groupId>dk.nsi.minlog.registration</groupId>
							<artifactId>minlog-registration-app</artifactId>
						</ejbModule>
					</modules>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>deploy-to-appserver</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>properties-maven-plugin</artifactId>
						<version>1.0-alpha-2</version>
						<executions>
							<execution>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>read-project-properties</goal>
								</goals>
								<configuration>
									<files>
										<file>${basedir}/../../../common/src/test/resources/environment.${user.name}.properties</file>
									</files>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.7</version>
						<executions>
							<execution>
								<id>Copy configuration</id>
								<phase>pre-integration-test</phase>
								<configuration>
									<target>
										<copy
											file="${basedir}/src/test/resources/nspslalog-MinLogRegistrationBean.properties"
											todir="${jbosshome}/server/default/conf" />
										<copy
											file="${basedir}/src/test/resources/log4j-nspslalog-minlogregistration.properties"
											todir="${jbosshome}/server/default/conf" />
										<copy
											file="${basedir}/src/test/resources/MinLogRegistration.properties"
											todir="${jbosshome}/server/default/conf" />
										<copy file="${basedir}/src/test/resources/minlog.log4j.properties"
											todir="${jbosshome}/server/default/conf" />
										<copydir
											src="${basedir}/../../../common/src/test/resources/jks/jks-for-it"
											dest="${jbosshome}/server/default/conf/" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
							<execution>
								<id>Deploy</id>
								<phase>pre-integration-test</phase>
								<configuration>
									<target>
										<copy file="${basedir}/target/minlog-registration.ear"
											todir="${jbosshome}/server/default/deploy" />
										<echo
											message="Wait 10 seconds after copy and touch destination file to force JBoss to reload service" />
										<sleep milliseconds="2000" />
										<touch
											file="${jbosshome}/server/default/deploy/minlog-registration.ear"
											datetime="now" />
										<sleep milliseconds="10000" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</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</version>
							<configuration>
								<lifecycleMappingMetadata>
									<pluginExecutions>
										<pluginExecution>
											<pluginExecutionFilter>
												<groupId>
													org.codehaus.mojo
												</groupId>
												<artifactId>
													properties-maven-plugin
												</artifactId>
												<versionRange>
													[1.0-alpha-2,)
												</versionRange>
												<goals>
													<goal>
														read-project-properties
													</goal>
												</goals>
											</pluginExecutionFilter>
											<action>
												<execute />
											</action>
										</pluginExecution>
										<pluginExecution>
											<pluginExecutionFilter>
												<groupId>
													org.apache.maven.plugins
												</groupId>
												<artifactId>
													maven-ear-plugin
												</artifactId>
												<versionRange>
													[2.7,)
												</versionRange>
												<goals>
													<goal>
														generate-application-xml
													</goal>
												</goals>
											</pluginExecutionFilter>
											<action>
												<execute />
											</action>
										</pluginExecution>
									</pluginExecutions>
								</lifecycleMappingMetadata>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>
	</profiles>
</project>
