Skip to content

Commit 342e2dc

Browse files
lukasz-antoniakabsurdfarce
authored andcommitted
Conditionally compile shaded Guava module
1 parent 01671d9 commit 342e2dc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

guava-shaded/pom.xml

+32
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,32 @@
5656
</dependencies>
5757
<build>
5858
<plugins>
59+
<plugin>
60+
<!--
61+
Do not attempt to recompile the module if we are not running JVM 1.8.
62+
Having additional Java source files and having to shade Guava will break
63+
in CI environment, when we run 'mvn verify' on newer JVM and assume that
64+
all classes have been compiled with JVM 1.8.
65+
-->
66+
<groupId>org.codehaus.mojo</groupId>
67+
<artifactId>build-helper-maven-plugin</artifactId>
68+
<version>1.12</version>
69+
<executions>
70+
<execution>
71+
<id>regex-property</id>
72+
<goals>
73+
<goal>regex-property</goal>
74+
</goals>
75+
<configuration>
76+
<name>maven.main.skip</name>
77+
<value>${java.version}</value>
78+
<regex>^(?!1.8).+</regex>
79+
<replacement>true</replacement>
80+
<failIfNoMatch>false</failIfNoMatch>
81+
</configuration>
82+
</execution>
83+
</executions>
84+
</plugin>
5985
<plugin>
6086
<artifactId>maven-shade-plugin</artifactId>
6187
<executions>
@@ -95,6 +121,12 @@
95121
</executions>
96122
</plugin>
97123
<plugin>
124+
<!--
125+
Cleaning up target directory is required, because module's Java source files
126+
(e.g. LexicographicalComparatorHolderSubstitution) will be left with
127+
their original Java package AND eventually shaded one. This plugin removes
128+
the Java class from its unshaded package.
129+
-->
98130
<artifactId>maven-clean-plugin</artifactId>
99131
<executions>
100132
<execution>

0 commit comments

Comments
 (0)