<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>com.sshtools</groupId>
		<artifactId>volman</artifactId>
		<version>0.0.1-SNAPSHOT</version>
	</parent>
	<artifactId>volman-app</artifactId>
	<name>Volume Manager App</name>
	<dependencies>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>volman-core</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>sequins</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>volman-lvm2</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>volman-remote-dbus</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>com.sshtools</groupId>
			<artifactId>volman-remote-http</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>info.picocli</groupId>
			<artifactId>picocli</artifactId>
			<version>4.6.3</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>1.7.36</version>
			<scope>provided</scope>
		</dependency>

	</dependencies>

	<properties>
		<graalvm.version>21.2.0</graalvm.version>
		<main.class>com.sshtools.volman.app.VolumeManager</main.class>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<annotationProcessorPaths>
						<path>
							<groupId>info.picocli</groupId>
							<artifactId>picocli-codegen</artifactId>
							<version>4.6.1</version>
						</path>
					</annotationProcessorPaths>
				</configuration>
			</plugin>
			
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>properties-maven-plugin</artifactId>
				<version>1.0.0</version>
				<executions>
					<execution>
						<phase>initialize</phase>
						<goals>
							<goal>read-project-properties</goal>
						</goals>
						<configuration>
							<quiet>true</quiet>
							<files>
								<file>${basedir}/hypersocket.build.properties</file>
								<file>${user.home}/.hypersocket.build.properties</file>
							</files>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<!-- Graal Native Image -->
		<profile>
			<id>native-images</id>
			<dependencies>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-simple</artifactId>
					<version>1.7.36</version>
				</dependency>
				<dependency>
					<groupId>org.graalvm.sdk</groupId>
					<artifactId>graal-sdk</artifactId>
					<version>${graalvm.version}</version>
					<scope>provided</scope>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.graalvm.nativeimage</groupId>
						<artifactId>native-image-maven-plugin</artifactId>
						<version>${graalvm.version}</version>
						<executions>
							<execution>
								<id>volume-manager-native-image</id>
								<goals>
									<goal>native-image</goal>
								</goals>
								<phase>package</phase>
								<configuration>
									<mainClass>${main.class}</mainClass>
									<skip>false</skip>
									<imageName>volume-manager</imageName>
									<buildArgs>--allow-incomplete-classpath
									</buildArgs>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>shaded</id>
			<dependencies>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-nop</artifactId>
					<version>1.7.36</version>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-shade-plugin</artifactId>
						<version>3.4.1</version>
						<configuration>
							<transformers>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>${main.class}</mainClass>
								</transformer>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"></transformer>
							</transformers>
						</configuration>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>shade</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>install4j</id>
			<dependencies>
				<dependency>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-nop</artifactId>
					<version>1.7.36</version>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<configuration>
							<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
							<excludeScope>provided</excludeScope>
						</configuration>
						<executions>
							<execution>
								<id>copy-dependencies</id>
								<?m2e ignore?>
								<phase>package</phase>
								<goals>
									<goal>copy-dependencies</goal>
								</goals>
								<configuration>
									<overWriteReleases>false</overWriteReleases>
									<overWriteSnapshots>false</overWriteSnapshots>
									<overWriteIfNewer>true</overWriteIfNewer>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>com.install4j</groupId>
						<artifactId>install4j-maven</artifactId>
						<version>9.0.5</version>
						<executions>
							<execution>
								<id>compile-installers</id>
								<phase>package</phase>
								<goals>
									<goal>compile</goal>
								</goals>
								<configuration>
									<projectFile>${project.basedir}/src/main/install4j/volman.install4j</projectFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

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