Skip to content

Commit

Permalink
Add a releaseProfile to generate dependency reduced pom
Browse files Browse the repository at this point in the history
#12338

This is a workaround for MSHADE-148, which leads to an infinite loop
when building Alluxio.

There are two scenarios.
- Releasing Alluxio
Maven build with `-Prelease`.
- If using newer than `3.3.x` version of maven, you also have to use
sequential build, Like `mvn clean install -Prelease xxxx`.
- If using lower version maven before `3.3.x`, you can use parallel
build, e.g. `mvn clean install -T 4 -Prelease xxxx`
- Not Releasing Alluxio
If you are not releasing Alluxio, you can build Alluxio like before,
please don't add the `-Prelease` into you build command line. e.g. `mvn
clean install -T 4 xxxx`

This patch adds a -Prelease. If present, it will set
createDependencyReducedPom true. The consequences are:

If you are releasing Alluxio with this profile, you are fine as long as
before.
If you are releasing Alluxio without this profile, the
`alluxio-shaded-xxx-yyy.pom` will be the same as the pom.xml under the
module directory.
If you are not releasing Alluxio but you are using this profile, you may
run into #12338
If you are not releasing Alluxio and you did not include this profile,
you are fine.
This is all documented in pom.xml and tested locally with maven 3.6.3.

pr-link: #12367
change-id: cid-2f26f91c9f3198d9dac11633888de0a9f8af2ce6
  • Loading branch information
maobaolong authored and alluxio-bot committed Oct 23, 2020
1 parent a5d5e08 commit 6490396
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<update.check.enabled>true</update.check.enabled>
<update.check.host>https://diagnostics.alluxio.io</update.check.host>
<findbugs.skip>false</findbugs.skip>
<create.dependency.reduced.pom>false</create.dependency.reduced.pom>
</properties>

<modules>
Expand Down Expand Up @@ -1487,5 +1488,19 @@
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<properties>
<!--
The maven shade plugin has a bug where enabling the `createDependencyReducedPom`
property causes maven to go into an infinite loop (MSHADE-148). This is only an
issue for the Alluxio build if the maven version is 3.3.x or newer.
However, since disabling this property has the side effect of not resolving
variables in the released pom files, we need to enable this during
releases.
-->
<create.dependency.reduced.pom>true</create.dependency.reduced.pom>
</properties>
</profile>
</profiles>
</project>
1 change: 1 addition & 0 deletions shaded/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
<configuration>
<createSourcesJar>true</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
<createDependencyReducedPom>${create.dependency.reduced.pom}</createDependencyReducedPom>
<artifactSet>
<excludes>
<!-- Leave slf4j unshaded so downstream users can configure logging -->
Expand Down
1 change: 1 addition & 0 deletions shaded/hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<configuration>
<!-- Since we don't shade all artifacts, we need to promote the transitive dependencies -->
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<createDependencyReducedPom>${create.dependency.reduced.pom}</createDependencyReducedPom>
<relocations>
<relocation>
<pattern>com.google</pattern>
Expand Down

0 comments on commit 6490396

Please sign in to comment.