Make jsp and jstl work for maven plugin,osgi and distro.

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2020-04-20 15:33:25 +02:00
parent 4869ad7e72
commit 69fb6009d8
18 changed files with 55 additions and 28 deletions

View File

@ -18,7 +18,7 @@
</Set>
<Call name="setContextAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/jetty-jakarta-servlet-api-[^/]*\.jar$|.*/jakarta.servlet.jsp.jstl-.*\.jar$|.*/org.apache.taglibs.taglibs-standard-impl-.*\.jar$</Arg>
<Arg>.*/jetty-jakarta-servlet-api-[^/]*\.jar$|.*/jakarta.servlet.jsp.jstl-.*\.jar$|.*/.*taglibs-standard-.*\.jar$</Arg>
</Call>
<!-- Add a customize step to the deployment lifecycle -->

View File

@ -428,7 +428,7 @@
</goals>
<configuration>
<excludeGroupIds>org.glassfish.web</excludeGroupIds>
<includeArtifactIds>taglibs-standard</includeArtifactIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,taglibs-standard</includeArtifactIds>
<prependGroupId>true</prependGroupId>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/apache-jstl</outputDirectory>
@ -442,7 +442,7 @@
</goals>
<configuration>
<excludeGroupIds>org.glassfish.web</excludeGroupIds>
<includeArtifactIds>taglibs-standard</includeArtifactIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,taglibs-standard</includeArtifactIds>
<prependGroupId>true</prependGroupId>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>

View File

