<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.jboss.set.dependency-alignment</groupId>
        <artifactId>maven-dependency-updater-parent</artifactId>
        <version>0.5</version>
    </parent>

    <artifactId>cli</artifactId>

    <properties>
        <artifactName>alignment-cli</artifactName>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.jboss.set.dependency-alignment</groupId>
            <artifactId>core</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Don't create regular JAR -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase />
                    </execution>
                </executions>
            </plugin>

            <!-- Standalone JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <mainClass>org.jboss.set.mavendependencyupdater.cli.Cli</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>${artifactName}-${project.version}</finalName>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- enable RPM creation -->
        <profile>
            <id>rpm</id>
            <activation>
                <property>
                    <name>rpm</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>rpm-maven-plugin</artifactId>
                        <version>2.2.0</version>
                        <executions>
                            <execution>
                                <id>generate-rpm</id>
                                <goals>
                                    <goal>rpm</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <group>JBoss SET/Tools</group>
                            <packager>JBoss SET</packager>
                            <name>${artifactName}</name>
                            <mappings>
                                <mapping>
                                    <directory>/usr/share/${artifactName}</directory>
                                    <artifact />
                                    <filemode>644</filemode>
                                    <username>root</username>
                                    <groupname>root</groupname>
                                </mapping>
                                <!-- to set +x mode on the directory -->
                                <mapping>
                                    <directory>/usr/share/${artifactName}</directory>
                                    <filemode>755</filemode>
                                    <username>root</username>
                                    <groupname>root</groupname>
                                </mapping>
                            </mappings>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>