<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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.jboss.windup</groupId>
        <artifactId>windup-openshift-parent</artifactId>
        <version>6.1.2.Final-redhat-00001</version>
    </parent>

    <artifactId>windup-cli-openshift</artifactId>

    <properties>
        <docker.name.windup.cli>%a:%v</docker.name.windup.cli>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Placeholder dependency for letting PNC manage the 'version' value properly -->
            <dependency>
                <groupId>org.jboss.windup</groupId>
                <artifactId>windup-cli-parent</artifactId>
                <version>${version.windup.cli}</version>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jkube</groupId>
                <artifactId>kubernetes-maven-plugin</artifactId>
                <version>${version.jkube}</version>
                <executions>
                    <execution>
                        <id>jkube</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <buildStrategy>docker</buildStrategy>
                    <autoPull>always</autoPull>
                    <images>
                        <image>
                            <name>${docker.name.windup.cli}</name>
                            <build>
                                <from>registry.access.redhat.com/ubi8/openjdk-11:latest</from>
                                <cmd>/opt/migrationtoolkit/bin/windup-cli</cmd>
                                <assembly>
                                    <targetDir>/opt</targetDir>
                                    <exportTargetDir>false</exportTargetDir>
                                    <excludeFinalOutputArtifact>true</excludeFinalOutputArtifact>
                                    <permissions>keep</permissions>
                                    <mode>tgz</mode>
                                    <layers>
                                        <layer>
                                            <fileSets>
                                                <fileSet>
                                                    <directory>${project.build.directory}/windup-cli/${product-name}-cli-${version.windup.cli}/</directory>
                                                    <outputDirectory>migrationtoolkit/</outputDirectory>
                                                </fileSet>
                                            </fileSets>
                                        </layer>
                                    </layers>
                                </assembly>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.windup</groupId>
                                    <artifactId>${product-name}-cli</artifactId>
                                    <classifier>offline</classifier>
                                    <type>zip</type>
                                    <version>${version.windup.cli}</version>
                                    <outputDirectory>${project.build.directory}/windup-cli</outputDirectory>
                                    <overWrite>true</overWrite>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