@ -58,7 +58,7 @@ public class MavenWebAppContext extends WebAppContext
{
private static final Logger LOG = LoggerFactory.getLogger(MavenWebAppContext.class);
private static final String DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN = ".*/jakarta.servlet-[^/]*\\.jar$|.*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard.*\\.jar";
private static final String DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN = ".*/jakarta.servlet-[^/]*\\.jar$|.*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*jakarta.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard-[^/]*\\.jar$";
private static final String WEB_INF_CLASSES_PREFIX = "/WEB-INF/classes";

View File

@ -75,9 +75,9 @@
compilation time. -->
<_nouses>true</_nouses>
<Import-Package>
jakarta.servlet;version="[3.1,4.1)", jakarta.servlet.resources;version="[3.1,4.1)", org.osgi.framework, org.osgi.service.cm;version="1.2.0", org.osgi.service.packageadmin, org.osgi.service.startlevel;version="1.0.0", org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, *
jakarta.servlet;version="[5,6)", jakarta.servlet.resources;version="[5,6)", org.osgi.framework, org.osgi.service.cm;version="1.2.0", org.osgi.service.packageadmin, org.osgi.service.startlevel;version="1.0.0", org.osgi.service.url;version="1.0.0", org.osgi.util.tracker;version="1.3.0", org.slf4j;resolution:=optional, org.slf4j.spi;resolution:=optional, org.slf4j.helpers;resolution:=optional, org.xml.sax, org.xml.sax.helpers, *
</Import-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[9.1,11.0)"</DynamicImport-Package>
<DynamicImport-Package>org.eclipse.jetty.*;version="[11,12.0)"</DynamicImport-Package>
</instructions>
</configuration>
</plugin>

View File

@ -227,6 +227,31 @@
<artifactId>taglibs-standard</artifactId>
<version>10.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xalan</artifactId>
<version>2.7.2_3</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xalan-serializer</artifactId>
<version>2.7.2_1</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.bcel</artifactId>
<version>5.2_4</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xmlresolver</artifactId>
<version>1.2_5</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
<artifactId>org.apache.servicemix.bundles.xerces</artifactId>
<version>2.12.0_1</version>
</dependency>
<!-- Jetty Deps -->
<dependency>

View File

@ -19,8 +19,8 @@
package org.eclipse.jetty.osgi.test;
import java.util.ArrayList;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -24,8 +24,8 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http2.client.HTTP2Client;

View File

@ -24,8 +24,8 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http2.client.HTTP2Client;

View File

@ -20,8 +20,8 @@ package org.eclipse.jetty.osgi.test;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;

View File

@ -20,8 +20,8 @@ package org.eclipse.jetty.osgi.test;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
@ -84,8 +84,6 @@ public class TestJettyOSGiBootWithAnnotations
public static List<Option> annotationDependencies()
{
List<Option> res = new ArrayList<>();
res.add(mavenBundle().groupId("com.sun.activation").artifactId("javax.activation").version("1.2.0").noStart());
res.add(mavenBundle().groupId("jakarta.mail").artifactId("jakarta.mail-api").versionAsInProject().noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty.tests").artifactId("test-container-initializer").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.tests").artifactId("test-mock-resources").versionAsInProject());
//test webapp bundle

View File

@ -23,8 +23,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
@ -95,16 +95,17 @@ public class TestJettyOSGiBootWithBundle
return options;
}
@Test
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
}
@Ignore
@Test
public void testContextHandlerAsOSGiService() throws Exception
{
if (Boolean.getBoolean(TestOSGiUtil.BUNDLE_DEBUG))
assertAllBundlesActiveOrResolved();
// now test the context
HttpClient client = new HttpClient();
try

View File

@ -22,8 +22,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.websocket.ContainerProvider;
import jakarta.websocket.RemoteEndpoint;
import jakarta.websocket.Session;

View File

@ -81,7 +81,6 @@ public class TestJettyOSGiBootWithJsp
public void assertAllBundlesActiveOrResolved()
{
TestOSGiUtil.debugBundles(bundleContext);
TestOSGiUtil.assertAllBundlesActiveOrResolved(bundleContext);
}

View File

@ -22,8 +22,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import jakarta.inject.Inject;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.junit.Test;

View File

@ -222,8 +222,12 @@ public class TestOSGiUtil
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("apache-jsp").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("apache-jsp").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.servlet.jsp.jstl").artifactId("jakarta.servlet.jsp.jstl-api").versionAsInProject());
//TODO: skip the standard taglib: it wants to use xalan, which doesn't have an osgi manifest
//res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("taglibs-standard").versionAsInProject().start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xmlresolver").version("1.2_5").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xerces").version("2.12.0_1").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xalan-serializer").version("2.7.2_1").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.bcel").version("5.2_4").start());
res.add(mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.xalan").version("2.7.2_3").start());
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("taglibs-standard").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jdt").artifactId("ecj").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty.osgi").artifactId("jetty-osgi-boot-jsp").versionAsInProject().noStart());
return res;
@ -248,7 +252,7 @@ public class TestOSGiUtil
b.getHeaders().get("Bundle-Version") +
" and " +
prevBundle.getHeaders().get("Bundle-Version") : "";
assertNull(err, prevBundle);
assertNull(err, prevBundle);
}
return bundles.get(symbolicName);
}
@ -283,11 +287,12 @@ public class TestOSGiUtil
{
diagnoseNonActiveOrNonResolvedBundle(b);
}
dumpBundleState(b);
break;
}
default:
{
dumpBundleState(b);
break;
}
}
}
@ -295,7 +300,7 @@ public class TestOSGiUtil
protected static void dumpBundleState(Bundle b)
{
System.err.println("Bundle: [" + b.getBundleId() +"] " + b + " State=" + b.getState());
System.err.println("Bundle: [" + b.getBundleId() + "] " + b + " State=" + b.getState());
}
protected static boolean diagnoseNonActiveOrNonResolvedBundle(Bundle b)

View File

@ -65,7 +65,7 @@
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Import-Package>jakarta.servlet.jsp.*;version="[2.2.0,4.1)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<Import-Package>jakarta.servlet.jsp.*;version="[5,6)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<Export-Package>!com.acme*</Export-Package>
<!-- the test webapp is configured via a jetty xml file
in order to add the security handler. -->

View File

@ -30,7 +30,7 @@
com.acme;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"
</Export-Package>
<Import-Package>
javax.sql, jakarta.transaction;version="2.0.0", jakarta.mail;version="2.0"
javax.sql, jakarta.transaction;version="2.0.0"
</Import-Package>
<_nouses>true</_nouses>
</instructions>

View File

@ -73,9 +73,8 @@
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.tests.test-spec-webapp</Bundle-SymbolicName>
<Bundle-Description>Test Webapp for Servlet 3.1 Features</Bundle-Description>
<!-- TODO Add 'org.eclipse.jetty.util;version="[9.4.19,9.4.20)",' below, once 9.4.19 is released with a fix for #3726 -->
<Import-Package>
jakarta.transaction*;version="2.0.0", jakarta.servlet*;version="[2.6,4.1)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", com.acme;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", *
jakarta.transaction*;version="2.0.0", jakarta.servlet*;version="[5,6)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", com.acme;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", *
</Import-Package>
<_nouses />
<Export-Package>com.acme.test;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}";-noimport:=true</Export-Package>