<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">
    <parent>
        <groupId>org.wildfly.prospero</groupId>
        <artifactId>prospero-dist</artifactId>
        <version>1.3.10.Final-redhat-00002</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>prospero-build</artifactId>
    <packaging>pom</packaging>

    <name>Prospero Build</name>

    <dependencies>
        <dependency>
            <groupId>org.wildfly.prospero</groupId>
            <artifactId>prospero-standalone-galleon-pack</artifactId>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <finalName>${prospero.dist.name}-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.jboss.galleon</groupId>
                <artifactId>galleon-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>provisioning</id>
                        <goals>
                            <goal>provision</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <install-dir>${basedir}/target/${project.build.finalName}</install-dir>
                            <record-state>true</record-state>
                            <feature-packs>
                                <feature-pack>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>prospero-standalone-galleon-pack</artifactId>
                                    <version>${project.version}</version>
                                </feature-pack>
                            </feature-packs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-metadata</id>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>prospero-standalone-galleon-pack</artifactId>
                                    <version>${project.version}</version>
                                    <type>yaml</type>
                                    <classifier>manifest</classifier>
                                    <outputDirectory>${basedir}/target/${project.build.finalName}/.installation</outputDirectory>
                                    <destFileName>manifest.yaml</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <classpathScope>runtime</classpathScope>
                            <source>${project.basedir}/src/main/script/sanitize_dist_manifest.groovy</source>
                            <properties>
                                <manifestFile>${basedir}/target/${project.build.finalName}/.installation/manifest.yaml</manifestFile>
                            </properties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly.xml</descriptor>
                            </descriptors>
                            <recompressZippedFiles>true</recompressZippedFiles>
                            <finalName>${prospero.dist.name}-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <workDirectory>${project.build.directory}/assembly/work</workDirectory>
                            <tarLongFileMode>posix</tarLongFileMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
