<?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-http-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>no-phase</deploy.phase>
		<clean.phase>no-phase</clean.phase>
		<skipITs>true</skipITs>
	</properties>

	<profiles>
		<profile>
			<id>http</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<properties>
				<deploy.phase>pre-integration-test</deploy.phase>
				<clean.phase>clean</clean.phase>
				<skipITs>false</skipITs>
			</properties>
		</profile>
		<profile>
			<id>wildfly</id>
			<properties>
				<log.dir>${jboss.server.log.dir}/usm</log.dir>
				<endpoint-url>http://${wf.host}:${wf.http.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>http://${wls.host}:${wls.http.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>
					<webResources>
						<resource>
							<filtering>true</filtering>
							<directory>src/main/webapp</directory>
							<includes>
								<include>**/web.xml</include>
							</includes>
						</resource>
					</webResources>
					<overlays>
						<overlay>
							<groupId>fish.focus.uvms.usm</groupId>
							<artifactId>Information-Rest-Service</artifactId>
						</overlay>
					</overlays>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>fish.focus.uvms.usm</groupId>
			<artifactId>Information-Rest-Service</artifactId>
			<version>2.2.13</version>
			<type>war</type>
		</dependency>
	</dependencies>
</project>