<?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.1-SNAPSHOT</version>
		</dependency>
		<dependency>
            <groupId>house.intelli</groupId>
            <artifactId>house.intelli.jdo</artifactId>
            <version>0.9.1-SNAPSHOT</version>
        </dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.2.5.jre7</version>
		</dependency>
	</dependencies>

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

	<build>
		<plugins>
<!-- BEGIN disable plugins (by changing their phase) -->
			<plugin>
				<groupId>com.itemis.maven.plugins</groupId>
				<artifactId>artifact-spy-plugin</artifactId>
				<executions>
					<execution>
						<id>spy</id>
						<phase>deploy</phase>
						<goals>
							<goal>spy</goal>
						</goals>
						<inherited>false</inherited>
					</execution>
				</executions>
			</plugin>		    
			<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>
<!-- END disable plugins (by changing their phase) -->
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>generate-resources</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>
						<id>remove-undesired-dependencies</id>
						<phase>process-resources</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.*" />
										<exclude name="javax.jdo-3.2.0.m10.jar" />

										<include name="org.antlr.*" />

										<!-- openHAB contains commons-collections 3.x, but we need 4.x :-( -->
										<include name="org.apache.commons.*" />
										<exclude name="org.apache.commons.collections4-*" />

										<include name="org.eclipse.*" />
										<include name="org.objectweb.*" />
										<include name="org.slf4j.*" />
										<include name="slf4j-*" />

										<include name="bc*-jdk15on-*" />
										<include name="org.apache.felix.*" />

										<include name="osgi.enterprise-*" />
										<include name="tec.uom.*" />

										<include name="transaction-api-*" />
										<include name="org.datanucleus-*" />
										<include name="org.postgresql-*" />
									</fileset>>
								</delete>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
                    <execution>
                        <id>finalize-distributions</id>
                        <phase>install</phase>
                        <configuration>
                            <target>
                                <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>
		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-dependency-plugin</artifactId>
										<versionRange>[3.0.0,)</versionRange>
										<goals>
											<goal>copy-dependencies</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-antrun-plugin</artifactId>
										<versionRange>[1.8,)</versionRange>
										<goals>
											<goal>run</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</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>
