Skip to content

Commit 947b845

Browse files
author
Andrew Or
committed
[SPARK-8819] Fix build for maven 3.3.x
This is a workaround for MSHADE-148, which leads to an infinite loop when building Spark with maven 3.3.x. This was originally caused by #6441, which added a bunch of test dependencies on the spark-core test module. Recently, it was revealed by #7193. This patch adds a `-Prelease` profile. If present, it will set `createDependencyReducedPom` to true. The consequences are: - If you are releasing Spark with this profile, you are fine as long as you use maven 3.2.x or before. - If you are releasing Spark without this profile, you will run into SPARK-8781. - If you are not releasing Spark but you are using this profile, you may run into SPARK-8819. - If you are not releasing Spark and you did not include this profile, you are fine. This is all documented in `pom.xml` and tested locally with both versions of maven. Author: Andrew Or <[email protected]> Closes #7219 from andrewor14/fix-maven-build and squashes the following commits: 1d37e87 [Andrew Or] Merge branch 'master' of github.com:apache/spark into fix-maven-build 3574ae4 [Andrew Or] Review comments f39199c [Andrew Or] Create a -Prelease profile that flags `createDependencyReducedPom` (cherry picked from commit 9eae5fa) Signed-off-by: Andrew Or <[email protected]>
1 parent 4d81383 commit 947b845

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

dev/create-release/create-release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ if [[ ! "$@" =~ --skip-publish ]]; then
118118

119119
rm -rf $SPARK_REPO
120120

121-
build/mvn -DskipTests -Pyarn -Phive \
121+
build/mvn -DskipTests -Pyarn -Phive -Prelease-profile\
122122
-Phive-thriftserver -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \
123123
clean install
124124

125125
./dev/change-version-to-2.11.sh
126126

127-
build/mvn -DskipTests -Pyarn -Phive \
127+
build/mvn -DskipTests -Pyarn -Phive -Prelease-profile\
128128
-Dscala-2.11 -Phadoop-2.2 -Pspark-ganglia-lgpl -Pkinesis-asl \
129129
clean install
130130

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@
162162
<fasterxml.jackson.version>2.4.4</fasterxml.jackson.version>
163163
<snappy.version>1.1.1.7</snappy.version>
164164
<netlib.java.version>1.1.2</netlib.java.version>
165+
<!-- For maven shade plugin (see SPARK-8819) -->
166+
<create.dependency.reduced.pom>false</create.dependency.reduced.pom>
165167

166168
<test.java.home>${java.home}</test.java.home>
167169

@@ -1428,6 +1430,8 @@
14281430
<version>2.3</version>
14291431
<configuration>
14301432
<shadedArtifactAttached>false</shadedArtifactAttached>
1433+
<!-- Work around MSHADE-148. See SPARK-8819. -->
1434+
<createDependencyReducedPom>${create.dependency.reduced.pom}</createDependencyReducedPom>
14311435
<artifactSet>
14321436
<includes>
14331437
<!-- At a minimum we must include this to force effective pom generation -->
@@ -1812,6 +1816,26 @@
18121816
</properties>
18131817
</profile>
18141818

1819+
<profile>
1820+
<!--
1821+
Use this profile only for making Spark releases. Note that due to SPARK-8819,
1822+
you must use maven version 3.2.x or before to avoid running into MSHADE-148.
1823+
-->
1824+
<id>release-profile</id>
1825+
<properties>
1826+
<!--
1827+
The maven shade plugin has a bug where enabling the `createDependencyReducedPom`
1828+
property causes maven to go into an infinite loop (MSHADE-148). This is only an
1829+
issue for the Spark build if the maven version is 3.3.x or newer (SPARK-8819).
1830+
1831+
However, since disabling this property has the side effect of not resolving
1832+
variables in the released pom files (SPARK-8781), we need to enable this during
1833+
releases.
1834+
-->
1835+
<create.dependency.reduced.pom>true</create.dependency.reduced.pom>
1836+
</properties>
1837+
</profile>
1838+
18151839
<!--
18161840
These empty profiles are available in some sub-modules. Declare them here so that
18171841
maven does not complain when they're provided on the command line for a sub-module

0 commit comments

Comments
 (0)