<?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.version>@server.version@</server.version>
    <version.org.wildfly.core>@version.org.wildfly.core@</version.org.wildfly.core>
    <generate-javadocs-pom.verbose>true</generate-javadocs-pom.verbose>
    <generate-javadocs-pom.serverVersion>${project.version}</generate-javadocs-pom.serverVersion>
    <generate-javadocs-pom.templatePomFile>${project.basedir}/template-pom.xml</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>
    <plugins>
      <!-- example how to specify configuration
      <plugin>
        <groupId>org.wildfly</groupId>
        <artifactId>javadocs-pom-generator-plugin</artifactId>
        <configuration>
          <templatePomFile>${project.build.directory}/../../../template-pom.xml</templatePomFile>
          <verbose>true</verbose>
          <serverVersion>7.2.0.CD13-redhat-4</serverVersion>
          <templatePomFile>${project.basedir}/../../../template-pom.xml</templatePomFile>
          <serverDistDir>${project.build.directory}/jboss-eap-7.2</serverDistDir>
          <serverSourceDir>${project.build.directory}/jboss-eap-7.2-src</serverSourceDir>
          <serverCoreSourceDir>${project.build.directory}/wildfly-core</serverCoreSourceDir>
        </configuration>
      </plugin>
      -->
    </plugins>

  </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>wildfly-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>wildfly-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>${version.org.wildfly.core}</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>


