Allow for optional modules in build.

Change-Id: Ib99bfb3f92dfaa66dc2299db31b734adb5cceeca
Reviewed-on: https://asterix-gerrit.ics.uci.edu/768
Reviewed-by: Chris Hillery <ceej@lambda.nu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/.gitignore b/.gitignore
index 6453783..ced139e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,6 @@
 dist
 *.iml
 .idea/
+asterixdb/asterix-opt
+*~
+
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index 43bb997..2238f58 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -50,6 +50,7 @@
             ${project.build.directory}/appassembler
           </assembleDirectory>
           <repositoryLayout>flat</repositoryLayout>
+          <useWildcardClassPath>true</useWildcardClassPath>
           <programs>
             <program>
               <platforms>
@@ -128,6 +129,24 @@
       </plugin>
     </plugins>
   </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>0.1-SNAPSHOT</version>
+          <type>pom</type>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
   <dependencies>
   	<dependency>
   		<groupId>org.apache.hyracks</groupId>
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index 09cccb7..dd7a8b3 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -290,6 +290,17 @@
 
     <profiles>
         <profile>
+            <id>opt-modules</id>
+            <activation>
+              <file>
+                <exists>asterix-opt/pom.xml</exists>
+              </file>
+            </activation>
+            <modules>
+                <module>asterix-opt</module>
+            </modules>
+        </profile>
+        <profile>
             <id>slow-aql-tests</id>
             <properties>
                 <runSlowAQLTests>true</runSlowAQLTests>