<?xml version="1.0" encoding="UTF-8"?>
<!--
  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.oozie</groupId>
        <artifactId>oozie-main</artifactId>
        <version>4.2.0</version>
    </parent>
    <groupId>org.apache.oozie</groupId>
    <artifactId>oozie-core</artifactId>
    <version>4.2.0</version>
    <description>Apache Oozie Core</description>
    <name>Apache Oozie Core</name>
    <packaging>jar</packaging>
    <properties>
        <test.exclude.pattern>_</test.exclude.pattern>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-minicluster</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.hbase</groupId>
            <artifactId>hbase</artifactId>
             <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hive.hcatalog</groupId>
            <artifactId>hive-webhcat-java-client</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.hive.hcatalog</groupId>
            <artifactId>hive-hcatalog-server-extensions</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.oozie</groupId>
            <artifactId>oozie-client</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa-persistence</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa-jdbc</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa-persistence-jdbc</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>javax.persistence</groupId>
            <artifactId>persistence-api</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
        </dependency>

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.oozie</groupId>
            <artifactId>oozie-hadoop-distcp</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>apache-log4j-extras</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>commons-el</groupId>
            <artifactId>commons-el</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <scope>compile</scope>
        </dependency>


        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <scope>compile</scope>
        </dependency>

        <!--
        Oozie web-app module must exclude it.
         -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
        </dependency>

        <dependency>
            <groupId>com.icegreen</groupId>
            <artifactId>greenmail</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr-runtime</artifactId>
            <version>3.4</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.oozie</groupId>
            <artifactId>oozie-sharelib-oozie</artifactId>
            <scope>compile</scope>
        </dependency>

         <dependency>
            <groupId>org.apache.oozie</groupId>
            <artifactId>oozie-sharelib-hcatalog</artifactId>
            <scope>compile</scope>
        </dependency>

         <dependency>
            <groupId>org.apache.oozie</groupId>
            <artifactId>oozie-sharelib-distcp</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-broker</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-kahadb-store</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-x-discovery</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-jvm</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.codahale.metrics</groupId>
            <artifactId>metrics-json</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- For drawing runtime DAG -->
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-graph-impl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-visualization</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung-algorithms</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.collections</groupId>
            <artifactId>collections-generic</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jgit</groupId>
            <artifactId>org.eclipse.jgit</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.hive</groupId>
            <artifactId>hive-jdbc</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>${basedir}/src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
                 <configuration>
                     <excludeSubProjects>false</excludeSubProjects>
                     <excludes>
                         <!-- excluding all as the root POM does the full check-->
                         <exclude>**</exclude>
                     </excludes>
                 </configuration>
             </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>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>../src/main/assemblies/empty.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-dependency-plugin</artifactId>
              <executions>
                <execution>
                  <id>create-mrapp-generated-classpath</id>
                  <phase>generate-test-resources</phase>
                  <goals>
                    <goal>build-classpath</goal>
                  </goals>
                  <configuration>
                    <!-- needed to run the unit test for DS to generate the required classpath
                         that is required in the env of the launch container in the mini mr/yarn cluster -->
                    <outputFile>${project.build.directory}/test-classes/mrapp-generated-classpath</outputFile>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enhancer</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                        <configuration>
                            <includes>
                                **/JsonWorkflowJob.class,
                                **/JsonWorkflowAction.class,
                                **/JsonCoordinatorJob.class,
                                **/JsonCoordinatorAction.class,
                                **/JsonSLAEvent.class,
                                **/JsonSLARegistrationEvent.class,
                                **/JsonBundleJob.class,

                                **/WorkflowJobBean.class,
                                **/WorkflowActionBean.class,
                                **/CoordinatorJobBean.class,
                                **/CoordinatorActionBean.class,
                                **/SLAEventBean.class,
                                **/SLARegistrationBean.class,
                                **/SLACalculatorBean.class,
                                **/SLASummaryBean.class,
                                **/BundleJobBean.class,
                                **/BundleActionBean.class,
                                **/ValidateConnectionBean.class,
                            </includes>
                            <addDefaultConstructor>true</addDefaultConstructor>
                            <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.openjpa</groupId>
                        <artifactId>openjpa</artifactId>
                        <version>${openjpa.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                        <version>${xerces.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>generateDocs</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>generateDocs</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <linksource>true</linksource>
                            <quiet>true</quiet>
                            <verbose>false</verbose>
                            <source>${maven.compile.source}</source>
                            <charset>${maven.compile.encoding}</charset>
                            <groups>
                                <group>
                                    <title>Action Executor API</title>
                                    <packages>
                                        org.apache.oozie.action
                                    </packages>
                                </group>
                                <group>
                                    <title>Local Oozie (for application development/testing)</title>
                                    <packages>
                                        org.apache.oozie.local
                                    </packages>
                                </group>
                            </groups>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>javadoc</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>oozieci</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>oozieci</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>**/TestRerun.java</exclude>
                                <exclude>**/TestCallableQueueService.java</exclude>
                                <exclude>**/TestSsh*.java</exclude>
                                <exclude>**/TestActionErrors.java</exclude>
                                <exclude>**/TestJavaActionExecutor.java</exclude>
                                <exclude>**/TestLauncher.java</exclude>
                                <exclude>**/TestShellActionExecutor.java</exclude>
                                <exclude>**/TestActionStartXCommand.java</exclude>
                                <exclude>**/TestActionCheckXCommand.java</exclude>
                                <exclude>**/TestCoordRerunXCommand.java</exclude>
                                <exclude>**/util/Test**</exclude>
                                <exclude>**/bundle/Test**</exclude>
                                <exclude>**/${test.exclude.pattern}/*</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>test-jar-all</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>testJarAll</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>test-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>test-jar-simple</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>testJarSimple</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>test-jar</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>**/XTestCase.class</include>
                                        <include>**/XFsTestCase.class</include>
                                        <include>**/MiniOozieTestCase.class</include>
                                        <include>**/XTestCase$*.class</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Include MySQL JDBC driver -->
        <profile>
            <id>mysql</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>oozie.test.db</name>
                    <value>mysql</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
        </profile>

        <!-- Include Oracle JDBC driver                                         -->
        <!-- Oracle JDBC driver is not available in any public Maven repository -->
        <!-- It must be manually installed in the local Maven cache             -->
        <profile>
            <id>oracle</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>oozie.test.db</name>
                    <value>oracle</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

</project>

