You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2020/02/26 11:15:16 UTC

[sling-jspc-maven-plugin] branch master updated: SLING-9154 - Update to the latest JSP compiler

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

radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-jspc-maven-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 5f9c7e3  SLING-9154 - Update to the latest JSP compiler
5f9c7e3 is described below

commit 5f9c7e30630921efa7fa4ed3e19b2605ffbdbdfa
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Wed Feb 26 12:14:55 2020 +0100

    SLING-9154 - Update to the latest JSP compiler
---
 pom.xml                                            | 20 +++++---------------
 .../sling/maven/jspc/JspCTldLocationsCache.java    | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/pom.xml b/pom.xml
index 33281f8..ec7d14a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
     <parent>
         <groupId>org.apache.sling</groupId>
         <artifactId>sling</artifactId>
-        <version>30</version>
+        <version>38</version>
         <relativePath />
     </parent>
 
@@ -32,7 +32,7 @@
     <version>2.1.1-SNAPSHOT</version>
     <packaging>maven-plugin</packaging>
 
-    <name>Apache Sling Maven JSP Compiler Plugin</name>
+    <name>Apache Sling JSPC Maven Plugin</name>
     <description>Maven Plugin for compiling JSP sources into bundles</description>
     <url>https://sling.apache.org/components/jspc-maven-plugin/</url>
 
@@ -107,19 +107,14 @@
 
         <dependency>
             <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.api</artifactId>
-            <version>2.2.2</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.jsp</artifactId>
-            <version>2.3.0</version>
+            <version>2.4.3-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.compiler</artifactId>
-            <version>2.3.0</version>
+            <version>2.3.7-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
@@ -164,11 +159,6 @@
             <artifactId>maven-archiver</artifactId>
             <version>3.1.1</version>
         </dependency>
-        
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -186,6 +176,6 @@
             <artifactId>maven-plugin-annotations</artifactId>
             <version>3.5</version>
             <scope>provided</scope>
-        </dependency>        
+        </dependency>
     </dependencies>
 </project>
diff --git a/src/main/java/org/apache/sling/maven/jspc/JspCTldLocationsCache.java b/src/main/java/org/apache/sling/maven/jspc/JspCTldLocationsCache.java
index 5bb5e87..b7d2654 100644
--- a/src/main/java/org/apache/sling/maven/jspc/JspCTldLocationsCache.java
+++ b/src/main/java/org/apache/sling/maven/jspc/JspCTldLocationsCache.java
@@ -93,6 +93,7 @@ public class JspCTldLocationsCache extends TldLocationsCache {
     private static final String WEB_XML = "/WEB-INF/web.xml";
     private static final String FILE_PROTOCOL = "file:";
     private static final String JAR_FILE_SUFFIX = ".jar";
+    private static final String TLD_SCHEME = "tld:";
 
     // Names of JARs that are known not to contain any TLDs
     private static HashSet<String> noTldJars;
@@ -223,6 +224,27 @@ public class JspCTldLocationsCache extends TldLocationsCache {
         return mappings.get(uri);
     }
 
+    @Override
+    public URL getTldLocationURL(String tldLocation) {
+        if (tldLocation.startsWith(TLD_SCHEME)) {
+            tldLocation = tldLocation.substring(TLD_SCHEME.length());
+            String[] locationInfo = mappings.get(tldLocation);
+            if (locationInfo != null) {
+                try {
+                    if (locationInfo.length == 2) {
+                        return new URL("jar:" + locationInfo[0] + "!/" + locationInfo[1]);
+                    } else if (locationInfo.length == 1) {
+                        return new URL(locationInfo[0]);
+                    }
+                } catch (MalformedURLException e) {
+                    log.warn("Cannot retrieve TLD location url for " + tldLocation + ".");
+                    log.debug("Details:", e);
+                }
+            }
+        }
+        return null;
+    }
+
     /**
      * Returns the type of a URI:
      *     ABS_URI