Skip to content

Commit

Permalink
Jetty 12.0.x 9301 fix ee10 jstl jpms (#9321)
Browse files Browse the repository at this point in the history
* Issue #9301 Fix dependencies for ee10-glassfish-jstl module

* Fix jstl,el,jsp to work in jpms and osgi.
  • Loading branch information
janbartel authored Feb 8, 2023
1 parent 751b0a8 commit 342bd40
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 34 deletions.
4 changes: 0 additions & 4 deletions jetty-ee10/jetty-ee10-apache-jsp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http-tools</artifactId>
Expand Down
8 changes: 4 additions & 4 deletions jetty-ee10/jetty-ee10-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>org.mortbay.jasper,org.eclipse.jdt</includeGroupIds>
<includeArtifactIds>apache-el,apache-jsp,ecj</includeArtifactIds>
<includeGroupIds>jakarta.servlet.jsp,jakart.el,org.mortbay.jasper,org.eclipse.jdt</includeGroupIds>
<includeArtifactIds>jakart.servlet.jsp-api,jakarta.el-api,apache-el,apache-jsp,ecj</includeArtifactIds>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
<outputDirectory>${source-assembly-directory}/lib/ee10-apache-jsp</outputDirectory>
Expand All @@ -255,8 +255,8 @@
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>org.mortbay.jasper,org.eclipse.jdt</includeGroupIds>
<includeArtifactIds>apache-el,apache-jsp,ecj</includeArtifactIds>
<includeGroupIds>jakarta.servlet.jsp,jakarta.el,org.mortbay.jasper,org.eclipse.jdt</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp-api,jakarta.el-api,apache-el,apache-jsp,ecj</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/ee10-apache-jsp</outputDirectory>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public static void coreJettyDependencies(List<Option> res)
res.add(CoreOptions.streamBundle(loggingPropertiesBundle.build()).noStart());
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-slf4j-impl").versionAsInProject().start());
// END - slf4j 2.x

res.add(mavenBundle().groupId("jakarta.el").artifactId("jakarta.el-api").versionAsInProject().start());

res.add(mavenBundle().groupId("jakarta.servlet").artifactId("jakarta.servlet-api").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.platform").artifactId("org.eclipse.osgi.util").versionAsInProject());
Expand Down Expand Up @@ -195,11 +197,10 @@ public static void coreJettyDependencies(List<Option> res)
res.add(mavenBundle().groupId("org.apache.aries.spifly").artifactId("org.apache.aries.spifly.dynamic.bundle").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.inject").artifactId("jakarta.inject-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.annotation").artifactId("jakarta.annotation-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.enterprise").artifactId("jakarta.enterprise.cdi-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.enterprise").artifactId("jakarta.enterprise.lang-model").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.interceptor").artifactId("jakarta.interceptor-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.enterprise").artifactId("jakarta.enterprise.lang-model").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.enterprise").artifactId("jakarta.enterprise.cdi-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.transaction").artifactId("jakarta.transaction-api").versionAsInProject().start());
res.add(mavenBundle().groupId("jakarta.el").artifactId("jakarta.el-api").versionAsInProject().start());

res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-util").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-io").versionAsInProject().start());
Expand Down Expand Up @@ -237,26 +238,8 @@ public static void coreJettyDependencies(List<Option> res)
public static void coreJspDependencies(List<Option> res)
{
//jetty jsp bundles

/* The coreJettyDependencies() method needs to configure jakarta.el-api to satisfy the jakarta.transaction-api bundle.
* However, as we are now configuring the full jsp bundle set, we need to remove the jakarta.el-api
* bundle because the org.mortbay.jasper.apache-el bundle will be providing both the api and the impl.
*/
MavenArtifactProvisionOption option = mavenBundle().groupId("jakarta.el").artifactId("jakarta.el-api").versionAsInProject();

ListIterator<Option> iter = res.listIterator();
while (iter.hasNext())
{
Option o = iter.next();
if (o instanceof MavenArtifactProvisionOption)
{
if (((MavenArtifactProvisionOption)o).getURL().contains("jakarta.el-api"))
{
iter.remove();
}
}
}

res.add(systemProperty("jakarta.el.ExpressionFactory").value("org.apache.el.ExpressionFactoryImpl"));
res.add(mavenBundle().groupId("jakarta.servlet.jsp").artifactId("jakarta.servlet.jsp-api").versionAsInProject());
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("apache-el").versionAsInProject().start());
res.add(mavenBundle().groupId("org.mortbay.jasper").artifactId("apache-jsp").versionAsInProject().start());
res.add(mavenBundle().groupId("org.eclipse.jetty.ee10").artifactId("jetty-ee10-apache-jsp").versionAsInProject().start());
Expand Down
2 changes: 1 addition & 1 deletion jetty-ee10/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<jakarta.xml.jaxws.impl.version>4.0.0</jakarta.xml.jaxws.impl.version>
<jakarta.websocket.api.version>2.1.0</jakarta.websocket.api.version>

<jsp.impl.version>10.1.1</jsp.impl.version>
<jsp.impl.version>10.1.5</jsp.impl.version>
<mail.impl.version>2.0.1</mail.impl.version>

<sonar.skip>true</sonar.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ public void testSimpleWebAppWithJSPandJSTL(String env) throws Exception
}
}

@Disabled //TODO glassfish-jstl not working in jpms
@ParameterizedTest
@ValueSource(strings = {"ee10"})
public void testSimpleWebAppWithJSPOnModulePath(String env) throws Exception
Expand Down Expand Up @@ -237,7 +236,6 @@ public void testSimpleWebAppWithJSPOnModulePath(String env) throws Exception

response = client.GET("http://localhost:" + port + "/test/jstl.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
System.err.println(response.getContentAsString());
assertThat(response.getContentAsString(), containsString("JSTL Example"));
assertThat(response.getContentAsString(), not(containsString("<c:")));
}
Expand Down

0 comments on commit 342bd40

Please sign in to comment.