<?xml version="1.0" encoding="UTF-8"?>

<!--
   Copyright 2013-2017 Linagora, Université Joseph Fourier, Floralis

   The present code is developed in the scope of the joint LINAGORA -
   Université Joseph Fourier - Floralis research program and is designated
   as a "Result" pursuant to the terms and conditions of the LINAGORA
   - Université Joseph Fourier - Floralis research program. Each copyright
   holder of Results enumerated here above fully & independently holds complete
   ownership of the complete Intellectual Property rights applicable to the whole
   of said Results, and may freely exploit it in any manner which does not infringe
   the moral rights of the other copyright holders.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<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>net.roboconf</groupId>
		<artifactId>roboconf-parent</artifactId>
		<version>1.10</version>
	</parent>

	<groupId>net.roboconf</groupId>
	<artifactId>roboconf-platform-parent</artifactId>
	<version>0.9</version>
	<name>Roboconf :: Platform Parent</name>
	<packaging>pom</packaging>

	<!-- Properties and other things... -->
	<properties>
		<jersey.stack.version>1.18.2</jersey.stack.version>
		<jackson.stack.version>2.3.1</jackson.stack.version>
		<karaf.version>4.0.9</karaf.version>
		<ipojo.version>1.12.1</ipojo.version>
		<jclouds.version>1.8.1</jclouds.version>
		<mockito.version>1.10.19</mockito.version>
		<websocket.version>9.2.10.v20150310</websocket.version>
		<javax.mail.version>1.5.2</javax.mail.version>
		<docker.java.version>3.0.10</docker.java.version>
		<pax.exam.version>4.9.1</pax.exam.version>
		<pax.url.aether.version>2.4.5</pax.url.aether.version>
		<pax.jdbc.version>1.1.0</pax.jdbc.version>
		
		<!-- To update on every release -->
		<version.range>[${project.version},0.10)</version.range>
		
		<!-- 
			We should not embed any SLF4J library in bundles.
			Instead, we should stick with the one that is already shipped with Karaf.
		 -->
		<slf4j.version>1.7.12</slf4j.version>
		
		<!-- Customize the set of XML resources to verify with Checkstyle -->
		<checkstyle.xml.inclusions>**/metadata.xml</checkstyle.xml.inclusions>
		<checkstyle.xml.exclusions>**/src/test/projects/**/pom.xml, **/src/it/**/pom.xml</checkstyle.xml.exclusions>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>4.12</version>
			</dependency>

  			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-databind</artifactId>
				<version>${jackson.stack.version}</version>
			</dependency>

			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-core</artifactId>
	  			<version>${jackson.stack.version}</version>
			</dependency>

			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-core</artifactId>
				<version>${jersey.stack.version}</version>
			</dependency>

			<dependency>
				<groupId>com.sun.jersey</groupId>
				<artifactId>jersey-client</artifactId>
				<version>${jersey.stack.version}</version>
			</dependency>

			<dependency>
				<groupId>com.sun.jersey.contribs</groupId>
				<artifactId>jersey-multipart</artifactId>
				<version>${jersey.stack.version}</version>
			</dependency>
			
			<dependency>
				<groupId>org.ops4j.pax.url</groupId>
				<artifactId>pax-url-aether</artifactId>
				<version>2.4.7</version>
			</dependency>

			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-core</artifactId>
				<version>${mockito.version}</version>
				<exclusions>
					<exclusion>
						<groupId>org.hamcrest</groupId>
						<artifactId>hamcrest-core</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
			
			<dependency>
				<groupId>com.github.docker-java</groupId>
				<artifactId>docker-java</artifactId>
				<version>${docker.java.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.karaf.tooling</groupId>
					<artifactId>karaf-maven-plugin</artifactId>
					<version>${karaf.version}</version>
					<extensions>true</extensions>
				</plugin>

				<plugin>
					<groupId>org.apache.felix</groupId>
					<artifactId>maven-ipojo-plugin</artifactId>
					<version>${ipojo.version}</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.17</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.servicemix.tooling</groupId>
					<artifactId>depends-maven-plugin</artifactId>
					<version>1.2</version>
				</plugin>

				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>build-helper-maven-plugin</artifactId>
					<version>1.9</version>
				</plugin>

				<plugin>
					<groupId>org.apache.felix</groupId>
					<artifactId>maven-bundle-plugin</artifactId>
					<version>2.4.0</version>
					<extensions>true</extensions>
				</plugin>

				<!-- Required for Coveralls! -->
				<plugin>
					<groupId>org.eluder.coveralls</groupId>
					<artifactId>coveralls-maven-plugin</artifactId>
					<version>3.0.1</version>

					<configuration>
						<coverallsFile>target/coveralls.json</coverallsFile>
						<coverageFile>target/site/cobertura/coverage.xml</coverageFile>
					</configuration>
				</plugin>

				<!-- Required for Coveralls! -->
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>cobertura-maven-plugin</artifactId>
					<version>2.6</version>

					<configuration>
						<formats>
							<format>html</format>
							<format>xml</format>
						</formats>

						<instrumentation>
							<ignoreTrivial>true</ignoreTrivial>
							<ignores>
								<ignore>java.util.logging.*</ignore>
							</ignores>
							<excludes>
								<exclude>net/roboconf/**/*Exception.class</exclude>
							</excludes>
						</instrumentation>

						<maxmem>256m</maxmem>
						<aggregate>true</aggregate>
						<quiet>true</quiet>
					</configuration>
				</plugin>

				<plugin>
					<artifactId>maven-release-plugin</artifactId>
					<configuration>
						<preparationGoals>clean install</preparationGoals>
					</configuration>
				</plugin>
				
				<!-- Verify there is a bundle.info file for bundles -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<executions>
						<execution>
							<phase>validate</phase>
							<configuration>
								<target>
									<loadfile property="pom" srcFile="${basedir}/pom.xml" />
									<condition property="isDocumentedBundle">
										<or>
											<not>
												<matches pattern=".*&lt;packaging&gt;\s*bundle\s*&lt;/packaging&gt;.*" string="${pom}" />
											</not>
											<available file="${basedir}/src/main/resources/OSGI-INF/bundle.info" />
										</or>
									</condition>
									<fail message="Bundle ${project.name} is missing a « bundle.info » file under « src/main/resources/OSGI-INF »." unless="isDocumentedBundle" />
								</target>	
							</configuration>
							<goals>
								<goal>run</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>

		<!-- Activate plug-ins for all the modules -->
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<profiles>

		<!-- 
			The default profile is the one run when using "mvn clean install".
			It is not run when the "it-only" property is set.
		 -->
		<profile>
			<id>default</id>
			<activation>
				<property>
					<name>!it-only</name>
				</property>
			</activation>
			<modules>
				<!--  "THE" Core Module -->
				<module>core/roboconf-core</module>
		
				<!-- 
					This module embeds the web administration.
					We put it in second because it requires NPM.
					To save time (when possible), use "mvn clean install -rf :roboconf-target-api".
				-->
				<module>core/roboconf-dm-web-administration</module>
		
				<!-- Other Core Modules -->
				<module>core/roboconf-target-api</module>
				<module>core/roboconf-plugin-api</module>
				<module>core/roboconf-messaging-api</module>
				<module>core/roboconf-agent-monitoring-api</module>
		
				<!-- Utilities -->
				<module>miscellaneous/roboconf-tooling-core</module>
				<module>miscellaneous/roboconf-doc-generator</module>
				<module>miscellaneous/roboconf-maven-plugin</module>
		
				<!-- Messaging providers -->
				<module>core/roboconf-messaging-rabbitmq</module>
				<module>core/roboconf-messaging-http</module>
		
				<!-- DM modules -->
				<module>core/roboconf-dm</module>
				<module>core/roboconf-dm-templating</module>
				<module>core/roboconf-dm-scheduler</module>
				<module>core/roboconf-dm-rest-commons</module>
				<module>core/roboconf-dm-rest-services</module>
				<module>miscellaneous/roboconf-swagger</module>
		
				<!-- Agent -->
				<module>core/roboconf-agent</module>
				<module>core/roboconf-agent-default</module>
		
				<!-- Target Handlers -->
				<module>core/roboconf-target-in-memory</module>
				<module>core/roboconf-target-docker</module>
				<module>core/roboconf-target-embedded</module>
				<module>core/roboconf-target-jclouds</module>
				<module>core/roboconf-target-iaas-azure</module>
				<module>core/roboconf-target-iaas-ec2</module>
				<module>core/roboconf-target-iaas-openstack</module>
				<module>core/roboconf-target-iaas-vmware</module>
				<module>core/roboconf-target-iaas-occi</module>
		
				<!-- Agent plug-ins -->
				<module>core/roboconf-plugin-script</module>
				<module>core/roboconf-plugin-puppet</module>
				<module>core/roboconf-plugin-file</module>
				<module>core/roboconf-plugin-logger</module>
				
				<!-- Agent Monitoring -->
				<module>core/roboconf-agent-monitoring</module>
				<module>core/roboconf-agent-monitoring-docker</module>
		
				<!-- Distributions -->
				<module>karaf/roboconf-karaf-prepare</module>
				<module>karaf/roboconf-karaf-commands-common</module>
				<module>karaf/roboconf-karaf-commands-agent</module>
				<module>karaf/roboconf-karaf-commands-dm</module>
				<module>karaf/roboconf-karaf-feature-agent</module>
				<module>karaf/roboconf-karaf-feature-dm</module>
				<module>karaf/roboconf-karaf-dist-agent</module>
				<module>karaf/roboconf-karaf-dist-dm</module>
				<module>karaf/roboconf-karaf-decanter-collector-dm</module>
		
				<!-- Miscellaneous -->
				<module>miscellaneous/roboconf-dm-rest-client</module>
				
				<!-- Web Extensions -->
				<module>web-extensions/roboconf-web-extension-for-kibana</module>
				
				<!-- Integration Tests are not listed here but in a profile below -->
			</modules>
		</profile>
	
		<!-- Configure the Maven surefire plugin. -->
		<!-- 
			Log levels must be taken in the same file, no matter if we
			build from the platform's root directory or directly a sub-module.
		 -->
		<profile>
			<id>travis</id>
			<activation>
				<file>
					<exists>${basedir}/build-logging.properties</exists>
				</file>
			</activation>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<artifactId>maven-surefire-plugin</artifactId>
							<configuration>
								<systemProperties>
									<property>
										<name>java.util.logging.config.file</name>
										<value>${basedir}/build-logging.properties</value>
									</property>
									<property>
										<name>log4j.configuration</name>
										<value>${basedir}/build-logging-log4j.properties</value>
									</property>
								</systemProperties>
								<runOrder>alphabetical</runOrder>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<profile>
			<id>debug-sub-module-with-logs</id>
			<activation>
				<file>
					<exists>${basedir}/../../build-logging.properties</exists>
				</file>
			</activation>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<artifactId>maven-surefire-plugin</artifactId>
							<configuration>
								<systemProperties>
									<property>
										<name>java.util.logging.config.file</name>
										<value>${basedir}/../../build-logging.properties</value>
									</property>
									<property>
										<name>log4j.configuration</name>
										<value>file:${basedir}/../../build-logging-log4j.properties</value>
									</property>
								</systemProperties>
								<runOrder>alphabetical</runOrder>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<!-- Integration Tests -->
		<profile>
			<id>it-dm-agent</id>
			<modules>
				<module>miscellaneous/roboconf-integration-tests-commons</module>
				<module>miscellaneous/roboconf-integration-tests-agent</module>
				<module>miscellaneous/roboconf-integration-tests-dm</module>
			</modules>
		</profile>

		<profile>
			<id>it-agents-in-memory</id>
			<modules>
				<module>miscellaneous/roboconf-integration-tests-commons</module>
				<module>miscellaneous/roboconf-integration-tests-dm-with-agents-in-memory</module>
			</modules>
		</profile>

		<profile>
			<id>it-all</id>
			<activation>
				<property>
					<name>it-only</name>
				</property>
			</activation>
			<modules>
				<module>miscellaneous/roboconf-integration-tests-commons</module>
				<module>miscellaneous/roboconf-integration-tests-agent</module>
				<module>miscellaneous/roboconf-integration-tests-dm</module>
				<module>miscellaneous/roboconf-integration-tests-dm-with-agents-in-memory</module>
			</modules>
		</profile>

		<!-- Add other profiles if necessary... -->
	</profiles>

	<scm>
		<connection>scm:git:git@github.com:roboconf/roboconf-platform.git</connection>
		<developerConnection>scm:git:git@github.com:roboconf/roboconf-platform.git</developerConnection>
		<url>http://github.com/roboconf/roboconf-platform</url>
		<tag>roboconf-platform-parent-0.9</tag>
	</scm>

</project>
