<?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>

   <!-- ********************************************** -->
   <!-- ****************** BASE POM ****************** -->
   <!-- ********************************************** -->

   <parent>
      <groupId>com.wandrell.maven</groupId>
      <artifactId>base-pom</artifactId>
      <version>1.1.6</version>
   </parent>

   <!-- ********************************************** -->
   <!-- **************** PROJECT INFO **************** -->
   <!-- ********************************************** -->

   <groupId>com.bernardomg.maven.skins</groupId>
   <artifactId>docs-maven-skin</artifactId>
   <version>1.2.0</version>

   <name>Docs Maven Skin</name>
   <description>A Maven skin for using Maven Site as a documentation site</description>
   <url>https://github.com/Bernardo-MG/docs-maven-skin</url>
   <inceptionYear>2015</inceptionYear>

   <licenses>
      <license>
         <name>MIT License</name>
         <url>http://www.opensource.org/licenses/mit-license.php</url>
         <distribution>repo</distribution>
      </license>
   </licenses>

   <!-- ********************************************** -->
   <!-- ************ RESOURCES AND SERVICES ********** -->
   <!-- ********************************************** -->

   <scm>
      <connection>scm:git:https://github.com/Bernardo-MG/docs-maven-skin.git</connection>
      <developerConnection>scm:git:https://github.com/Bernardo-MG/docs-maven-skin.git</developerConnection>
      <tag>head</tag>
      <url>https://github.com/Bernardo-MG/docs-maven-skin</url>
   </scm>

   <issueManagement>
      <system>GitHub</system>
      <url>https://www.github.com/bernardo-mg/docs-maven-skin/issues</url>
   </issueManagement>

   <ciManagement>
      <system>Travis CI</system>
      <url>https://travis-ci.org/Bernardo-MG/docs-maven-skin</url>
      <notifiers />
   </ciManagement>

   <distributionManagement>
      <repository>
         <uniqueVersion>false</uniqueVersion>
         <id>releases</id>
         <name>Releases Repository</name>
         <url>https://api.bintray.com/maven/bernardo-mg/maven/docs-maven-skin</url>
      </repository>
      <snapshotRepository>
         <uniqueVersion>false</uniqueVersion>
         <id>snapshots</id>
         <name>Snapshots Repository</name>
         <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
      </snapshotRepository>
   </distributionManagement>

   <!-- ********************************************** -->
   <!-- ****************** PROFILES ****************** -->
   <!-- ********************************************** -->

   <profiles>
      <profile>
         <!-- Profile for the Eclipse Maven plugin -->
         <!-- Sets the POM so this plugin does not give the usual unregistered 
            goals errors -->
         <!-- It will be activated automatically on Eclipse if this has the 
            m2e plugin, by detecting the version property -->
         <id>eclipse</id>
         <activation>
            <property>
               <name>m2e.version</name>
            </property>
         </activation>
         <build>
            <pluginManagement>
               <plugins>
                  <plugin>
                     <!-- m2e lifecycle mapping -->
                     <!-- This is used to configure the Maven plugin for 
                        Eclipse. -->
                     <!-- Among other things, it allows registering goals, 
                        which Eclipse would otherwise reject. -->
                     <!-- It has no real effect on Maven. -->
                     <groupId>org.eclipse.m2e</groupId>
                     <artifactId>lifecycle-mapping</artifactId>
                     <version>${plugin.lifecycle.version}</version>
                     <configuration>
                        <downloadSources>true</downloadSources>
                        <downloadJavadocs>true</downloadJavadocs>
                     </configuration>
                  </plugin>
               </plugins>
            </pluginManagement>
         </build>
      </profile>
      <profile>
         <!-- Release site deployment profile -->
         <!-- Sets the site repository to point to the releases repo -->
         <id>deployment-release</id>
         <activation>
            <!-- Active by default so the repository appears in the reports -->
            <activeByDefault>true</activeByDefault>
         </activation>
         <distributionManagement>
            <site>
               <id>site</id>
               <name>Project Documentation Site</name>
               <url>scp://docs.wandrell.com:2222/home1/duenco/www/maven/docs-maven-skin</url>
            </site>
         </distributionManagement>
      </profile>
      <profile>
         <!-- Development site deployment profile -->
         <!-- Sets the site repository to point to the development repo -->
         <id>deployment-development</id>
         <distributionManagement>
            <site>
               <id>site-development</id>
               <name>Project Development Documentation Site</name>
               <url>scp://docs.wandrell.com:2222/home1/duenco/www/development/maven/docs-maven-skin</url>
            </site>
         </distributionManagement>
      </profile>
      <profile>
         <!-- Deployment profile -->
         <!-- Sets ups the environment for deployment -->
         <id>deployment</id>
         <properties>
            <!-- Tests are skipped -->
            <maven.test.skip>true</maven.test.skip>
         </properties>
      </profile>
   </profiles>

   <!-- ********************************************** -->
   <!-- *********** ORGANIZATION AND MEMBERS ********* -->
   <!-- ********************************************** -->

   <organization>
      <name>Bernardo Martínez Garrido</name>
      <url>https://github.com/Bernardo-MG</url>
   </organization>

   <developers>
      <developer>
         <id>bmg</id>
         <name>Bernardo Martínez Garrido</name>
         <email>programming@wandrell.com</email>
         <url>https://github.com/Bernardo-MG</url>
         <organization>Bernardo Martínez Garrido</organization>
         <organizationUrl>https://github.com/Bernardo-MG</organizationUrl>
         <roles>
            <role>Developer</role>
         </roles>
         <timezone>+1</timezone>
         <properties />
      </developer>
   </developers>

   <!-- ********************************************** -->
   <!-- **************** PROPERTIES ****************** -->
   <!-- ********************************************** -->

   <properties>
      <!-- ============================================== -->
      <!-- =============== MANIFEST DATA ================ -->
      <!-- ============================================== -->
      <manifest.name>com/wandrell/maven/skins/docs-maven-skin</manifest.name>
      <!-- ============================================== -->
      <!-- =========== DEPENDENCIES VERSIONS ============ -->
      <!-- ============================================== -->
      <hamcrest.version>1.3</hamcrest.version>
      <jcabi.matchers.version>1.4</jcabi.matchers.version>
      <jcabi.w3c.version>1.3</jcabi.w3c.version>
      <jsoup.version>1.9.2</jsoup.version>
      <wandrell.configTool.version>1.0.0</wandrell.configTool.version>
      <wandrell.siteFixer.version>1.0.0</wandrell.siteFixer.version>
      <!-- ============================================== -->
      <!-- ============== PLUGINS VERSIONS ============== -->
      <!-- ============================================== -->
      <plugin.frontend.node.version>v6.11.3</plugin.frontend.node.version>
      <plugin.frontend.npm.version>5.4.2</plugin.frontend.npm.version>
      <plugin.frontend.version>1.6</plugin.frontend.version>
      <plugin.invoker.version>3.0.1</plugin.invoker.version>
      <plugin.jshint.version>1.6.0</plugin.jshint.version>
      <plugin.minify.version>1.7.6</plugin.minify.version>
      <!-- ============================================== -->
      <!-- ================= MAVEN SITE ================= -->
      <!-- ============================================== -->
      <site.skin.version>1.1.1</site.skin.version>
      <bintrayURL>https://bintray.com/bernardo-mg/maven/docs-maven-skin/view</bintrayURL>
      <mavenURL>http://mvnrepository.com/artifact/${project.groupId}/${project.artifactId}</mavenURL>
      <!-- ============================================== -->
      <!-- ============== IT CONFIGURATION ============== -->
      <!-- ============================================== -->
      <basePom.version>${project.parent.version}</basePom.version>
   </properties>

   <!-- ********************************************** -->
   <!-- *************** DEPENDENCIES ***************** -->
   <!-- ********************************************** -->

   <dependencies>
      <dependency>
         <!-- Maven Site Fixer -->
         <groupId>com.wandrell.velocity</groupId>
         <artifactId>maven-site-fixer</artifactId>
         <version>${wandrell.siteFixer.version}</version>
      </dependency>
      <dependency>
         <!-- Velocity config tool -->
         <groupId>com.wandrell.velocity</groupId>
         <artifactId>velocity-config-tool</artifactId>
         <version>${wandrell.configTool.version}</version>
      </dependency>
   </dependencies>

   <!-- ********************************************** -->
   <!-- ******************* BUILD ******************** -->
   <!-- ********************************************** -->

   <build>
      <defaultGoal>clean package install</defaultGoal>
      <resources>
         <resource>
            <directory>src/main/resources/</directory>
         </resource>
         <resource>
            <!-- Filter skin template to add generator version -->
            <directory>src/main/resources/</directory>
            <includes>
               <include>META-INF/maven/*</include>
            </includes>
            <filtering>true</filtering>
         </resource>
      </resources>
      <plugins>
         <plugin>
            <!-- Changes -->
            <!-- Takes care of the changes log -->
            <!-- It is set to also validate the changes log file -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-changes-plugin</artifactId>
            <executions>
               <!-- Changes plugin is bound to the pre-site phase -->
               <execution>
                  <id>check-changes</id>
                  <phase>pre-site</phase>
                  <goals>
                     <goal>changes-check</goal>
                  </goals>
               </execution>
               <execution>
                  <id>validate-changes</id>
                  <phase>pre-site</phase>
                  <goals>
                     <goal>changes-validate</goal>
                  </goals>
                  <configuration>
                     <failOnError>true</failOnError>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <!-- Clean -->
            <!-- Deletes the Maven project generated files -->
            <artifactId>maven-clean-plugin</artifactId>
            <configuration>
               <filesets>
                  <fileset>
                     <directory>/</directory>
                     <includes>
                        <include>node_modules/**/*</include>
                     </includes>
                     <followSymlinks>false</followSymlinks>
                  </fileset>
               </filesets>
            </configuration>
         </plugin>
         <plugin>
            <!-- Site -->
            <!-- Generates the Maven Site -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <dependencies>
               <dependency>
                  <!-- Docs Maven Skin -->
                  <groupId>com.bernardomg.maven.skins</groupId>
                  <artifactId>docs-maven-skin</artifactId>
                  <version>${site.skin.version}</version>
               </dependency>
            </dependencies>
         </plugin>
         <plugin>
            <!-- Resources -->
            <!-- Handles the project resources. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
               <!-- Variables to to override will be delimited with a @. -->
               <!-- This avoids collisions with Velocity variables. -->
               <!-- So instead of replacing ${project.name} Maven will replace 
                  @project.name@. -->
               <useDefaultDelimiters>false</useDefaultDelimiters>
               <delimiters>
                  <delimiter>@</delimiter>
               </delimiters>
            </configuration>
            <executions>
               <execution>
                  <!-- Frontend dependencies are acquired with npm and copied 
                     to the libs folder -->
                  <id>copy-site-dependencies</id>
                  <phase>generate-resources</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                     <outputDirectory>${basedir}/target/classes/lib/</outputDirectory>
                     <resources>
                        <resource>
                           <directory>node_modules/</directory>
                           <includes>
                              <include>bootstrap/dist/js/bootstrap.min.js</include>
                              <include>bootswatch/readable/bootstrap.min.css</include>
                              <include>font-awesome/css/font-awesome.min.css</include>
                              <include>font-awesome/fonts/*.*</include>
                              <include>html5shiv/dist/html5shiv.min.js</include>
                              <include>jquery/dist/jquery.min.js</include>
                           </includes>
                        </resource>
                     </resources>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <!-- JSHint -->
            <!-- Validates the JS files -->
            <groupId>com.cj.jshintmojo</groupId>
            <artifactId>jshint-maven-plugin</artifactId>
            <version>${plugin.jshint.version}</version>
            <executions>
               <execution>
                  <id>jshint</id>
                  <phase>test</phase>
                  <goals>
                     <goal>lint</goal>
                  </goals>
               </execution>
            </executions>
            <configuration>
               <options>maxdepth:3,latedef,nonew,jquery</options>
               <directories>
                  <directory>src/main/resources/js</directory>
               </directories>
               <reporter>checkstyle</reporter>
               <reportFile>target/jshint.xml</reportFile>
               <failOnError>true</failOnError>
            </configuration>
         </plugin>
         <plugin>
            <!-- Maven Invoker -->
            <!-- Runs the IT test -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>${plugin.invoker.version}</version>
            <configuration>
               <debug>true</debug>
               <projectsDirectory>src/test/resources/it</projectsDirectory>
               <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
               <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
               <postBuildHookScript>verify</postBuildHookScript>
               <goals>
                  <goal>site</goal>
               </goals>
            </configuration>
            <dependencies>
               <dependency>
                  <!-- Hamcrest -->
                  <groupId>org.hamcrest</groupId>
                  <artifactId>hamcrest-all</artifactId>
                  <version>${hamcrest.version}</version>
               </dependency>
               <dependency>
                  <!-- jcabi matchers -->
                  <groupId>com.jcabi</groupId>
                  <artifactId>jcabi-matchers</artifactId>
                  <version>${jcabi.matchers.version}</version>
               </dependency>
               <dependency>
                  <!-- jcabi W3C -->
                  <groupId>com.jcabi</groupId>
                  <artifactId>jcabi-w3c</artifactId>
                  <version>${jcabi.w3c.version}</version>
               </dependency>
               <dependency>
                  <!-- JSoup -->
                  <groupId>org.jsoup</groupId>
                  <artifactId>jsoup</artifactId>
                  <version>${jsoup.version}</version>
               </dependency>
            </dependencies>
            <executions>
               <execution>
                  <id>verify-sites</id>
                  <goals>
                     <goal>install</goal>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <!-- Frontend Plugin -->
            <!-- Manages frontend dependencies -->
            <groupId>com.github.eirslett</groupId>
            <artifactId>frontend-maven-plugin</artifactId>
            <version>${plugin.frontend.version}</version>
            <configuration>
               <installDirectory>target</installDirectory>
            </configuration>
            <executions>
               <execution>
                  <id>node-npm-install</id>
                  <goals>
                     <goal>install-node-and-npm</goal>
                  </goals>
                  <configuration>
                     <nodeVersion>${plugin.frontend.node.version}</nodeVersion>
                     <npmVersion>${plugin.frontend.npm.version}</npmVersion>
                  </configuration>
               </execution>
               <execution>
                  <id>npm-install</id>
                  <goals>
                     <goal>npm</goal>
                  </goals>
                  <configuration>
                     <arguments>install</arguments>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>com.samaxes.maven</groupId>
            <artifactId>minify-maven-plugin</artifactId>
            <version>${plugin.minify.version}</version>
            <executions>
               <execution>
                  <id>minify-css</id>
                  <configuration>
                     <webappSourceDir>${basedir}/src/main/resources/</webappSourceDir>
                     <webappTargetDir>${basedir}/target/classes/</webappTargetDir>
                     <cssSourceIncludes>
                        <cssSourceInclude>**</cssSourceInclude>
                     </cssSourceIncludes>
                     <cssFinalFile>style.css</cssFinalFile>
                  </configuration>
                  <goals>
                     <goal>minify</goal>
                  </goals>
               </execution>
               <execution>
                  <id>minify-js</id>
                  <configuration>
                     <webappSourceDir>${basedir}/src/main/resources/</webappSourceDir>
                     <webappTargetDir>${basedir}/target/classes/</webappTargetDir>
                     <jsSourceIncludes>
                        <jsSourceInclude>**</jsSourceInclude>
                     </jsSourceIncludes>
                     <jsSourceExcludes>
                        <jsSourceExclude>initialize.js</jsSourceExclude>
                     </jsSourceExcludes>
                     <jsFinalFile>scripts.js</jsFinalFile>
                  </configuration>
                  <goals>
                     <goal>minify</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

   <!-- ********************************************** -->
   <!-- ****************** REPORTS ******************* -->
   <!-- ********************************************** -->

   <reporting>
      <plugins>
         <plugin>
            <!-- Maven Invoker -->
            <!-- IT tests report -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>${plugin.invoker.version}</version>
         </plugin>
      </plugins>
   </reporting>

</project>
