This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch prepare-1.7.2
in repository https://gitbox.apache.org/repos/asf/sedona.git

commit 6ba5b8bcf014827ee3cfb8b5d1fa86b58926905e
Author: Kristin Cowalcijk <[email protected]>
AuthorDate: Fri May 30 23:54:22 2025 +0800

    [GH-1945] Shade Jiffle and its dependencies (#1964)
    
    * Shade jiffle and its dependencies
    
    * Fix lint warning
---
 common/pom.xml       | 85 ++++++++++++++++++++++++++++++++++++++++++++--------
 pom.xml              | 12 ++++++--
 spark-shaded/pom.xml |  5 ++++
 spark/common/pom.xml |  4 ---
 4 files changed, 87 insertions(+), 19 deletions(-)

diff --git a/common/pom.xml b/common/pom.xml
index f6a14d5241..56afb11045 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -105,19 +105,6 @@
             <groupId>it.geosolutions.jaiext.jiffle</groupId>
             <artifactId>jt-jiffle-language</artifactId>
         </dependency>
-        <!-- These test dependencies are for running map algebra tests -->
-        <dependency>
-            <groupId>org.antlr</groupId>
-            <artifactId>antlr4-runtime</artifactId>
-            <version>${antlr-runtime.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.janino</groupId>
-            <artifactId>janino</artifactId>
-            <version>${janino-version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>edu.ucar</groupId>
             <artifactId>cdm-core</artifactId>
@@ -134,6 +121,78 @@
                     <target>8</target>
                 </configuration>
             </plugin>
+            <plugin>
+                <!-- Skip running resolved-pom-maven-plugin since shade will
+                     generate dependency reduced pom which substitutes property
+                     values. resolved-pom-maven-plugin will break pom
+                     installation when working with maven-shade-plugin.  -->
+                <groupId>io.paradoxical</groupId>
+                <artifactId>resolved-pom-maven-plugin</artifactId>
+                <version>1.0</version>
+                <executions>
+                    <execution>
+                        <id>resolve-my-pom</id>
+                        <phase>none</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <!--
+                  We need to shade jiffle and its antlr and janino 
dependencies for the following reasons:
+
+                  1. Databricks runtime uses an older version of janino 
(3.0.16) that does not work
+                     with jiffle in Spark repl. See 
https://github.com/apache/sedona/discussions/1945
+
+                  2. Spark 4 uses an incompatible version of antlr at runtime.
+                -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <artifactSet>
+                                <includes>
+                                    
<include>it.geosolutions.jaiext.jiffle:*</include>
+                                    <include>org.antlr:*</include>
+                                    <include>org.codehaus.janino:*</include>
+                                </includes>
+                            </artifactSet>
+                            <relocations>
+                                <relocation>
+                                    
<pattern>it.geosolutions.jaiext.jiffle</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.jiffle</shadedPattern>
+                                    <excludes>
+                                        
<exclude>it.geosolutions.jaiext.jiffle.runtime.*</exclude>
+                                    </excludes>
+                                </relocation>
+                                <relocation>
+                                    <pattern>org.antlr.v4.runtime</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.antlr</shadedPattern>
+                                </relocation>
+                                <relocation>
+                                    <pattern>org.codehaus</pattern>
+                                    
<shadedPattern>org.apache.sedona.shaded.codehaus</shadedPattern>
+                                </relocation>
+                            </relocations>
+                            <filters>
+                                <!--  filter to address "Invalid signature 
file" issue - see http://stackoverflow.com/a/6743609/589215 -->
+                                <filter>
+                                    <artifact>*:*</artifact>
+                                    <excludes>
+                                        <exclude>META-INF/*.SF</exclude>
+                                        <exclude>META-INF/*.DSA</exclude>
+                                        <exclude>META-INF/*.RSA</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git a/pom.xml b/pom.xml
index 6bd14879f4..6d1761063f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -272,12 +272,15 @@
                 <groupId>it.geosolutions.jaiext.jiffle</groupId>
                 <artifactId>jt-jiffle-language</artifactId>
                 <version>${jt-jiffle.version}</version>
-                <scope>${geotools.scope}</scope>
                 <exclusions>
                     <exclusion>
-                        <groupId>*</groupId>
+                        <groupId>javax.media</groupId>
                         <artifactId>*</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>it.geosolutions.jaiext.utilities</groupId>
+                        <artifactId>jt-utilities</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
            <dependency>
@@ -341,6 +344,11 @@
                 <version>4.0.2</version>
                 <scope>provided</scope>
             </dependency>
+            <dependency>
+                <groupId>org.codehaus.janino</groupId>
+                <artifactId>janino</artifactId>
+                <version>${janino-version}</version>
+            </dependency>
             <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
diff --git a/spark-shaded/pom.xml b/spark-shaded/pom.xml
index cdd31ef0ae..c98a500811 100644
--- a/spark-shaded/pom.xml
+++ b/spark-shaded/pom.xml
@@ -47,6 +47,11 @@
                     <groupId>com.fasterxml.jackson.core</groupId>
                     <artifactId>*</artifactId>
                 </exclusion>
+                <!-- Even those these are shaded, the shaded POM isn't used 
when building projects in a single Maven run -->
+                <exclusion>
+                    <groupId>it.geosolutions.jaiext.jiffle</groupId>
+                    <artifactId>jt-jiffle-language</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
diff --git a/spark/common/pom.xml b/spark/common/pom.xml
index eb3cb27d9f..d3e473e6dc 100644
--- a/spark/common/pom.xml
+++ b/spark/common/pom.xml
@@ -162,10 +162,6 @@
             <groupId>org.geotools</groupId>
             <artifactId>gt-arcgrid</artifactId>
         </dependency>
-        <dependency>
-            <groupId>it.geosolutions.jaiext.jiffle</groupId>
-            <artifactId>jt-jiffle-language</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.locationtech.jts</groupId>
             <artifactId>jts-core</artifactId>

Reply via email to