Skip to content

Commit

Permalink
We need to include slf4j librairies for remote managed container as i…
Browse files Browse the repository at this point in the history
…t is not avaible as embeded container

Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy authored and markt-asf committed Mar 27, 2024
1 parent de55c2b commit ebcf24c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Building
--------
Prerequisites:

* JDK 11+
* Maven 3.5.4+
* JDK 17+
* Maven 3.9.0+

Run the build:

Expand All @@ -22,7 +22,4 @@ Run the build:
The build runs copyright check and generates the jar, sources-jar and javadoc-jar by default.
The API jar is built in /api/target.

Checking findbugs
-----------------
`mvn -DskipTests -Dfindbugs.threshold=Low findbugs:findbugs`

8 changes: 6 additions & 2 deletions tck/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Jakarta Servlet

This repository contains the code for Jakarta Servle TCK
This repository contains the code for Jakarta Servlet TCK

About Jakarta Servlet TCK
-------------------------
Expand All @@ -10,7 +10,7 @@ Building
--------
Prerequisites:

* JDK 11+
* JDK 17+
* Maven 3.9.0+

Run the build:
Expand Down Expand Up @@ -41,6 +41,10 @@ This will be achieved by adding a dependency within your surefire configuration
<servlet.tck.support.crossContext>false</servlet.tck.support.crossContext>
<!-- if the servlet container doesn't support optional http2 push -->
<servlet.tck.support.http2Push>false</servlet.tck.support.http2Push>
<!--
the slf4j impl to include within the deployed wars, default value is org.slf4j:slf4j-simple
-->
<servlet.tck.slf4jimpl>org.slf4j:slf4j-simple</servlet.tck.slf4jimpl>
</systemProperties>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package servlet.tck.common.servlets;

import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import servlet.tck.api.common.sharedfiles.HSessionAttributeListener;
import servlet.tck.api.common.sharedfiles.HSessionListener;
import servlet.tck.common.response.HttpResponseTestServlet;
Expand All @@ -11,8 +12,11 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class CommonServlets {

Expand All @@ -21,17 +25,17 @@ public class CommonServlets {
private final JavaArchive[] javaArchives;

private CommonServlets() {
List<JavaArchive> archives = new ArrayList<>();
//
// File[] files = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
// .resolve("org.slf4j:slf4j-simple")
// .withTransitivity()
// .asFile();
// List<JavaArchive> slf4jJars =
// Arrays.stream(files).map(file -> ShrinkWrap.createFromZipFile(JavaArchive.class, file))
// .collect(Collectors.toList());
//
// //archives.addAll(slf4jJars);

String slf4jImplCanonicalForm = System.getProperty("servlet.tck.slf4jimpl", "org.slf4j:slf4j-simple");
File[] files = Maven.configureResolver().workOffline().loadPomFromFile("pom.xml")
.resolve(slf4jImplCanonicalForm)
.withTransitivity()
.asFile();
List<JavaArchive> slf4jJars =
Arrays.stream(files).map(file -> ShrinkWrap.createFromZipFile(JavaArchive.class, file))
.collect(Collectors.toList());

List<JavaArchive> archives = new ArrayList<>(slf4jJars);

archives.add(ShrinkWrap.create(JavaArchive.class, "common-servlets.jar")
.addClasses(GenericCheckTestResultServlet.class, GenericTCKServlet.class, RequestTestServlet.class,
Expand Down

0 comments on commit ebcf24c

Please sign in to comment.