<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-dist-common</artifactId>
  <packaging>pom</packaging>

  <name>Prospero Distributions Common</name>

  <properties>
      <prospero.script.path>packages/org.jboss.prospero/content/bin/</prospero.script.path>
  </properties>


  <dependencies>
    <dependency>
      <groupId>org.wildfly.prospero</groupId>
      <artifactId>prospero-cli</artifactId>
    </dependency>
    <dependency>
      <groupId>org.wildfly.galleon-plugins</groupId>
      <artifactId>wildfly-galleon-plugins</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.modules</groupId>
      <artifactId>jboss-modules</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>
        <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-sources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                  <directory>${project.basedir}/src/main/resources</directory>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-sources</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>generate-sources</id>
                        <phase>compile</phase>
                        <configuration>
                            <target>
                                <move file="${project.build.outputDirectory}/${prospero.script.path}/prospero.sh" tofile="${project.build.outputDirectory}/${prospero.script.path}/${prospero.dist.name}.sh" />
                                <move file="${project.build.outputDirectory}/${prospero.script.path}/prospero.bat" tofile="${project.build.outputDirectory}/${prospero.script.path}/${prospero.dist.name}.bat" />
                                <move file="${project.build.outputDirectory}/${prospero.script.path}/prospero.ps1" tofile="${project.build.outputDirectory}/${prospero.script.path}/${prospero.dist.name}.ps1" />
                                <move file="${project.build.outputDirectory}/${prospero.script.path}/prospero-logging.properties" tofile="${project.build.outputDirectory}/${prospero.script.path}/${prospero.dist.name}-logging.properties" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
