<!--
 ! 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>
  <artifactId>asterix-server</artifactId>
  <name>asterix-server</name>

  <parent>
    <groupId>org.apache.asterix</groupId>
    <artifactId>apache-asterixdb</artifactId>
    <version>0.9.4</version>
  </parent>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <properties>
    <root.dir>${basedir}/..</root.dir>
  </properties>

  <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>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>copy-license</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/../src/main/licenses/templates/</outputDirectory>
              <resources>
                <resource>
                  <directory>${basedir}/../asterix-dashboard/src/node/static/
                  </directory>
                  <includes>
                    <include>3rdpartylicenses.txt</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.hyracks</groupId>
        <artifactId>license-automation-plugin</artifactId>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <templateRootDir>${basedir}/../src/main/licenses/templates</templateRootDir>
          <generatedFiles>
            <generatedFile>
              <template>asterix-license.ftl</template>
              <outputFile>LICENSE</outputFile>
            </generatedFile>
            <generatedFile>
              <template>asterix-notice.ftl</template>
              <outputFile>NOTICE</outputFile>
            </generatedFile>
          </generatedFiles>
          <location>repo/</location>
          <licenseMapOutputFile>${project.build.directory}/generated-resources/license_map.json</licenseMapOutputFile>
          <timeoutSecs>10</timeoutSecs>
          <downloadDir>${project.build.directory}/generated-resources/license</downloadDir>
          <excludedScopes>
            <excludedScope>test</excludedScope>
          </excludedScopes>
          <excludes>
            <exclude>org.apache.asterix:*</exclude>
            <exclude>org.apache.algebricks:*</exclude>
            <exclude>org.apache.hyracks:*</exclude>
          </excludes>
          <licenseDirectory>${basedir}/../src/main/licenses/content</licenseDirectory>
          <models>
             <model>${basedir}/../src/main/appended-resources/supplemental-models.xml</model>
          </models>
          <extraLicenseMaps>
            <extraLicenseMap>
              <file>${basedir}/../asterix-client-helper/target/generated-resources/license_map.json</file>
              <location>lib/</location>
            </extraLicenseMap>
          </extraLicenseMaps>
          <overrides>
            <override>
              <gav>asm:asm:3.1</gav>
              <url>http://asm.objectweb.org/license.html</url>
            </override>
            <override>
              <gav>com.thoughtworks.paranamer:paranamer:2.3</gav>
              <url>https://github.com/codehaus/paranamer-git/blob/paranamer-2.3/LICENSE.txt</url>
            </override>
            <override>
              <gav>org.codehaus.jettison:jettison:1.1</gav>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            </override>
            <override>
              <gav>commons-configuration:commons-configuration:1.6</gav>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            </override>
            <override>
              <gav>commons-digester:commons-digester:1.8</gav>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            </override>
            <override>
              <gav>org.apache.zookeeper:zookeeper:3.4.5</gav>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            </override>
            <override>
              <gav>javax.servlet.jsp:jsp-api:2.1</gav>
              <url>https://jsp.java.net/license.html</url>
            </override>
            <override>
              <gav>com.google.protobuf:protobuf-java:2.5.0</gav>
              <url>https://github.com/google/protobuf/blob/v2.5.0/COPYING.txt</url>
            </override>
            <override>
              <gav>xmlenc:xmlenc:0.52</gav>
              <url>https://cytranet.dl.sourceforge.net/project/xmlenc/xmlenc/0.52/xmlenc-0.52.tgz?xmlenc-0.52/COPYRIGHT</url>
            </override>
            <override>
              <gav>org.codehaus.mojo.appassembler:appassembler-booter:2.0.0</gav>
              <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url>
            </override>
            <override>
              <gav>org.codehaus.mojo.appassembler:appassembler-model:2.0.0</gav>
              <url>https://raw.githubusercontent.com/mojohaus/appassembler/appassembler-2.0.0/LICENSE.txt</url>
            </override>
            <override>
              <gav>io.netty:netty-all:4.1.6.Final</gav>
              <noticeUrl>https://raw.githubusercontent.com/netty/netty/netty-4.1.16.Final/NOTICE.txt</noticeUrl>
            </override>
          </overrides>
          <licenses>
            <license>
                <displayName>Various 3rd party</displayName>
                <url>file://${basedir}}/../asterix-dashboard/src/main/resources/dashboard/static/3rdpartylicenses.txt</url>
                <contentFile>${basedir}}/../asterix-dashboard/src/main/resources/dashboard/static/3rdpartylicenses.txt</contentFile>
            </license>
            <license>
              <displayName>a BSD 3-clause license</displayName>
              <url>http://asm.objectweb.org/license.html</url>
            </license>
            <license>
              <displayName>a BSD 3-clause license</displayName>
              <url>https://github.com/google/protobuf/blob/v2.5.0/COPYING.txt</url>
              <contentFile>protobuf_2.5.0_LICENSE.txt</contentFile>
            </license>
            <license>
              <displayName>a BSD 3-clause license</displayName>
              <url>https://github.com/codehaus/paranamer-git/blob/paranamer-2.3/LICENSE.txt</url>
              <contentFile>paranamer-2.3_LICENSE.txt</contentFile>
            </license>
            <license>
              <displayName>a BSD 3-clause license</displayName>
              <url>https://cytranet.dl.sourceforge.net/project/xmlenc/xmlenc/0.52/xmlenc-0.52.tgz?xmlenc-0.52/COPYRIGHT</url>
              <contentFile>xmlenc_0.52_LICENSE.txt</contentFile>
            </license>
            <license>
              <displayName>The Apache Software License, Version 2.0</displayName>
              <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
              <aliasUrls>
                <aliasUrl>http://www.apache.org/licenses/LICENSE-2.0</aliasUrl>
                <aliasUrl>https://www.apache.org/licenses/LICENSE-2.0.txt</aliasUrl>
                <aliasUrl>http://www.apache.org/licenses/LICENSE-2.0.html</aliasUrl>
              </aliasUrls>
              <metric>1</metric>
            </license>
            <license>
              <url>https://java.net/projects/stax-utils/sources/svn/content/trunk/LICENSE</url>
              <contentFile>stax-utils_LICENSE.txt</contentFile>
              <displayName>a BSD 3-clause license</displayName>
              <aliasUrls>
                <aliasUrl>https://stax-utils.dev.java.net/source/browse/*checkout*/stax-utils/LICENSE</aliasUrl>
              </aliasUrls>
            </license>
            <license>
              <url>http://www.json.org/license.html</url>
              <displayName>The JSON License</displayName>
            </license>
            <license>
              <url>https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html</url>
              <!--<displayName>CDDL 1.1</displayName>-->
              <metric>10</metric>
              <aliasUrls>
                <aliasUrl>https://glassfish.java.net/public/CDDL+GPL_1_1.html</aliasUrl>
                <aliasUrl>http://glassfish.java.net/public/CDDL+GPL_1_1.html</aliasUrl>
                <aliasUrl>https://jsp.java.net/license.html</aliasUrl>
              </aliasUrls>
            </license>
            <license>
              <url>http://www.sun.com/cddl/cddl.html</url>
              <metric>10</metric>
              <aliasUrls>
                <aliasUrl>https://glassfish.dev.java.net/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>https://glassfish.dev.java.net/nonav/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>http://glassfish.dev.java.net/nonav/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>http://glassfish.java.net/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>https://glassfish.java.net/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>http://glassfish.dev.java.net/public/CDDL+GPL.html</aliasUrl>
                <aliasUrl>https://glassfish.dev.java.net/public/CDDLv1.0.html</aliasUrl>
                <aliasUrl>https://glassfish.java.net/public/CDDLv1.0.html</aliasUrl>
              </aliasUrls>
            </license>
            <license>
              <url>http://www.antlr.org/license.html</url>
              <aliasUrls>http://antlr.org/license.html</aliasUrls>
            </license>
            <license>
              <url>https://opensource.org/licenses/mit-license.php</url>
              <aliasUrls>http://www.opensource.org/licenses/mit-license.php</aliasUrls>
            </license>
            <license>
              <url>https://opensource.org/licenses/bsd-license.php</url>
              <aliasUrls>http://www.opensource.org/licenses/bsd-license.php</aliasUrls>
            </license>
            <license>
              <!-- this is special case- handled in ftl template -->
              <url>PUBLIC_DOMAIN</url>
              <aliasUrls>Public Domain</aliasUrls>
            </license>
          </licenses>
          <templateProperties>
            <packageName>Apache AsterixDB Server Install</packageName>
            <asterixAppLocation>repo/asterix-app-${project.version}.jar, within this assembly</asterixAppLocation>
            <hyracksControlCcLocation>repo/hyracks-control-cc-${project.version}.jar, within this assembly</hyracksControlCcLocation>
            <hivecompatLocation>repo/asterix-hivecompat-${project.version}.jar, within this assembly</hivecompatLocation>
            <asterixDashboardLocation>repo/asterix-dashboard-${project.version}.jar, within this assembly</asterixDashboardLocation>
          </templateProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <configuration>
          <assembleDirectory>
            ${project.build.directory}/appassembler
          </assembleDirectory>
          <repositoryLayout>flat</repositoryLayout>
          <useWildcardClassPath>true</useWildcardClassPath>
          <programs>
            <program>
              <platforms>
                <platform>unix</platform>
              </platforms>
              <name>asterixcc</name>
              <mainClass>org.apache.hyracks.control.cc.CCDriver</mainClass>
              <commandLineArguments>
                <commandLineArgument>-app-class</commandLineArgument>
                <commandLineArgument>org.apache.asterix.hyracks.bootstrap.CCApplication</commandLineArgument>
              </commandLineArguments>
            </program>
            <program>
              <platforms>
                <platform>unix</platform>
              </platforms>
              <name>asterixnc</name>
              <mainClass>org.apache.hyracks.control.nc.NCDriver</mainClass>
              <commandLineArguments>
                <commandLineArgument>-app-class</commandLineArgument>
                <commandLineArgument>org.apache.asterix.hyracks.bootstrap.NCApplication</commandLineArgument>
              </commandLineArguments>
            </program>
            <program>
              <platforms>
                <platform>unix</platform>
              </platforms>
              <name>asterixncservice</name>
              <mainClass>org.apache.hyracks.control.nc.service.NCService</mainClass>
            </program>
          </programs>
          <daemons>
            <daemon>
              <id>asterixcc</id>
              <mainClass>org.apache.hyracks.control.cc.CCDriver</mainClass>
              <platforms>
                <platform>booter-windows</platform>
              </platforms>
              <commandLineArguments>
                <commandLineArgument>-app-class</commandLineArgument>
                <commandLineArgument>org.apache.asterix.hyracks.bootstrap.CCApplication</commandLineArgument>
              </commandLineArguments>
            </daemon>
            <daemon>
              <id>asterixnc</id>
              <mainClass>org.apache.hyracks.control.nc.NCDriver</mainClass>
              <platforms>
                <platform>booter-windows</platform>
              </platforms>
              <commandLineArguments>
                <commandLineArgument>-app-class</commandLineArgument>
                <commandLineArgument>org.apache.asterix.hyracks.bootstrap.NCApplication</commandLineArgument>
              </commandLineArguments>
            </daemon>
            <daemon>
              <id>asterixncservice</id>
              <mainClass>org.apache.hyracks.control.nc.service.NCService</mainClass>
              <platforms>
                <platform>booter-windows</platform>
              </platforms>
            </daemon>
          </daemons>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>assemble</goal>
              <goal>generate-daemons</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>process-test-classes</id>
            <phase>package</phase>
            <configuration>
              <target>
                <chmod file="target/appassembler/bin/*" perm="755" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <configuration>
              <attach>true</attach>
              <filters>
                <filter>${project.basedir}/src/main/assembly/filter.properties</filter>
              </filters>
              <descriptors>
                <descriptor>${project.basedir}/src/main/assembly/binary-assembly.xml</descriptor>
              </descriptors>
            </configuration>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <ignoredDependencies combine.children="append">
            <ignoredDependency>org.apache.asterix:asterix-opt-bom:*</ignoredDependency>
          </ignoredDependencies>
          <usedDependencies combine.children="append">
            <usedDependency>org.apache.asterix:asterix-app</usedDependency>
            <usedDependency>org.apache.asterix:asterix-client-helper</usedDependency>
            <usedDependency>org.apache.hadoop:hadoop-minicluster</usedDependency>
            <usedDependency>org.apache.hyracks:hyracks-control-cc</usedDependency>
            <usedDependency>org.apache.hyracks:hyracks-control-nc</usedDependency>
            <usedDependency>org.apache.hyracks:hyracks-nc-service</usedDependency>
            <usedDependency>org.apache.asterix:asterix-external-data</usedDependency>
            <usedDependency>org.codehaus.mojo.appassembler:appassembler-booter</usedDependency>
            <usedDependency>org.apache.asterix:asterix-fuzzyjoin</usedDependency>
            <usedDependency>org.apache.asterix:asterix-dashboard</usedDependency>
          </usedDependencies>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.hyracks</groupId>
                    <artifactId>license-automation-plugin</artifactId>
                    <versionRange>[0.0,)</versionRange>
                    <goals>
                      <goal>generate</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <profiles>
    <profile>
      <id>opt-modules</id>
      <activation>
        <file>
          <exists>../asterix-opt/pom.xml</exists>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.asterix</groupId>
          <artifactId>asterix-opt-bom</artifactId>
          <version>${project.version}</version>
          <type>pom</type>
        </dependency>
      </dependencies>
    </profile>
    <!-- putting jdeb in a profile ensures it runs after inherited plugins which may be in a profile -->
    <profile>
      <id>jdeb</id>
      <activation>
        <file>
          <exists>pom.xml</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>jdeb</artifactId>
            <groupId>org.vafer</groupId>
            <version>1.5</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jdeb</goal>
                </goals>
                <configuration>
                  <dataSet>
                    <data>
                      <src>${project.build.directory}/${project.build.finalName}-binary-assembly/apache-asterixdb-${project.version}/</src>
                      <excludes>bin/**</excludes>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/opt/apache-asterixdb-${project.version}/</prefix>
                        <user>asterixdb</user>
                        <group>asterixdb</group>
                        <filemode>644</filemode>
                      </mapper>
                    </data>
                    <data>
                      <src>${project.build.directory}/${project.build.finalName}-binary-assembly/apache-asterixdb-${project.version}/bin</src>
                      <type>directory</type>
                      <mapper>
                        <type>perm</type>
                        <prefix>/opt/apache-asterixdb-${project.version}/bin</prefix>
                        <user>asterixdb</user>
                        <group>asterixdb</group>
                        <filemode>754</filemode>
                      </mapper>
                    </data>
                    <data>
                      <type>file</type>
                      <src>src/deb/systemd/asterix-cc.service</src>
                      <mapper>
                        <prefix>/lib/systemd/system</prefix>
                        <type>perm</type>
                        <user>root</user>
                        <group>root</group>
                      </mapper>
                    </data>
                    <data>
                      <type>file</type>
                      <src>src/deb/systemd/asterix-nc.service</src>
                      <mapper>
                        <prefix>/lib/systemd/system</prefix>
                        <type>perm</type>
                        <user>root</user>
                        <group>root</group>
                      </mapper>
                    </data>
                  </dataSet>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>asterix-gerrit-integration-tests</id>
      <properties>
        <test.includes/>
        <itest.includes>**/NCServiceExecutionIT.java,**/RecoveryIT.java</itest.includes>
        <failIfNoTests>false</failIfNoTests>
      </properties>
    </profile>
    <profile>
      <id>asterix-gerrit-verify-no-app</id>
      <properties>
        <test.includes/>
        <itest.excludes>**/NCServiceExecutionIT.java,**/RecoveryIT.java</itest.excludes>
        <failIfNoTests>false</failIfNoTests>
      </properties>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-control-cc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-control-nc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-nc-service</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-app</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-server</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-app</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-common</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-test-framework</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.mojo.appassembler</groupId>
      <artifactId>appassembler-booter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-client-helper</artifactId>
      <version>${project.version}</version>
      <type>zip</type>
      <classifier>assembly</classifier>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-external-data</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-external-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>3.0.24</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-minicluster</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-util</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-fuzzyjoin</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hyracks</groupId>
      <artifactId>hyracks-test-support</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.asterix</groupId>
      <artifactId>asterix-dashboard</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
</project>
