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

	<parent>
		<groupId>fish.focus.uvms.usm</groupId>
		<artifactId>Information-Module</artifactId>
		<version>2.2.13</version>
	</parent>
	<artifactId>Information-Rest-Service</artifactId>
	<packaging>war</packaging>

	<properties>
		<webroot>usm-information</webroot>
		<restprefix>rest</restprefix>
		<!-- to prevent M2e overriding the web-context in weblogic.xml -->
		<m2eclipse.wtp.contextRoot>${webroot}</m2eclipse.wtp.contextRoot>
		<deploy.phase>pre-integration-test</deploy.phase>
		<clean.phase>clean</clean.phase>
	</properties>

	<profiles>
		<profile>
			<id>http</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<deploy.phase>no-phase</deploy.phase>
				<clean.phase>no-phase</clean.phase>
				<skipITs>true</skipITs>
			</properties>
		</profile>
		<profile>
			<id>wildfly</id>
			<properties>
				<log.dir>${jboss.server.log.dir}/usm</log.dir>
				<endpoint-url>https://${wf.host}:${wf.https.port}/${webroot}/${restprefix}/</endpoint-url>
			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>org.wildfly.plugins</groupId>
						<artifactId>wildfly-maven-plugin</artifactId>
						<configuration>
							<hostname>${wf.host}</hostname>
							<port>${wf.mgtport}</port>
							<username>${wf.adminUserName}</username>
							<password>${wf.adminPassword}</password>
						</configuration>
						<executions>
							<execution>
								<id>deploy-app</id>
								<phase>${deploy.phase}</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
								<configuration>
									<filename>${project.artifactId}.war</filename>
								</configuration>
							</execution>
							<execution>
								<phase>${clean.phase}</phase>
								<goals>
									<goal>undeploy</goal>
								</goals>
								<configuration>
									<matchPattern>${project.artifactId}.*</matchPattern>
									<matchPatternStrategy>all</matchPatternStrategy>
									<ignoreMissingDeployment>true</ignoreMissingDeployment>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>weblogic</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<log.dir>logs/usm</log.dir>
				<hostname>${wls.host}</hostname>
				<port>${wls.port}</port>
				<endpoint-url>https://${wls.host}:${wls.https.port}/${webroot}/${restprefix}/</endpoint-url>
			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>com.oracle.weblogic</groupId>
						<artifactId>weblogic-maven-plugin</artifactId>
						<version>12.1.1.0</version>
						<executions>
							<execution>
								<id>deploy-app</id>
								<phase>${deploy.phase}</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
							</execution>
							<execution>
								<id>undeploy-rest-service</id>
								<phase>${clean.phase}</phase>
								<goals>
									<goal>undeploy</goal>
								</goals>
								<configuration>
									<failonerror>false</failonerror>
									<name>${project.artifactId}</name>
								</configuration>
							</execution>
						</executions>
						<configuration>
							<targets>${wls.target}</targets>
							<adminurl>t3://${wls.host}:${wls.port}</adminurl>
							<user>${wls.adminUserName}</user>
							<password>${wls.adminPassword}</password>
							<upload>true</upload>
							<action>deploy</action>
							<remote>true</remote>
							<verbose>true</verbose>
							<source>${project.build.directory}/${project.artifactId}.war</source>
							<name>${project.artifactId}</name>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>swagger</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>3.3.2</version>
						<executions>
							<execution>
								<id>generate-service-docs</id>
								<phase>generate-resources</phase>
								<configuration>
									<doclet>com.carma.swagger.doclet.ServiceDoclet</doclet>
									<docletArtifact>
										<groupId>com.carma</groupId>
										<artifactId>swagger-doclet</artifactId>
										<version>1.0.4.1</version>
									</docletArtifact>
									<reportOutputDirectory>${project.build.directory}/${project.build.finalName}</reportOutputDirectory>
									<useStandardDocletOptions>false</useStandardDocletOptions>
									<additionalparam>
										-apiVersion ${project.version}
										-docBasePath
										/${webroot}/apidocs
										-apiBasePath /${webroot}/${restprefix}
									</additionalparam>
								</configuration>
								<goals>
									<goal>javadoc</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.3.2</version>
				<configuration>
					<warName>${project.artifactId}</warName>
					<failOnMissingWebXml>false</failOnMissingWebXml>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>fish.focus.uvms.usm</groupId>
			<artifactId>Information-Service</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.maven</groupId>
			<artifactId>uvms-pom-arquillian-deps</artifactId>
			<type>pom</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>eu.europa.ec.fisheries.uvms</groupId>
			<artifactId>usm4uvms</artifactId>
			<version>${usm4uvms.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.jboss.resteasy</groupId>
					<artifactId>resteasy-jaxrs</artifactId>
				</exclusion>
				<exclusion>
					<groupId>net.sf.ehcache</groupId>
					<artifactId>ehcache</artifactId>
				</exclusion>
				<exclusion>
					<groupId>eu.europa.ec.fisheries.uvms.commons</groupId>
					<artifactId>uvms-commons-message</artifactId>
				</exclusion>
			</exclusions>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>${guava.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.commons</groupId>
			<artifactId>uvms-commons-message</artifactId>
			<version>${uvms.commons.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.core</groupId>
			<artifactId>jersey-client</artifactId>
			<version>2.32</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.inject</groupId>
			<artifactId>jersey-hk2</artifactId>
			<version>3.0.3</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.glassfish.jersey.media</groupId>
			<artifactId>jersey-media-json-binding</artifactId>
			<version>3.0.4</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>fish.focus.uvms.commons</groupId>
			<artifactId>uvms-commons-date</artifactId>
			<version>${uvms.commons.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-client</artifactId>
			<version>${sun.jersey.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey</groupId>
			<artifactId>jersey-json</artifactId>
			<version>${sun.jersey.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.sun.jersey.contribs</groupId>
			<artifactId>jersey-multipart</artifactId>
			<version>${sun.jersey.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>