From 74cda94c5e496e29f42f1044aab90cab7dbe9d38 Mon Sep 17 00:00:00 2001
From: Grzegorz Slowikowski <gslowikowski@gmail.com>
Date: Tue, 1 Aug 2017 19:03:34 +0100
Subject: [PATCH] [SPARK-21592][BUILD] Skip maven-compiler-plugin main and test
 compilations in Maven build

`scala-maven-plugin` in `incremental` mode compiles `Scala` and `Java` classes. There is no need to execute `maven-compiler-plugin` goals to compile (in fact recompile) `Java`.

This change reduces compilation time (over 10% on my machine).

Author: Grzegorz Slowikowski <gslowikowski@gmail.com>

Closes #18750 from gslowikowski/remove-redundant-compilation-from-maven.
---
 common/sketch/pom.xml | 11 -----------
 common/unsafe/pom.xml | 11 -----------
 pom.xml               | 12 ++----------
 3 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/common/sketch/pom.xml b/common/sketch/pom.xml
index 6b81fc2b2b..ca929d8f25 100644
--- a/common/sketch/pom.xml
+++ b/common/sketch/pom.xml
@@ -69,17 +69,6 @@
             </javacArgs>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.6.1</version>
-          <configuration>
-            <compilerArgs combine.children="append">
-              <!-- This option is needed to suppress warnings from sun.misc.Unsafe usage -->
-              <arg>-XDignore.symbol.file</arg>
-            </compilerArgs>
-          </configuration>
-        </plugin>
       </plugins>
     </pluginManagement>
   </build>
diff --git a/common/unsafe/pom.xml b/common/unsafe/pom.xml
index 680d0413b1..772b0ef82f 100644
--- a/common/unsafe/pom.xml
+++ b/common/unsafe/pom.xml
@@ -106,17 +106,6 @@
             </javacArgs>
           </configuration>
         </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.6.1</version>
-          <configuration>
-            <compilerArgs combine.children="append">
-              <!-- This option is needed to suppress warnings from sun.misc.Unsafe usage -->
-              <arg>-XDignore.symbol.file</arg>
-            </compilerArgs>
-          </configuration>
-        </plugin>
       </plugins>
     </pluginManagement>
   </build>
diff --git a/pom.xml b/pom.xml
index c24334333d..589c7afe1e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1972,14 +1972,12 @@
             </execution>
             <execution>
               <id>scala-compile-first</id>
-              <phase>process-resources</phase>
               <goals>
                 <goal>compile</goal>
               </goals>
             </execution>
             <execution>
               <id>scala-test-compile-first</id>
-              <phase>process-test-resources</phase>
               <goals>
                 <goal>testCompile</goal>
               </goals>
@@ -2022,14 +2020,8 @@
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.6.1</version>
           <configuration>
-            <source>${java.version}</source>
-            <target>${java.version}</target>
-            <encoding>UTF-8</encoding>
-            <maxmem>1024m</maxmem>
-            <fork>true</fork>
-            <compilerArgs>
-              <arg>-Xlint:all,-serial,-path</arg>
-            </compilerArgs>
+            <skipMain>true</skipMain> <!-- skip compile -->
+            <skip>true</skip> <!-- skip testCompile -->
           </configuration>
         </plugin>
         <plugin>
-- 
GitLab