<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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.jadaptive</groupId>
		<artifactId>jadaptive-secure-node</artifactId>
		<relativePath>..</relativePath>
		<version>1.0.0-SNAPSHOT</version>
	</parent>

	<artifactId>jadaptive-windows-connect-client</artifactId>
	<name>Windows Connect Service</name>

	<dependencies>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>maverick-synergy-callback-client</artifactId>
			<version>3.1.4-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>maverick-virtual-filesystem</artifactId>
			<version>3.1.4-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>jadaptive-oauth-client</artifactId>
			<version>0.0.1-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>jini-lib</artifactId>
			<version>0.5.6</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>jini-config</artifactId>
			<version>0.5.6</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>liftlib</artifactId>
			<version>0.9.3</version>
		</dependency>
		<dependency>
			<groupId>info.picocli</groupId>
			<artifactId>picocli</artifactId>
			<version>4.7.6</version>
		</dependency>
		<dependency>
			<groupId>com.install4j</groupId>
			<artifactId>install4j-runtime</artifactId>
			<version>10.0.8</version>
			<!-- MUST be provided, the runtime is added by I4J itself -->
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>jaul</artifactId>
			<version>0.9.19</version>
		</dependency>

	</dependencies>

	<build>
		<finalName>jadaptive-windows-connect</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<index>true</index>
						<manifest>
							<addClasspath>true</addClasspath>
						</manifest>
						<manifestEntries>
							<Install-Action>com.jadaptive.windows.connect.install4j.RegisterAction,com.jadaptive.windows.connect.install4j.CompleteRegisterAction</Install-Action>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<configuration>
					<skipAttach>false</skipAttach>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>generateInstaller</id>
			<build>
				<plugins>
	                    
					<!-- Reads in secrets and other build configuration from build nodes -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>properties-maven-plugin</artifactId>
						<executions>
							<execution>
								<phase>initialize</phase>
								<goals>
									<goal>read-project-properties</goal>
								</goals>
								<configuration>
									<quiet>true</quiet>
									<files>
										<file>${build.projectProperties}</file>
										<file>${build.userProperties}</file>
									</files>
								</configuration>
							</execution>
						</executions>
					</plugin>
				
	                <!-- Clean target/extensions etc -->
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>clean-extensions</id>
                                <phase>clean</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <filesets>
                                        <fileset>
                                            <directory>target/libs</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
					<!-- Get a full version number given the POM and BUILD_NUMBER -->
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<version>3.3.0</version>
						<executions>
							<execution>
								<id>build-number-property</id>
								<goals>
									<goal>regex-property</goal>
								</goals>
								<phase>initialize</phase>
								<configuration>
									<name>product.version</name>
									<value>${project.version}</value>
									<regex>^([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9A-Za-z]+)$</regex>
									<replacement>$1.$2.$3</replacement>
									<failIfNoMatch>false</failIfNoMatch>
								</configuration>
							</execution>
							<execution>
								<id>product-version-property</id>
								<goals>
									<goal>regex-property</goal>
								</goals>
								<phase>initialize</phase>
								<configuration>
									<name>build.number</name>
									<value>0${env.BUILD_NUMBER}</value>
									<regex>^(?:0?)([0-9]+)(?:\$\{env\.BUILD_NUMBER\})?$</regex>
									<replacement>$1</replacement>
									<failIfNoMatch>false</failIfNoMatch>
								</configuration>
							</execution>
						</executions>
					</plugin>
					 <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-dependency-plugin</artifactId>
		                <configuration>
		                    <outputDirectory>
		                        ${project.build.directory}/lib</outputDirectory>
		                </configuration>
		                <executions>
							<execution>
								<id>copy-dependencies</id>
								<phase>package</phase>
								<goals>
									<goal>copy-dependencies</goal>
								</goals>
								<configuration>
									<outputDirectory>target/libs</outputDirectory>
									<includeScope>compile</includeScope>
								</configuration>
							</execution>
		                </executions>
		            </plugin>
					<plugin>
						<groupId>com.install4j</groupId>
						<artifactId>install4j-maven</artifactId>
						<executions>
							<execution>
								<id>compile-installers</id>
								<phase>package</phase>
								<goals>
									<goal>compile</goal>
								</goals>
								<configuration>
									<projectFile>${project.basedir}/windows.install4j</projectFile>
                                    <attach>true</attach>
									<release>${product.version}-${build.number}</release>
                                    <mediaTypes>${build.mediaTypes}</mediaTypes>
                                    <buildIds>${build.buildIds}</buildIds>
									<variables>
                                        <build.phase>${build.phase}</build.phase>
                                        <build.exeSuffix>${build.exe.suffix}</build.exeSuffix>
                                        <install4j.appleId>${install4j.appleId}</install4j.appleId>
                                        <install4j.appleIdPassword>${install4j.appleIdPassword}</install4j.appleIdPassword>
                                        <install4j.macPkcs12File>${install4j.macPkcs12File}</install4j.macPkcs12File>
                                        <install4j.windowsKeystoreIssuer>${install4j.windowsKeystoreIssuer}</install4j.windowsKeystoreIssuer>>
                                        <install4j.windowsKeystoreSerial>${install4j.windowsKeystoreSerial}</install4j.windowsKeystoreSerial>>
                                        <install4j.windowsKeystoreSubject>${install4j.windowsKeystoreSubject}</install4j.windowsKeystoreSubject>
                                        <install4j.updatesBase>${install4j.updatesBase}</install4j.updatesBase>
                                        <install4j.jaulAppId>${install4j.jaulAppId}</install4j.jaulAppId>
                                        <install4j.jaulUpdaterId>${install4j.jaulUpdaterId}</install4j.jaulUpdaterId>
									</variables>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>merge-installers</id>
			<build>
				<plugins>
					<plugin>
						<groupId>com.sshtools</groupId>
						<artifactId>updatesxmlmerger-maven-plugin</artifactId>
						<configuration>
							<inputs>
								<input>${project.build.directory}/media-macos/updates.xml</input>
								<input>${project.build.directory}/media-windows/updates.xml</input>
								<input>${project.build.directory}/media-linux/updates.xml</input>
							</inputs>
							<failIfDirMissing>false</failIfDirMissing>
							<output>${project.build.directory}/media/updates.xml</output>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<repositories>
		<repository>
			<id>ext-releases-local</id>
			<name>artifactory.jadaptive.com-ext-releases</name>
			<url>https://artifactory.jadaptive.com/ext-releases-local</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases />
		</repository>
		<repository>
			<id>ej-technologies</id>
			<url>https://maven.ej-technologies.com/repository</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases />
		</repository>
		<repository>
	    <name>Central Portal Snapshots</name>
	    <id>central-portal-snapshots</id>
	    <url>https://central.sonatype.com/repository/maven-snapshots/</url>
	    <releases>
	      <enabled>false</enabled>
	    </releases>
	    <snapshots>
	      <enabled>true</enabled>
	    </snapshots>
	  </repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>ej-technologies</id>
			<url>https://maven.ej-technologies.com/repository</url>
		</pluginRepository>
	</pluginRepositories>

</project>
