<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">
	<parent>
		<groupId>org.jboss.jbossas</groupId>
		<artifactId>jboss-as-parent</artifactId>
		<version>6.0.0.Final</version>
	</parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.jboss.jbossas</groupId>
  <artifactId>jboss-as-distribution</artifactId>
  <packaging>pom</packaging>
  <name>JBoss Application Server Distribution</name>
  <url>http://www.jboss.org/jbossas</url>
  <description>JBoss Application Server Distribution</description>

  <dependencies>
    
    <!-- 
      The Build is in charge of creating $JBOSS_HOME under its /target, so depend upon that
      and also the proper completion of the EmbeddedAS integration suite before we're allowed
      to install or deploy the dist artifact
      -->
    <dependency>
      <groupId>org.jboss.jbossas</groupId>
      <artifactId>jboss-as-embedded</artifactId>
      <version>${project.version}</version>
      <optional>true</optional>
      <type>pom</type>
    </dependency>
    
  </dependencies>
  
  <profiles>
    <profile>
      <id>dist-zip</id>
      <activation>
        <property>
          <name>dist-zip</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/assembly/jboss-dist.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>      
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>version-jars</id>
                <phase>package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <property name="jboss.dist.dir" value="${basedir}/../build/target/jboss-${project.version}" />
                    <mkdir dir="${project.build.directory}" />
                    <javac destdir="${project.build.directory}" executable="${env.JAVA_HOME}/bin/javac" 
                        fork="true">
                      <src path="."/>
                      <classpath>
                        <pathelement location="${jboss.dist.dir}/lib/dom4j.jar"/>
                      </classpath>
                      <include name="VersionRelease.java"/>
                    </javac>
                    <echo message="Versioning: jboss-${project.version}"/>
                    <java classname="VersionRelease">
                      <arg value="${jboss.dist.dir}"/>
                      <classpath>
                        <pathelement location="${project.build.directory}"/>
                        <pathelement location="${jboss.dist.dir}/lib/dom4j.jar"/>
                      </classpath>
                      <sysproperty key="specification.title" value="${project.name}"/>
                      <sysproperty key="specification.vendor" value="${project.organization.name}"/>
                      <sysproperty key="specification.version" value="${project.version}"/>
                      <sysproperty key="implementation.title" value="${project.name}"/>
                      <sysproperty key="implementation.vendor" value="${project.organization.name}"/>
                      <sysproperty key="implementation.vendor.id" value="${project.groupId}"/>
                      <sysproperty key="implementation.version" value="${project.version}"/>
                      <sysproperty key="implementation.url" value="${project.url}"/>
                    </java>
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/assembly/jboss-dist.xml</descriptor>
                    <descriptor>src/assembly/jboss-dist-src.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>      
        </plugins>
      </build>
    </profile>
  </profiles>
  
  <distributionManagement>
    <snapshotRepository>
      <id>jboss-snapshots-repository</id>
      <name>JBoss Snapshot Repository</name>
      <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
      <!-- Need to set unique version to false to prevent large amounts of data building up in the snapshot repo -->
      <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
  </distributionManagement>
  
</project>
