Skip Source Assembly Unless -Prelease

Change-Id: I8098448b43115d5b03982c87e8bf2e49fcf6de2c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1766
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ian Maxon <imaxon@apache.org>
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index cb0b4d8..0064f35 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -357,66 +357,6 @@
         </executions>
       </plugin>
       <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/</src>
-                  <excludes>bin/**</excludes>
-                  <type>directory</type>
-                  <mapper>
-                    <type>perm</type>
-                    <prefix>/opt/apache-asterixdb/</prefix>
-                    <user>asterixdb</user>
-                    <group>asterixdb</group>
-                    <filemode>644</filemode>
-                  </mapper>
-                </data>
-                <data>
-                  <src>${project.build.directory}/${project.build.finalName}-binary-assembly/bin</src>
-                  <type>directory</type>
-                  <mapper>
-                    <type>perm</type>
-                    <prefix>/opt/apache-asterixdb/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>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <version>2.10</version>
@@ -482,6 +422,79 @@
         </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/</src>
+                      <excludes>bin/**</excludes>
+                      <type>directory</type>
+                      <mapper>
+                        <type>perm</type>
+                        <prefix>/opt/apache-asterixdb/</prefix>
+                        <user>asterixdb</user>
+                        <group>asterixdb</group>
+                        <filemode>644</filemode>
+                      </mapper>
+                    </data>
+                    <data>
+                      <src>${project.build.directory}/${project.build.finalName}-binary-assembly/bin</src>
+                      <type>directory</type>
+                      <mapper>
+                        <type>perm</type>
+                        <prefix>/opt/apache-asterixdb/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>
   </profiles>
   <dependencies>
     <dependency>
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index acb7ffa..8cae2aa 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -483,12 +483,18 @@
       </properties>
     </profile>
     <profile>
-      <id>source-assembly</id>
+      <id>skip-assembly</id>
       <activation>
         <file>
-          <exists>src/main/assembly/source.xml</exists>
+          <missing>src/main/assembly/source.xml</missing>
         </file>
       </activation>
+      <properties>
+        <skip.assembly>true</skip.assembly>
+      </properties>
+    </profile>
+    <profile>
+      <id>release</id>
       <build>
         <plugins>
           <plugin>
@@ -511,17 +517,11 @@
                   <descriptors>
                     <descriptor>src/main/assembly/source.xml</descriptor>
                   </descriptors>
+                  <skipAssembly>${skip.assembly}</skipAssembly>
                 </configuration>
               </execution>
             </executions>
           </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>release</id>
-      <build>
-        <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-gpg-plugin</artifactId>
diff --git a/hyracks-fullstack/pom.xml b/hyracks-fullstack/pom.xml
index 0ab040b..df1415a 100644
--- a/hyracks-fullstack/pom.xml
+++ b/hyracks-fullstack/pom.xml
@@ -441,12 +441,18 @@
       </properties>
     </profile>
     <profile>
-      <id>source-assembly</id>
+      <id>skip-assembly</id>
       <activation>
         <file>
-          <exists>src/main/assembly/source.xml</exists>
+          <missing>src/main/assembly/source.xml</missing>
         </file>
       </activation>
+      <properties>
+        <skip.assembly>true</skip.assembly>
+      </properties>
+    </profile>
+    <profile>
+      <id>release</id>
       <build>
         <plugins>
           <plugin>
@@ -469,17 +475,11 @@
                   <descriptors>
                     <descriptor>src/main/assembly/source.xml</descriptor>
                   </descriptors>
+                  <skipAssembly>${skip.assembly}</skipAssembly>
                 </configuration>
               </execution>
             </executions>
           </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>release</id>
-      <build>
-        <plugins>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-gpg-plugin</artifactId>