Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.artifacts.ExternalDependency;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.artifacts.ResolutionStrategy;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.publish.PublishingExtension;
Expand Down Expand Up @@ -46,7 +47,6 @@ public void apply(Project project) {
if (baseline instanceof ProjectDependency) {
throw new GradleException("Baseline should not be a project dependency");
} else if (baseline instanceof ExternalDependency) {
((ExternalDependency) baseline).setForce(true);
((ExternalDependency) baseline).setTransitive(false);
} else {
throw new IllegalArgumentException("Unexpected dependency type: " + baseline);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.gradle.external.javadoc.CoreJavadocOptions;
import org.gradle.internal.jvm.JavaInfo;
import org.gradle.internal.jvm.Jvm;
import org.gradle.jvm.toolchain.JavaLanguageVersion;
import org.gradle.process.internal.ExecException;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -40,8 +41,7 @@ public void apply(Project project) {
project.getExtensions().getExtraProperties().set("testJava", testJava);

project.getExtensions().configure(JavaPluginExtension.class, java -> {
java.setSourceCompatibility(JavaVersion.VERSION_1_8);
java.setTargetCompatibility(JavaVersion.VERSION_1_8);
java.toolchain(spec -> spec.getLanguageVersion().convention(JavaLanguageVersion.of(8)));
});

project.getTasks().withType(Jar.class).configureEach(jar -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public void apply(Project project) {

project.getConfigurations().all(config -> {
config.getResolutionStrategy().dependencySubstitution(subs -> {
subs.substitute(subs.module("org.hamcrest:hamcrest-core:1.3")).with(subs.module("org.hamcrest:hamcrest-core:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-library:1.3")).with(subs.module("org.hamcrest:hamcrest-library:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-core:1.3")).using(subs.module("org.hamcrest:hamcrest-core:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("org.hamcrest:hamcrest-library:1.3")).using(subs.module("org.hamcrest:hamcrest-library:" + project.property("hamcrestVersion")));
subs.substitute(subs.module("junit:junit:4.12")).using(subs.module("junit:junit:4.13.1"));
});
});
Expand Down
2 changes: 1 addition & 1 deletion clustered/integration-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ configurations.all {
dependencySubstitution {
substitute(module('junit:junit:4.12'))
.because('CVE-2020-15250')
.with(module('junit:junit:4.13.1'))
.using(module('junit:junit:4.13.1'))
}
}
}
2 changes: 1 addition & 1 deletion clustered/osgi-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ test {
configurations {
lowerBoundOsgiModule {
resolutionStrategy.dependencySubstitution {
substitute module('org.glassfish.jaxb:jaxb-runtime') with module('com.sun.xml.bind:jaxb-osgi:2.2.8-b01')
substitute module('org.glassfish.jaxb:jaxb-runtime') using module('com.sun.xml.bind:jaxb-osgi:2.2.8-b01')
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions demos/00-NoCache/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id 'application'
}

application {
mainClass = 'org.ehcache.demos.peeper.PeeperServer'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Terracotta, Inc.
* Copyright IBM Corp. 2024, 2025
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehcache.demos.peeper;

import org.ehcache.demos.server.EmbeddedPeeperServer;

public class PeeperServer {

public static void main(String[] args) throws Exception {
EmbeddedPeeperServer.run(PeeperServletContextListener::new, PeeperServlet::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
package org.ehcache.demos.peeper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.ehcache.demos.peeper;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;

/**
* @author Ludovic Orban
Expand Down
7 changes: 7 additions & 0 deletions demos/01-CacheAside/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id 'application'
}

application {
mainClass = 'org.ehcache.demos.peeper.PeeperServer'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Terracotta, Inc.
* Copyright IBM Corp. 2024, 2025
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehcache.demos.peeper;

import org.ehcache.demos.server.EmbeddedPeeperServer;

public class PeeperServer {

public static void main(String[] args) throws Exception {
EmbeddedPeeperServer.run(PeeperServletContextListener::new, PeeperServlet::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
*/
package org.ehcache.demos.peeper;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package org.ehcache.demos.peeper;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;

/**
* @author Ludovic Orban
Expand Down
78 changes: 34 additions & 44 deletions demos/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,50 @@
plugins {
id 'org.ehcache.build.conventions.war' apply false
id 'org.gretty' apply false
id 'org.ehcache.build.conventions.java-library'
}

subprojects {
apply plugin: 'org.ehcache.build.conventions.war'
apply plugin: 'org.gretty'

gretty {
httpPort = 8080
contextPath = '/'
servletContainer = 'jetty9'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

dependencies {
implementation project(':ehcache-impl')
implementation 'javax.servlet:javax.servlet-api:3.1.0'
runtimeOnly 'ch.qos.logback:logback-classic:1.2.11'
runtimeOnly 'com.h2database:h2:1.4.196'
allprojects {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
dependencySubstitution {
substitute(module('org.slf4j:slf4j-api'))
.because('org.gretty:gretty-runner-jetty declares a very old version of slf4j')
.with(module('org.slf4j:slf4j-api:' + project.property('slf4jVersion')))
}
force "org.slf4j:slf4j-api:2.0.17"
}
}
}

/*
* This substitution is solely to permit the 'dependencies' task to complete normally --
* the Jetty 8 environment provided by gretty is not used in this module.
*/
configurations.named('grettyRunnerJetty8') {
resolutionStrategy {
dependencySubstitution {
substitute(module('org.eclipse.jetty.orbit:javax.servlet.jsp:2.1.0.v201105211820'))
.because('gretty plug-in pulls in older version for Jetty8')
.with(module('org.eclipse.jetty.orbit:javax.servlet.jsp:2.2.0.v201112011158'))
}
def jettyVersion = '12.1.5'

dependencies {
api platform("org.eclipse.jetty:jetty-bom:${jettyVersion}")
api 'jakarta.servlet:jakarta.servlet-api:6.0.0'
api 'org.eclipse.jetty:jetty-server'
api "org.eclipse.jetty.ee10:jetty-ee10-servlet:${jettyVersion}"
}

subprojects {
apply plugin: 'org.ehcache.build.conventions.war'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

/*
* This substitution is solely to permit the 'dependencies' task to complete normally --
* the Jetty 9.3 environment provided by gretty is not used in this module.
*/
configurations.named('grettyRunnerJetty93') {
resolutionStrategy {
dependencySubstitution {
substitute(module('org.eclipse.jetty.toolchain:jetty-schemas:3.1.M0'))
.because('gretty plug-in pulls in older version for Jetty9.3')
.with(module('org.eclipse.jetty.toolchain:jetty-schemas:3.1'))
}
}
dependencies {
implementation project(':demos')
implementation project(':ehcache-impl')
implementation 'jakarta.servlet:jakarta.servlet-api:6.0.0'
runtimeOnly "ch.qos.logback:logback-classic:1.5.26"
runtimeOnly 'com.h2database:h2:2.4.240'
}
}
9 changes: 9 additions & 0 deletions demos/config/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress files="^((?!.*test[\\/]java[\\/]org[\\/]ehcache[\\/]docs[\\/].*).)*$" checks="AvoidStaticImport"/>
</suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright Terracotta, Inc.
* Copyright IBM Corp. 2024, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to move this to 2026 now?

*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ehcache.demos.server;

import jakarta.servlet.ServletContextListener;
import jakarta.servlet.http.HttpServlet;
import java.util.Objects;
import java.util.function.Supplier;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;

public final class EmbeddedPeeperServer {

private EmbeddedPeeperServer() {
}

public static void run(Supplier<? extends ServletContextListener> listenerSupplier,
Supplier<? extends HttpServlet> servletSupplier) throws Exception {
Objects.requireNonNull(listenerSupplier, "listenerSupplier");
Objects.requireNonNull(servletSupplier, "servletSupplier");

Server server = new Server();

ServerConnector connector = new ServerConnector(server);
connector.setPort(8080);
connector.setHost(System.getenv().getOrDefault("HOST", "0.0.0.0"));
server.addConnector(connector);

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.addEventListener(listenerSupplier.get());
context.addServlet(new ServletHolder(servletSupplier.get()), "/*");

server.setHandler(context);

server.start();
server.join();
}
}
6 changes: 3 additions & 3 deletions ehcache-107/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ configurations {
dependencySubstitution {
substitute(module('junit:junit:4.11'))
.because('CVE-2020-15250')
.with(module('junit:junit:4.13.1'))
.using(module('junit:junit:4.13.1'))
}
}
}
Expand Down Expand Up @@ -99,14 +99,14 @@ task unpackTckTests(type: Sync) {
from {
configurations.tckTestClasses.collect {zipTree(it)}
}
into sourceSets.tckTest.java.outputDir
into sourceSets.tckTest.java.classesDirectory
}

task tckTest(type: Test, dependsOn: unpackTckTests) {
testClassesDirs = sourceSets.tckTest.output.classesDirs
classpath += sourceSets.tckTest.runtimeClasspath

binResultsDir file("$buildDir/tck-tests-results/binary/$name")
binaryResultsDirectory = file("$buildDir/tck-tests-results/binary/$name")
reports.junitXml.destination = file("$buildDir/tck-tests-results")
reports.html.destination = file("$buildDir/reports/tck-tests")

Expand Down
4 changes: 3 additions & 1 deletion ehcache-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ task slowTest(type: Test) {
testClassesDirs = sourceSets.slowTest.output.classesDirs
classpath += sourceSets.slowTest.runtimeClasspath

binResultsDir file("$buildDir/slow-tests-results/binary/$name")
binaryResultsDirectory = file("$buildDir/slow-tests-results/binary/$name")
reports.junitXml.destination = file("$buildDir/slow-tests-results")
reports.html.destination = file("$buildDir/reports/slow-tests")
}
Expand Down Expand Up @@ -72,6 +72,8 @@ jar {
}

compileUnsafe {
javaCompiler = javaToolchains.compilerFor(java.toolchain)

//no -Werror due to unsafe
options.compilerArgs = ['-Xlint:all']
}
Loading
Loading