<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://maven.apache.org/POM/4.0.0"
	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>org.openhab.binding</groupId>
		<artifactId>pom</artifactId>
		<version>2.4.0</version>
	</parent>

	<groupId>org.openhab.binding</groupId>
	<artifactId>org.openhab.binding.intellihouse</artifactId>
	<version>2.4.0-SNAPSHOT</version>

	<name>IntelliHouse Binding</name>
	<packaging>eclipse-plugin</packaging>

	<dependencies>
		<dependency>
			<groupId>house.intelli</groupId>
			<artifactId>house.intelli.pgp</artifactId>
			<version>0.9.0-SNAPSHOT</version>
		</dependency>
	</dependencies>

	<properties>
		<bundle.symbolicName>org.openhab.binding.intellihouse</bundle.symbolicName>
		<bundle.namespace>org.openhab.binding.intellihouse</bundle.namespace>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.openhab.tools.sat</groupId>
				<artifactId>sat-plugin</artifactId>
				<executions>
					<execution>
						<id>default</id>
						<phase>deploy</phase>
						<goals>
							<goal>checkstyle</goal>
						</goals>
						<inherited>false</inherited>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/distributions/addons/</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.8</version>
				<executions>
					<execution>
						<phase>install</phase>
						<configuration>
							<target>
								<delete verbose="true" failonerror="false">
									<!-- There are duplicate files of all "*-SNAPSHOT.jar"-files: They exist once
									with "-SNAPSHOT" and once with ".SNAPSHOT". We thus delete the ones with ".SNAPSHOT". -->
									<fileset dir="${project.build.directory}/distributions/addons/"
										includes="*.SNAPSHOT.jar" />
									
									<!-- Also delete all libraries that are already in the openHAB runtime. -->
									<fileset dir="${project.build.directory}/distributions/addons/">
										<include name="com.google.*" />
										<include name="commons-*" />
										<include name="javax.*" />
										<include name="org.antlr.*" />
										<!-- openHAB contains commons-collections 3.x, but we need 4.x :-(
										-->
										<include name="org.apache.commons.*" />
										<include name="org.eclipse.*" />
										<include name="org.objectweb.*" />
										<include name="org.slf4j.*" />
										<include name="slf4j-*" />
										
										<include name="bc*-jdk15on-*" />
										<include name="org.apache.felix.*" />
										
										<!-- openHAB contains commons-collections 3.x, but we need 4.x :-( -->
										<exclude name="org.apache.commons.collections4-*" />
									</fileset>>
								</delete>
								<copy
									file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
									todir="${project.build.directory}/distributions/addons/"
								/>
								<tar destfile="${project.build.directory}/distributions/${project.artifactId}-${project.version}.tar.gz" compression="gzip">
									<tarfileset dir="${project.build.directory}/distributions/addons/" prefix="openhab/addons/" >
										<include name="*" />
									</tarfileset>
								</tar>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

    <repositories>
    
        <!-- ...copied from openHAB's master-POM -->
        <!-- releases -->
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>jcenter</id>
            <name>JCenter Repository</name>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>openhab-artifactory-release</id>
            <name>JFrog Artifactory Repository</name>
            <url>https://openhab.jfrog.io/openhab/libs-release</url>
        </repository>
    
        <!-- snapshots -->
        <repository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <id>openhab-artifactory-snapshot</id>
            <name>JFrog Artifactory Repository</name>
            <url>https://openhab.jfrog.io/openhab/libs-snapshot</url>
        </repository>
	
		<!-- openHAB dependencies p2 repository -->
		<repository>
			<id>p2-openhab-deps-repo</id>
			<url>https://dl.bintray.com/openhab/p2/openhab-deps-repo/${ohdr.version}</url>
			<layout>p2</layout>
		</repository>


        <!-- CodeWizards -->    
        <repository>
            <id>codewizards-release</id>
            <url>https://codewizards.co/maven/release</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>codewizards-snapshot</id>
            <url>https://codewizards.co/maven/snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

</project>
