<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<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>

   <parent>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-pom</artifactId>
      <version>1.3.0-SNAPSHOT</version>
   </parent>

   <artifactId>artemis-website</artifactId>
   <packaging>jar</packaging>
   <name>ActiveMQ Artemis Web</name>

   <dependencies>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-core-client</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-jms-client</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-server</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-jms-server</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-journal</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-selector</artifactId>
         <version>${project.version}</version>
      </dependency>

      <!-- stuff needed to resolve various classes during javadoc processing -->
      <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging-processor</artifactId>
          <scope>provided</scope>
          <optional>true</optional>
      </dependency>
      <dependency>
          <groupId>xalan</groupId>
          <artifactId>xalan</artifactId>
          <version>2.7.2</version>
          <optional>true</optional>
          <scope>provided</scope>
      </dependency>
   </dependencies>

   <properties>
      <activemq.basedir>${project.basedir}/..</activemq.basedir>
      <webapp-dir>${project.artifactId}-${project.version}</webapp-dir>
      <webapp-outdir-user-manual>${basedir}/target/classes/user-manual</webapp-outdir-user-manual>
      <webapp-outdir-hacking-guide>${basedir}/target/classes/hacking-guide</webapp-outdir-hacking-guide>

      <frontend-maven-plugin-version>0.0.29</frontend-maven-plugin-version>
      <nodeVersion>v0.10.32</nodeVersion>
      <npmVersion>1.4.12</npmVersion>

   </properties>

   <build>
      <plugins>

         <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.1</version>
            <executions>
               <execution>
                  <id>javadoc-jar</id>
                  <phase>package</phase>
                  <goals>
                     <goal>jar</goal>
                  </goals>
                  <configuration>
                     <useStandardDocletOptions>true</useStandardDocletOptions>
                     <minmemory>128m</minmemory>
                     <maxmemory>512m</maxmemory>
                     <quiet>false</quiet>
                     <!-- switch on dependency-driven aggregation -->
                     <includeDependencySources>true</includeDependencySources>

                     <dependencySourceIncludes>
                        <!-- include ONLY dependencies I control -->
                        <dependencySourceInclude>org.apache.activemq:artemis-core-client</dependencySourceInclude>
                        <dependencySourceInclude>org.apache.activemq:artemis-jms-client</dependencySourceInclude>
                        <dependencySourceInclude>org.apache.activemq:artemis-server</dependencySourceInclude>
                        <dependencySourceInclude>org.apache.activemq:artemis-jms-server</dependencySourceInclude>
                        <dependencySourceInclude>org.apache.activemq:artemis-journal</dependencySourceInclude>
                        <dependencySourceInclude>org.apache.activemq:artemis-selector</dependencySourceInclude>
                     </dependencySourceIncludes>
                     <quiet>false</quiet>
                     <aggregate>true</aggregate>
                     <excludePackageNames>org.apache.activemq.artemis.core:org.apache.activemq.artemis.utils</excludePackageNames>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <profile>
         <id>release</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>com.github.eirslett</groupId>
                  <artifactId>frontend-maven-plugin</artifactId>
                  <version>${frontend-maven-plugin-version}</version>
                  <executions>
                     <execution>
                        <id>install node and npm</id>
                        <goals>
                           <goal>install-node-and-npm</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                           <nodeVersion>${nodeVersion}</nodeVersion>
                           <npmVersion>${npmVersion}</npmVersion>
                        </configuration>
                     </execution>
                     <execution>
                        <id>npm install</id>
                        <goals>
                           <goal>npm</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                           <arguments>install</arguments>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <version>1.6</version>
                  <executions>
                     <execution>
                        <phase>generate-sources</phase>
                        <configuration>
                           <target>
                              <condition property="gitbook.cmd" value="${basedir}/node_modules/.bin/gitbook.cmd" else="${basedir}/node_modules/.bin/gitbook">
                                 <os family="windows" />
                              </condition>
                              <!-- lets generate the gitbook -->
                              <mkdir dir="${webapp-outdir-user-manual}" />
                              <echo>executing ${gitbook.cmd}</echo>
                              <exec executable="${gitbook.cmd}" failonerror="true">
                                 <env key="PATH" path="${basedir}/node"/>
                                 <arg value="build" />
                                 <arg value="${basedir}/../docs/user-manual/en" />
                                 <arg value="${webapp-outdir-user-manual}" />
                              </exec>
                              <mkdir dir="${webapp-outdir-hacking-guide}" />
                              <echo>executing ${gitbook.cmd}</echo>
                              <exec executable="${gitbook.cmd}" failonerror="true">
                                 <env key="PATH" path="${basedir}/node"/>
                                 <arg value="build" />
                                 <arg value="${basedir}/../docs/hacking-guide/en" />
                                 <arg value="${webapp-outdir-hacking-guide}" />
                              </exec>
                           </target>
                        </configuration>
                        <goals>
                           <goal>run</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>