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

  <modelVersion>4.0.0</modelVersion>

  <groupId>org.wildfly</groupId>
  <artifactId>generate-javadocs-pom</artifactId>
  <version>@pom.version@</version>

  <name>Generate Javadocs POM File</name>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <server.dist>@server.dist@</server.dist>
    <server.version>@server.version@</server.version>
    <core.version>@core.version@</core.version>
    <template.filename>@template.filename@</template.filename>

    <generate-javadocs-pom.verbose>true</generate-javadocs-pom.verbose>
    <generate-javadocs-pom.templatePomFile>${project.basedir}/${template.filename}</generate-javadocs-pom.templatePomFile>
    <generate-javadocs-pom.serverDistDir>${project.build.directory}/jboss-eap-7.3</generate-javadocs-pom.serverDistDir>
    <generate-javadocs-pom.serverSourceDir>${project.build.directory}/jboss-eap-7.3-src</generate-javadocs-pom.serverSourceDir>
    <generate-javadocs-pom.serverCoreSourceDir>${project.build.directory}/jboss-eap-7.3-core-src</generate-javadocs-pom.serverCoreSourceDir>
    <generate-javadocs-pom.serverVersion>${server.version}</generate-javadocs-pom.serverVersion>

    <version.org.wildfly.javadocs-pom-generator-plugin>@version.org.wildfly.javadocs-pom-generator-plugin@</version.org.wildfly.javadocs-pom-generator-plugin>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.wildfly</groupId>
          <artifactId>javadocs-pom-generator-plugin</artifactId>
          <version>${version.org.wildfly.javadocs-pom-generator-plugin}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>download-files</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.googlecode.maven-download-plugin</groupId>
            <artifactId>download-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
              <execution>
                <id>download-server-dist</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.jboss.eap</groupId>
                  <artifactId>${server.dist}</artifactId>
                  <version>${server.version}</version>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>download-server-source</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.jboss.eap</groupId>
                  <artifactId>${server.dist}</artifactId>
                  <version>${server.version}</version>
                  <classifier>src</classifier>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>download-server-core-source</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>artifact</goal>
                </goals>
                <configuration>
                  <groupId>org.wildfly.core</groupId>
                  <artifactId>wildfly-core-parent</artifactId>
                  <version>${core.version}</version>
                  <classifier>project-sources</classifier>
                  <type>zip</type>
                  <unpack>true</unpack>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>


