<!--
   Copyright 2013-16 Indra Sistemas S.A.
  
   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>
	<groupId>com.indra.sofia2.ssap</groupId>
	<artifactId>client-api-standalone</artifactId>
	<packaging>jar</packaging>
	<version>3.4.7</version>
	<name>client-api</name>
	<url>http://maven.apache.org</url>
	<properties>
		<maven.compiler.target>1.7</maven.compiler.target>
		<maven.compiler.source>1.7</maven.compiler.source>
		<commons-codec.version>1.5</commons-codec.version>
		<commons-io.version>2.4</commons-io.version>
		<commons-lang3.version>3.2.1</commons-lang3.version>
		<cxf.version>2.6.10</cxf.version>
		<jackson.version>2.6.3</jackson.version>
		<junit.version>4.11</junit.version>
		<log4j.version>1.2.17</log4j.version>
		<slf4j.version>1.7.21</slf4j.version>
		<mqtt-client.version>1.14.sofia</mqtt-client.version>
		<wasync.version>2.1.2</wasync.version>
		<httpclient.version>3.1</httpclient.version>
		<oshi-core.version>2.6-m-java7</oshi-core.version>
	</properties>
	<dependencies>
		<dependency>
		    <groupId>com.indra.sofia2</groupId>
		    <artifactId>ssap</artifactId>
		    <version>3.4.7</version>
		</dependency>
		<!-- Common dependencies -->
		<dependency>
			<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>${commons-codec.version}</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>${commons-io.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>${commons-lang3.version}</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>${log4j.version}</version>
		</dependency>
		
		<dependency>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
			<version>${httpclient.version}</version>
		</dependency>

		<!-- Testing dependencies -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>
		
		<!-- MQTT dependencies -->
		<dependency>
			<groupId>org.fusesource.mqtt-client</groupId>
			<artifactId>mqtt-client</artifactId>
			<version>${mqtt-client.version}</version>
		</dependency>
		<!-- Websocket dependencies -->
		<dependency>
			<groupId>org.atmosphere</groupId>
			<artifactId>wasync</artifactId>
			<version>${wasync.version}</version>
		</dependency>
		<!-- REST dependencies -->
		<dependency>
		    <groupId>com.github.dblock</groupId>
		    <artifactId>oshi-core</artifactId>
		    <version>${oshi-core.version}</version>
		</dependency>		
		<dependency>
		    <groupId>org.fusesource.hawtdispatch</groupId>
		    <artifactId>hawtdispatch-transport</artifactId>
		    <version>1.22</version>
		</dependency>		
	</dependencies>
	
	
	
	<repositories>
		<repository>
			<id>SOFIA2</id>
			<url>http://sofia2.org/nexus/content/groups/public/</url>
		</repository>
	</repositories>
	<build>
		<finalName>client-api-${project.version}</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>github</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<version>2.3.2</version>
						<configuration>
							<source>${maven.compiler.source}</source>
							<target>${maven.compiler.target}</target>
							<encoding>UTF-8</encoding>
						</configuration>
					</plugin>
					<plugin>
					<artifactId>maven-assembly-plugin</artifactId>
					<configuration>
						<descriptorRefs>
							<descriptorRef>jar-with-dependencies</descriptorRef>
						</descriptorRefs>
						<finalName>client-api-standalone</finalName>
						<outputDirectory>${project.build.directory}</outputDirectory>
						<appendAssemblyId>false</appendAssemblyId>
					</configuration>
					<executions>
						<execution>
							<id>make-assembly</id>
							<phase>package</phase>
							<goals>
								<goal>single</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>nexus</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<distributionManagement>
<!-- 				   <repository> -->
<!-- 				      <id>com.indra.sofia2.snapshots</id> -->
<!-- 				      <name>snapshots</name> -->
<!-- 				      <url>http://sofia2.org/nexus/content/repositories/snapshots/</url> -->
<!-- 				   </repository> -->
						   <repository>
						      <id>com.indra.sofia2.releases</id>
						      <name>snapshots</name>
						      <url>http://sofia2.org/nexus/content/repositories/releases/</url>
						   </repository>
			</distributionManagement>
		</profile>
		<profile>
			<id>sofiacom</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
							<distributionManagement>
<!-- 				   <repository> -->
<!-- 				      <id>com.indra.sofia2.snapshots</id> -->
<!-- 				      <name>snapshots</name> -->
<!-- 				      <url>http://sofia2.org/nexus/content/repositories/snapshots/</url> -->
<!-- 				   </repository> -->
						   <repository>
						      <id>com.indra.sofia2.releases</id>
						      <name>snapshots</name>
						      <url>http://sofia2.org/nexus/content/repositories/releases/</url>
						   </repository>
			</distributionManagement>
			<build>
				<plugins>
			      <plugin>
					<artifactId>maven-dependency-plugin</artifactId>
	                	<version>2.10</version>
	                	<executions>
	                		<execution>
		                    	<id>copy-dependencies</id>
					            <phase>package</phase>
					            <goals>
					              <goal>copy-dependencies</goal>
					            </goals>
					            <configuration>
					              <outputDirectory>${project.build.directory}/lib</outputDirectory>
					              <overWriteReleases>false</overWriteReleases>
					              <overWriteSnapshots>false</overWriteSnapshots>
					              <overWriteIfNewer>true</overWriteIfNewer>
				          	  </configuration>
	                   	 </execution>
	                	</executions>
	            	</plugin>
	            	<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<version>2.3.2</version>
						<configuration>
							<source>${maven.compiler.source}</source>
							<target>${maven.compiler.target}</target>
							<encoding>UTF-8</encoding>
						</configuration>
					</plugin>
					<plugin>
						<artifactId>maven-assembly-plugin</artifactId>
						<configuration>
							<descriptorRefs>
								<descriptorRef>jar-with-dependencies</descriptorRef>
							</descriptorRefs>
							<finalName>client-api-standalone</finalName>
							<outputDirectory>${project.build.directory}</outputDirectory>
							<appendAssemblyId>false</appendAssemblyId>
						</configuration>
						<executions>
							<execution>
								<id>make-assembly</id>
								<phase>package</phase>
								<goals>
									<goal>single</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
	           		<plugin>
					    <groupId>org.apache.maven.plugins</groupId>
					    <artifactId>maven-antrun-plugin</artifactId>
					    <version>1.8</version>
				    	<executions>
				        	<execution>
				         	   <phase>package</phase>
				            	<goals>
				                	<goal>run</goal>
				            	</goals>
					            <configuration>
					                <tasks>
					                    <echo>Creating bundle to upload to sofia.com</echo>
					                    <copy toDir="${basedir}/target/Api-Java"><fileset dir="${basedir}/target" includes="*.jar"/></copy>
					                    <copy toDir="${basedir}/target/Api-Java/lib"><fileset dir="${basedir}/target/lib" includes="*.jar"/></copy>
					                    <copy file="${basedir}/target/client-api-standalone.jar" tofile="${basedir}/target/Api-Java/TestApi/lib/client-api-standalone.jar"/>
					                    <copy file="${basedir}/target/lib/cxf-rt-transports-http-2.6.10.jar" tofile="${basedir}/target/Api-Java/TestApi/lib/cxf-rt-transports-http-2.6.10.jar"/>					                    
<!-- 					                    <copy file="${basedir}/target/lib/cxf-core-3.1.8.jar" tofile="${basedir}/target/Api-Java/TestApi/lib/cxf-core-3.1.8.jar"/>					                     -->
					                    <copy file="${basedir}/build_resources/classpath" tofile="${basedir}/target/Api-Java/TestApi/.classpath"/>
					                    <copy file="${basedir}/build_resources/project" tofile="${basedir}/target/Api-Java/TestApi/.project"/>
					                    <copy file="${basedir}/build_resources/settings/org.eclipse.jdt.core.prefs" tofile="${basedir}/target/Api-Java/TestApi/.settings/org.eclipse.jdt.core.prefs"/>
					                    <copy file="${basedir}/build_resources/LEEME.txt" tofile="${basedir}/target/Api-Java/LEEME.txt"/>
					                    <copy file="${basedir}/build_resources/LICENSE.txt" tofile="${basedir}/target/Api-Java/LICENSE.txt"/>					                    
					                    <copy toDir="${basedir}/target/Api-Java/TestApi/resources"><fileset dir="${basedir}/src/test/resources"/></copy>
					                    <copy toDir="${basedir}/target/Api-Java/TestApi/fixtures"><fileset dir="${basedir}/fixtures"/></copy>
					                    <copy toDir="${basedir}/target/Api-Java/TestApi/test/"><fileset dir="${basedir}/src/test/java"/></copy>
					                    <zip destfile="${basedir}/target/Api-Java.zip"  basedir="${basedir}/target/Api-Java"/>
					               </tasks>
				                </configuration>
				            </execution>
				        </executions>
				    </plugin>
			    </plugins>
			</build>
		</profile>
	</profiles>
</project>
