Skip to content

Commit 6ba5b8b

Browse files
Kontinuationjiayuasu
authored andcommitted
[GH-1945] Shade Jiffle and its dependencies (#1964)
* Shade jiffle and its dependencies * Fix lint warning
1 parent 3f16ee4 commit 6ba5b8b

4 files changed

Lines changed: 87 additions & 19 deletions

File tree

common/pom.xml

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,6 @@
105105
<groupId>it.geosolutions.jaiext.jiffle</groupId>
106106
<artifactId>jt-jiffle-language</artifactId>
107107
</dependency>
108-
<!-- These test dependencies are for running map algebra tests -->
109-
<dependency>
110-
<groupId>org.antlr</groupId>
111-
<artifactId>antlr4-runtime</artifactId>
112-
<version>${antlr-runtime.version}</version>
113-
<scope>test</scope>
114-
</dependency>
115-
<dependency>
116-
<groupId>org.codehaus.janino</groupId>
117-
<artifactId>janino</artifactId>
118-
<version>${janino-version}</version>
119-
<scope>test</scope>
120-
</dependency>
121108
<dependency>
122109
<groupId>edu.ucar</groupId>
123110
<artifactId>cdm-core</artifactId>
@@ -134,6 +121,78 @@
134121
<target>8</target>
135122
</configuration>
136123
</plugin>
124+
<plugin>
125+
<!-- Skip running resolved-pom-maven-plugin since shade will
126+
generate dependency reduced pom which substitutes property
127+
values. resolved-pom-maven-plugin will break pom
128+
installation when working with maven-shade-plugin. -->
129+
<groupId>io.paradoxical</groupId>
130+
<artifactId>resolved-pom-maven-plugin</artifactId>
131+
<version>1.0</version>
132+
<executions>
133+
<execution>
134+
<id>resolve-my-pom</id>
135+
<phase>none</phase>
136+
</execution>
137+
</executions>
138+
</plugin>
139+
<plugin>
140+
<!--
141+
We need to shade jiffle and its antlr and janino dependencies for the following reasons:
142+
143+
1. Databricks runtime uses an older version of janino (3.0.16) that does not work
144+
with jiffle in Spark repl. See https://github.com/apache/sedona/discussions/1945
145+
146+
2. Spark 4 uses an incompatible version of antlr at runtime.
147+
-->
148+
<groupId>org.apache.maven.plugins</groupId>
149+
<artifactId>maven-shade-plugin</artifactId>
150+
<executions>
151+
<execution>
152+
<phase>package</phase>
153+
<goals>
154+
<goal>shade</goal>
155+
</goals>
156+
<configuration>
157+
<artifactSet>
158+
<includes>
159+
<include>it.geosolutions.jaiext.jiffle:*</include>
160+
<include>org.antlr:*</include>
161+
<include>org.codehaus.janino:*</include>
162+
</includes>
163+
</artifactSet>
164+
<relocations>
165+
<relocation>
166+
<pattern>it.geosolutions.jaiext.jiffle</pattern>
167+
<shadedPattern>org.apache.sedona.shaded.jiffle</shadedPattern>
168+
<excludes>
169+
<exclude>it.geosolutions.jaiext.jiffle.runtime.*</exclude>
170+
</excludes>
171+
</relocation>
172+
<relocation>
173+
<pattern>org.antlr.v4.runtime</pattern>
174+
<shadedPattern>org.apache.sedona.shaded.antlr</shadedPattern>
175+
</relocation>
176+
<relocation>
177+
<pattern>org.codehaus</pattern>
178+
<shadedPattern>org.apache.sedona.shaded.codehaus</shadedPattern>
179+
</relocation>
180+
</relocations>
181+
<filters>
182+
<!-- filter to address "Invalid signature file" issue - see http://stackoverflow.com/a/6743609/589215 -->
183+
<filter>
184+
<artifact>*:*</artifact>
185+
<excludes>
186+
<exclude>META-INF/*.SF</exclude>
187+
<exclude>META-INF/*.DSA</exclude>
188+
<exclude>META-INF/*.RSA</exclude>
189+
</excludes>
190+
</filter>
191+
</filters>
192+
</configuration>
193+
</execution>
194+
</executions>
195+
</plugin>
137196
</plugins>
138197
</build>
139198
</project>

pom.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,15 @@
272272
<groupId>it.geosolutions.jaiext.jiffle</groupId>
273273
<artifactId>jt-jiffle-language</artifactId>
274274
<version>${jt-jiffle.version}</version>
275-
<scope>${geotools.scope}</scope>
276275
<exclusions>
277276
<exclusion>
278-
<groupId>*</groupId>
277+
<groupId>javax.media</groupId>
279278
<artifactId>*</artifactId>
280279
</exclusion>
280+
<exclusion>
281+
<groupId>it.geosolutions.jaiext.utilities</groupId>
282+
<artifactId>jt-utilities</artifactId>
283+
</exclusion>
281284
</exclusions>
282285
</dependency>
283286
<dependency>
@@ -341,6 +344,11 @@
341344
<version>4.0.2</version>
342345
<scope>provided</scope>
343346
</dependency>
347+
<dependency>
348+
<groupId>org.codehaus.janino</groupId>
349+
<artifactId>janino</artifactId>
350+
<version>${janino-version}</version>
351+
</dependency>
344352
<dependency>
345353
<groupId>junit</groupId>
346354
<artifactId>junit</artifactId>

spark-shaded/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
<groupId>com.fasterxml.jackson.core</groupId>
4848
<artifactId>*</artifactId>
4949
</exclusion>
50+
<!-- Even those these are shaded, the shaded POM isn't used when building projects in a single Maven run -->
51+
<exclusion>
52+
<groupId>it.geosolutions.jaiext.jiffle</groupId>
53+
<artifactId>jt-jiffle-language</artifactId>
54+
</exclusion>
5055
</exclusions>
5156
</dependency>
5257
<dependency>

spark/common/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@
162162
<groupId>org.geotools</groupId>
163163
<artifactId>gt-arcgrid</artifactId>
164164
</dependency>
165-
<dependency>
166-
<groupId>it.geosolutions.jaiext.jiffle</groupId>
167-
<artifactId>jt-jiffle-language</artifactId>
168-
</dependency>
169165
<dependency>
170166
<groupId>org.locationtech.jts</groupId>
171167
<artifactId>jts-core</artifactId>

0 commit comments

Comments
 (0)