<?xml version="1.0" encoding="UTF-8"?>
<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">
	<properties>
		<packaging.type>pom</packaging.type>
		<dist_path>../..</dist_path>
		<skip-distribution-deploy>true</skip-distribution-deploy>
	</properties>
	<modelVersion>4.0.0</modelVersion>

	<artifactId>tigase-server-dist</artifactId>
	<name>Tigase XMPP Server Distribution builder</name>

	<packaging>${packaging.type}</packaging>

	<parent>
		<groupId>tigase</groupId>
		<artifactId>tigase-server-master</artifactId>
		<version>7.1.7-SNAPSHOT</version>
		<relativePath>../master</relativePath>
	</parent>
	
	<profiles>
		<profile>
			<activation>
				<os>
					<family>!windows</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>exec-maven-plugin</artifactId>
						<groupId>org.codehaus.mojo</groupId>
						<version>1.2.1</version>
						<executions>
							<execution><!-- Run our version calculation script -->
								<id>ChangeLog generation</id>
								<phase>validate</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>${project.basedir}/scripts/genChangeLog.sh</executable>
									<workingDirectory>${project.basedir}</workingDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.7</version>
						<executions>
							<execution>
								<phase>validate</phase>
								<configuration>
									<target>
										<exec executable="sed" output="README">
											<arg value="-e" />
											<arg value="s/&lt;[^&gt;]*&gt;//g" />
											<arg value="-e" />
											<arg value="s/&lt;[^&gt;]*&gt;//g" />
											<arg value="-e" />
											<arg value="s/&amp;[^; ]*;//g" />
											<arg value="-e" />
											<arg value="s/${APP_VER}/${project.version}/g" />
											<arg value="${dist_path}/package.html" />
										</exec>
										<exec executable="sed" output="package.html">
											<arg value="s/${APP_VER}/${project.version}--b${gitVersion}/g" />
											<arg value="${dist_path}/package.html" />
										</exec>
										<copy file="${dist_path}/License.html" tofile="License.html" />
										<!--<copy file="${dist_path}/ChangeLog" tofile="ChangeLog" />-->

									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>		
	
	<build>
		<plugins>

			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.4</version>
				<executions>
					<execution>
						<id>dist</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
						<configuration>
							<descriptors>
								<descriptor>src/main/assembly/dist.xml</descriptor>
								<descriptor>src/main/assembly/dist-max.xml</descriptor>
							</descriptors>
							<tarLongFileMode>gnu</tarLongFileMode>
							<finalName>tigase-server-${project.version}-b${gitVersion}</finalName>
							<outputDirectory>../../pack</outputDirectory>
							<!--<appendAssemblyId>false</appendAssemblyId>-->
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>2.6.1</version>
				<executions>
					<execution>
						<id>default-clean</id>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
					</execution>
					<execution>
						<id>clean-deps</id>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
						<configuration>
							<filesets>
								<fileset>
									<directory>${project.basedir}/../../jars</directory>
									<includes>
										<include>**/*.jar</include>
									</includes>
									<followSymlinks>false</followSymlinks>
								</fileset>
							</filesets>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.8</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>validate</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.basedir}/../../jars</outputDirectory>
							<stripVersion>true</stripVersion>
							<excludeTransitive>true</excludeTransitive>
							<overWriteIfNewer>true</overWriteIfNewer>
							<overWriteReleases>true&gt;</overWriteReleases>
							<overWriteSnapshots>true</overWriteSnapshots>
						</configuration>
					</execution>
					<execution>
						<id>copy-old-pubsub</id>
						<phase>validate</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>tigase</groupId>
									<artifactId>tigase-pubsub</artifactId>
									<version>2.2.0</version>
									<destFileName>tigase-pubsub-2.2.0.jar.old</destFileName>
									<type>jar</type>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${project.basedir}/../../jars</outputDirectory>
							<stripVersion>false</stripVersion>
							<useBaseVersion>true</useBaseVersion>
						</configuration>
					</execution>
					<execution>
						<id>tigase-resources</id>
						<phase>validate</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>tigase</groupId>
									<artifactId>tigase-http-api</artifactId>
									<type>jar</type>
									<overWrite>false</overWrite>
									<outputDirectory>${project.basedir}/../..</outputDirectory>
									<includes>*.xml, **/*.groovy, **/*.html</includes>
								</artifactItem>

								<artifactItem>
									<groupId>tigase</groupId>
									<artifactId>tigase-http-api-jetty</artifactId>
									<type>jar</type>
									<overWrite>false</overWrite>
									<outputDirectory>${project.basedir}/../..</outputDirectory>
									<includes>*.xml, **/*.groovy</includes>
								</artifactItem>

								<artifactItem>
									<groupId>tigase</groupId>
									<artifactId>tigase-muc</artifactId>
									<type>jar</type>
									<overWrite>false</overWrite>
									<outputDirectory>${project.basedir}/../../scripts</outputDirectory>
									<includes>**/*.groovy</includes>
								</artifactItem>

								<artifactItem>
									<groupId>tigase</groupId>
									<artifactId>tigase-socks5</artifactId>
									<type>jar</type>
									<overWrite>false</overWrite>
                                    <outputDirectory>${project.basedir}/../../database</outputDirectory>
                                    <includes>**/*.sql</includes>
                                </artifactItem>

                                <artifactItem>
                                    <groupId>tigase</groupId>
                                    <artifactId>tigase-pubsub</artifactId>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.basedir}/../..</outputDirectory>
                                    <includes>**/*.sql,**/*.sh,**/*.cmd,**/*.txt, **/*.groovy</includes>
                                </artifactItem>

                                <artifactItem>
									<groupId>tigase</groupId>
									<artifactId>licence-lib</artifactId>
									<type>jar</type>
									<overWrite>false</overWrite>
									<outputDirectory>${project.basedir}/../..</outputDirectory>
									<includes>**/*.groovy,**/keystore-letsencrypt</includes>
								</artifactItem>

							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jarsigner-plugin</artifactId>
				<version>1.4</version>
				<executions>
					<execution>
						<id>sign</id>
						<phase>validate</phase>
						<goals>
							<goal>sign</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<archiveDirectory>${project.basedir}/../..</archiveDirectory>
					<includes>
						<include>target/tigase*.?ar</include>
						<include>jars/tigase*.?ar</include>
						<include>jars/licence-lib.jar</include>
					</includes>
					<processMainArtifact>true</processMainArtifact>
					<processAttachedArtifacts>true</processAttachedArtifacts>
					<tsa>${tsa-uri}</tsa>
                    <skip>${sign-skip-server}</skip>
					<removeExistingSignatures>true</removeExistingSignatures>

					<keystore>${sign-keystore}</keystore>
					<alias>${sign-alias}</alias>
					<storepass>${sign-storepass}</storepass>
					<keypass>${sign-keypass}</keypass>
					<verbose>${verbose-log}</verbose>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.8.2</version>
				<configuration>
					<skip>${skip-distribution-deploy}</skip>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>

		<!--tigase dependencies-->
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-server</artifactId>
			<version>7.1.7-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-ext-mailer</artifactId>
			<version>1.0.0</version>
			<scope>runtime</scope>
			<exclusions>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.osgi.core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-muc</artifactId>
			<version>2.4.3</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-pubsub</artifactId>
			<version>3.2.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-extras</artifactId>
			<version>1.1.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>licence-lib</artifactId>
			<version>1.2.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-stats-collector-library</artifactId>
			<version>1.2.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-stats-collector-provider</artifactId>
			<version>1.2.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-http-api</artifactId>
			<version>1.2.3</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase.sure.web</groupId>
			<artifactId>tigase-web-ui</artifactId>
			<version>2.1.0</version>
			<type>war</type>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-http-api-jetty</artifactId>
			<version>1.1.0</version>
			<scope>runtime</scope>
		</dependency>		
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-message-archiving</artifactId>
			<version>1.2.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-unified-archive</artifactId>
			<version>1.0.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-socks5</artifactId>
			<version>1.2.0</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-stun</artifactId>
			<version>1.1.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-acs</artifactId>
			<version>2.3.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-acs-muc</artifactId>
			<version>1.2.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-acs-pubsub</artifactId>
			<version>1.2.1</version>
			<scope>runtime</scope>
		</dependency>

		<dependency>
			<groupId>tigase</groupId>
			<artifactId>tigase-mongodb</artifactId>
			<version>1.1.0</version>
			<scope>runtime</scope>
		</dependency>



		<!--databases-->
		<dependency>
			<groupId>org.apache.derby</groupId>
			<artifactId>derby</artifactId>
			<version>10.12.1.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.derby</groupId>
			<artifactId>derbytools</artifactId>
			<version>10.12.1.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.11</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>9.4.1207</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>net.sourceforge.jtds</groupId>
			<artifactId>jtds</artifactId>
			<version>1.3.1</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.mongodb</groupId>
			<artifactId>mongo-java-driver</artifactId>
			<version>2.14.1</version>
			<scope>runtime</scope>
		</dependency>


		<!-- other libraries-->
		<dependency>
			<groupId>org.codehaus.groovy</groupId>
			<artifactId>groovy-all</artifactId>
			<version>2.4.3</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-core</artifactId>
			<version>1.3</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>${slf4j.version}</version>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jul-to-slf4j</artifactId>
			<version>${slf4j.version}</version>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>de.javawi</groupId>
			<artifactId>jstun</artifactId>
			<version>0.7.3</version>
		</dependency>

		<!--OSGi dependencies-->
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.osgi.core</artifactId>
			<version>1.4.0</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.bundlerepository</artifactId>
			<version>1.6.6</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.http.bundle</artifactId>
			<version>2.2.1</version>
			<scope>runtime</scope>
			<exclusions>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.apache.felix.http.bridge</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.apache.felix.http.cometd</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.apache.felix.http.jetty</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.configadmin</artifactId>
			<version>1.6.0</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.main</artifactId>
			<version>4.4.0</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.shell</artifactId>
			<version>1.4.2</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.shell.remote</artifactId>
			<version>1.0.4</version>
			<scope>runtime</scope>
			<exclusions>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.osgi.core</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.osgi.compendium</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.felix</groupId>
					<artifactId>org.apache.felix.shell</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-core</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>

