<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2015 herd contributors

  Licensed 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.finra.herd</groupId>
      <artifactId>herd</artifactId>
      <version>0.97.0</version>
   </parent>

   <name>herd code</name>
   <packaging>pom</packaging>

   <artifactId>herd-code</artifactId>

   <description>This project contains the herd code. This is where all source code and non-build related files reside.</description>
   <url>http://finraos.github.io/herd/</url>

   <dependencies>
      <!-- These are dependencies that apply to the entire code base. -->
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>jcl-over-slf4j</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-slf4j-impl</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-api</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-core</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-dbcp2</artifactId>
      </dependency>
      <dependency>
         <groupId>com.google.code.findbugs</groupId>
         <artifactId>annotations</artifactId>
      </dependency>
      <dependency>
         <groupId>io.swagger</groupId>
         <artifactId>swagger-annotations</artifactId>
      </dependency>
   </dependencies>

   <build>

      <plugins>
         <!-- Plugins to be used by all extending projects. -->
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>${maven.build.helper.plugin.version}</version>
            <executions>
               <execution>
                  <phase>generate-sources</phase>
                  <goals>
                     <goal>add-source</goal>
                  </goals>
                  <configuration>
                     <sources>
                        <source>target/generated-sources</source>
                     </sources>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>${maven.checkstyle.plugin.version}</version>
            <!-- Use our custom rule set which is built as part of build-tools. -->
            <configuration>
               <!-- Exclude auto-generated files. -->
               <excludes>org/finra/herd/model/xml/**</excludes>
               <configLocation>herd-cs.xml</configLocation>
               <headerLocation>apache-license-header.txt</headerLocation>
               <!-- Display the Checkstyle errors on the build output. -->
               <consoleOutput>true</consoleOutput>
            </configuration>
            <!-- We need to specify a dependency on the tools project to get access to the herd-cs.xml file. -->
            <dependencies>
               <dependency>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>herd-build-tools</artifactId>
                  <version>${project.version}</version>
               </dependency>
            </dependencies>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>${maven.pmd.plugin.version}</version>
            <configuration>
               <targetJdk>${maven.compiler.source}</targetJdk>
               <!-- Use our custom rule set which is built as part of build-tools. -->
               <rulesets>
                  <ruleset>herd-pmd.xml</ruleset>
               </rulesets>
               <!-- Display the PMD errors on the build output. -->
               <verbose>true</verbose>
               <excludes>
                  <exclude>**/herd-spark-data-catalog/**/*</exclude>
                  <exclude>**/herd-spark-2.1-data-catalog/**/*</exclude>
                  <exclude>**/herd-spark-2.1-data-catalog/**/*</exclude>
               </excludes>
            </configuration>
            <!-- We need to specify a dependency on the tools project to get access to the herd-pmd.xml file. -->
            <dependencies>
               <dependency>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>herd-build-tools</artifactId>
                  <version>${project.version}</version>
               </dependency>
            </dependencies>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <configuration>
               <excludeFilterFile>herd-findbugs-exclude.xml</excludeFilterFile>
               <!-- Enables analysis which takes more memory, but finds the most bugs. Another value is "Low" which uses less memory, but finds less bugs. -->
               <effort>Max</effort>
               <!-- Reports all bugs when threshold is "Low". Other values are "Medium" and "Max". -->
               <threshold>Low</threshold>
               <!-- Produces an XML report which can be read with "mvn findbugs:gui". -->
               <xmlOutput>true</xmlOutput>
            </configuration>
            <!-- We need to specify a dependency on the tools project to get access to the herd-findbugs-exclude.xml file. -->
            <dependencies>
               <dependency>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>herd-build-tools</artifactId>
                  <version>${project.version}</version>
               </dependency>
            </dependencies>
         </plugin>
         <plugin>
            <groupId>org.openclover</groupId>
            <artifactId>clover-maven-plugin</artifactId>
            <configuration>
               <generateHtml>false</generateHtml>
               <generateXml>true</generateXml>
               <excludes>
                  <exclude>**/com/kscs/util/jaxb/*.java</exclude>
                  <exclude>**/org/finra/herd/model/annotation/*.java</exclude>
                  <exclude>**/org/finra/herd/model/dto/*.java</exclude>
                  <exclude>**/org/finra/herd/model/jpa/*.java</exclude>
                  <exclude>**/org/finra/herd/app/config/*.java</exclude>
                  <exclude>**/org/finra/herd/core/config/*.java</exclude>
                  <exclude>**/org/finra/herd/dao/config/*.java</exclude>
                  <exclude>**/org/finra/herd/rest/config/*.java</exclude>
                  <exclude>**/org/finra/herd/service/config/*.java</exclude>
                  <exclude>**/org/finra/herd/ui/config/*.java</exclude>
                  <exclude>**/org/finra/herd/dao/impl/*OperationsImpl.java</exclude>
                  <exclude>**/org/finra/herd/service/systemjobs/*.java</exclude>
                  <exclude>**/org/finra/herd/dao/credstash/*.java</exclude>
                  <exclude>**/org/finra/dm/service/activiti/*.java</exclude>
                  <exclude>**/org/finra/dm/service/activiti/task/*.java</exclude>
                  <exclude>**/org/finra/catalog/*.scala</exclude>
                  <exclude>**/org/apache/spark/sql/execution/datasources/*.scala</exclude>
                  <exclude>**/org/apache/spark/sql/herd/*.scala</exclude>
                  <exclude>**/org/apache/spark/sql/hive/orc/*.scala</exclude>
               </excludes>
            </configuration>
            <executions>
               <execution>
                  <id>clover-pre-site</id>
                  <phase>pre-site</phase>
                  <goals>
                     <goal>aggregate</goal>
                     <goal>clover</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
               <execution>
                  <goals>
                     <goal>test-jar</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
               <execution>
                  <id>attach-sources</id>
                  <goals>
                     <goal>jar</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
               <!-- Build individual Javadoc JAR's for each sub-project. -->
               <execution>
                  <id>jar</id>
                  <goals>
                     <goal>jar</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>

   </build>

   <profiles>
      <profile>
         <id>herd-main</id>
         <modules>
            <module>herd-model-api</module>
            <module>herd-model-api-15</module>
            <module>herd-model</module>
            <module>herd-core</module>
            <module>herd-dao</module>
            <module>herd-service</module>
            <module>herd-ui</module>
            <module>herd-rest</module>
            <module>herd-app</module>
            <module>herd-war</module>
         </modules>
      </profile>
      <profile>
         <id>herd-extensions</id>
         <modules>
            <module>herd-tools</module>
            <module>herd-sdk</module>
         </modules>
      </profile>
      <profile>
         <id>default</id>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <modules>
            <module>herd-model-api</module>
            <module>herd-model-api-15</module>
            <module>herd-model</module>
            <module>herd-core</module>
            <module>herd-dao</module>
            <module>herd-service</module>
            <module>herd-ui</module>
            <module>herd-rest</module>
            <module>herd-app</module>
            <module>herd-war</module>
            <module>herd-tools</module>
            <module>herd-sdk</module>
         </modules>
      </profile>
   </profiles>

</project>
