Skip to content

Commit 9eae5fa

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`
1 parent d4d6d31 commit 9eae5fa

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
@@ -161,6 +161,8 @@
161161
<fasterxml.jackson.version>2.4.4</fasterxml.jackson.version>
162162
<snappy.version>1.1.1.7</snappy.version>
163163
<netlib.java.version>1.1.2</netlib.java.version>
164+
<!-- For maven shade plugin (see SPARK-8819) -->
165+
<create.dependency.reduced.pom>false</create.dependency.reduced.pom>
164166

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

@@ -1440,6 +1442,8 @@
14401442
<version>2.3</version>
14411443
<configuration>
14421444
<shadedArtifactAttached>false</shadedArtifactAttached>
1445+
<!-- Work around MSHADE-148. See SPARK-8819. -->
1446+
<createDependencyReducedPom>${create.dependency.reduced.pom}</createDependencyReducedPom>
14431447
<artifactSet>
14441448
<includes>
14451449
<!-- At a minimum we must include this to force effective pom generation -->
@@ -1826,6 +1830,26 @@
18261830
</properties>
18271831
</profile>
18281832

1833+
<profile>
1834+
<!--
1835+
Use this profile only for making Spark releases. Note that due to SPARK-8819,
1836+
you must use maven version 3.2.x or before to avoid running into MSHADE-148.
1837+
-->
1838+
<id>release-profile</id>
1839+
<properties>
1840+
<!--
1841+
The maven shade plugin has a bug where enabling the `createDependencyReducedPom`
1842+
property causes maven to go into an infinite loop (MSHADE-148). This is only an
1843+
issue for the Spark build if the maven version is 3.3.x or newer (SPARK-8819).
1844+
1845+
However, since disabling this property has the side effect of not resolving
1846+
variables in the released pom files (SPARK-8781), we need to enable this during
1847+
releases.
1848+
-->
1849+
<create.dependency.reduced.pom>true</create.dependency.reduced.pom>
1850+
</properties>
1851+
</profile>
1852+
18291853
<!--
18301854
These empty profiles are available in some sub-modules. Declare them here so that
18311855
maven does not complain when they're provided on the command line for a sub-module

0 commit comments

Comments
 (0)