<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.eclipse.basyx</groupId>
		<artifactId>basyx.components.docker</artifactId>
		<version>1.3.1</version>
	</parent>

	<artifactId>basyx.components.AASServer</artifactId>
	<name>AAS Server</name>

	<properties>
		<!-- basyx.components.executable is the executable class with the definition 
			of the public void main(String[]). It is needed when building the jar in 
			the maven-jar-plugin (see basyx.components.docker/pom.xml) -->
		<basyx.components.executable>org.eclipse.basyx.components.aas.executable.AASServerExecutable</basyx.components.executable>
	</properties>

	<packaging>jar</packaging>

	<!-- Define additional plugins that are not included by default -->
	<!-- Plugin configuration is done in parent project(s) -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
			</plugin>

			<!-- Attach sources to jar file -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
			</plugin>

			<!-- Generate separate jar for tests and exclude logback.xml from generated 
				jars -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
			</plugin>

			<!-- Run unit tests (Test*.java, *Test.java, *Tests.java and *TestCase.java 
				excluding HTTP and TCP tests) -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<source>8</source>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>jar</goal>
						</goals>
						<id>generate-javadoc</id>
						<phase>package</phase>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
    		<groupId>ch.qos.logback</groupId>
    		<artifactId>logback-classic</artifactId>
    	</dependency>
	
		<!-- Use MongoDB Java Drivers for db connections -->
		<dependency>
			<groupId>org.mongodb</groupId>
			<artifactId>mongodb-driver-sync</artifactId>
			<version>4.8.2</version>
		</dependency>

		<!-- Use Spring Data MongoDB for db data management -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-mongodb</artifactId>
			<version>3.4.7</version>
		</dependency>

		<!-- Adds additional classes of the BaSys SDK for tests -->
		<dependency>
			<groupId>org.eclipse.basyx</groupId>
			<artifactId>basyx.sdk</artifactId>
			<classifier>tests</classifier>
		</dependency>

		<!-- Used for reading .aasx files -->
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi-ooxml</artifactId>
			<version>4.1.2</version>
		</dependency>

		<!-- Moquette MQTT broker for testing MQTT events -->
		<dependency>
			<groupId>io.moquette</groupId>
			<artifactId>moquette-broker</artifactId>
			<version>0.16</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-log4j12</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.eclipse.basyx</groupId>
			<artifactId>basyx.components.registry</artifactId>
			<version>1.3.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.tngtech.keycloakmock</groupId>
			<artifactId>mock</artifactId>
			<scope>test</scope>
			<version>0.13.0</version>
		</dependency>

		<dependency>
			<groupId>org.mock-server</groupId>
			<artifactId>mockserver-netty</artifactId>
			<version>5.9.0</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.mock-server</groupId>
			<artifactId>mockserver-client-java</artifactId>
			<version>5.9.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<!-- "Docker" profile - do not build & install docker images by default 
				Run "mvn install -Pdocker" in order to include docker -->
			<id>docker</id>
			<build>
				<plugins>
					<!-- Read maven properties from file -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>properties-maven-plugin</artifactId>
					</plugin>

					<!-- Copy the dependencies necessary to run the jar -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
					</plugin>

					<!-- Build the docker image -->
					<plugin>
						<groupId>io.fabric8</groupId>
						<artifactId>docker-maven-plugin</artifactId>
					</plugin>

					<!-- Create integration test environment -->
					<plugin>
						<groupId>com.dkanejs.maven.plugins</groupId>
						<artifactId>docker-compose-maven-plugin</artifactId>
					</plugin>

					<!-- Run integration tests -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>MavenCentral</id>
			<build>
				<plugins>
					<!-- Upload to maven central -->
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
					</plugin>

					<!-- Signing the artifacts -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>