Skip to content

Commit

Permalink
TAP5-2741: switch to Jakarta EE
Browse files Browse the repository at this point in the history
Things changed:
- Switch all Java EE to Jakarta EE APIs
- Update references in JavaDoc for Jakarta EE
- Switch to Spring 6 (Jakarta EE, Java 17)
- Switch to Jetty 11 and Tomcat 10.1 (for support of Jakarta EE)
  • Loading branch information
derkoe committed Nov 13, 2023
1 parent 2c61207 commit 492577b
Show file tree
Hide file tree
Showing 150 changed files with 631 additions and 548 deletions.
58 changes: 29 additions & 29 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ apply from: "md5.gradle"
apply from: "sha256.gradle"

project.ext.versions = [
jetty: "8.1.19.v20160209",
tomcat: "7.0.70",
jetty: "11.0.16",
tomcat: "10.1.13",
testng: "6.14.3",
easymock: "3.3.1",
servletapi: "3.0.1",
servletapi: "5.0.0",
spock: "2.1-M2-groovy-3.0",
hibernate: "5.4.32.Final",
slf4j: "1.7.25",
Expand Down Expand Up @@ -106,7 +106,7 @@ allprojects {

idea {
project {
languageLevel = "1.8"
languageLevel = "8"
}
}

Expand Down Expand Up @@ -137,7 +137,7 @@ String jdkVersion = System.properties['java.version']
def jdkMajorVersion = jdkVersion.substring(0, jdkVersion.indexOf(".")) // 1, 9, 10...

subprojects {

def specifyMaxPermSize = jdkVersion ==~ /1\.[67].+/

apply plugin: "maven-publish" // for deployment
Expand All @@ -153,13 +153,13 @@ subprojects {
apply plugin: "project-report"
apply plugin: "jacoco"
apply plugin: "base"

jacoco {
toolVersion = "0.8.7"
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"

sourceCompatibility = "8"
targetCompatibility = "8"

// See http://jira.codehaus.org/browse/GRADLE-784

Expand All @@ -180,11 +180,11 @@ subprojects {
eclipse.classpath.plusConfigurations += [configurations.provided]

dependencies {
// https://docs.gradle.org/7.3.3/userguide/upgrading_version_6.html#potential_breaking_changes,

// https://docs.gradle.org/7.3.3/userguide/upgrading_version_6.html#potential_breaking_changes,
// Table 1. Common configuration upgrades
testImplementation "org.spockframework:spock-core:${versions.spock}"

testRuntimeOnly "org.slf4j:slf4j-log4j12:${versions.slf4j}"
}

Expand All @@ -208,12 +208,12 @@ subprojects {
}else{
maxHeapSize "600M"
}

// Needed to have XMLTokenStreamTests.testStreamEncoding() passing on Java 9+
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_1_9)) {
jvmArgs("--add-opens=java.base/java.nio.charset=ALL-UNNAMED");
}

// Turn off live service reloading

systemProperties["tapestry.service-reloading-enabled"] = "false"
Expand All @@ -222,10 +222,10 @@ subprojects {
jvmArgs("-Dfile.encoding=UTF-8")

environment.LANG = 'en_US.UTF-8'

if (continuousIntegrationBuild) {
// Travis runs our builds with TERM=dumb and kills it if we don't produce any
// output for 10 minutes, so we log some task execution progress
// output for 10 minutes, so we log some task execution progress

testLogging {
exceptionFormat "full"
Expand All @@ -251,13 +251,13 @@ subprojects {
attributes("Automatic-Module-Name": "org.apache.tapestry." + projectDir.getName()
.replaceAll("tapestry5", "tapestry")
.replaceAll("tapestry-", "")
.replaceAll("-", ""))
.replaceAll("-", ""))
if (projectDir.getName().equals("tapestry-version-migrator")) {
attributes("Main-Class": "org.apache.tapestry5.versionmigrator.Main")
}
}
}

assemble.dependsOn(processResources, compileJava, jar)

task sourcesJar(type: Jar) {
Expand All @@ -283,19 +283,19 @@ subprojects {
published.extendsFrom signatures
}
}

publishing {
publications {
mavenJava(MavenPublication) {
version = parent.version
groupId = "org.apache.tapestry"
from components.java
artifact sourcesJar

pom {
name = project.name
// TODO: find some way to get the subproject description here.
// description =
// description =
url = "https://tapestry.apache.org/"
licenses {
license {
Expand Down Expand Up @@ -337,7 +337,7 @@ subprojects {
}
}
}

}
}
}
Expand Down Expand Up @@ -369,7 +369,7 @@ subprojects {
resolutionStrategy.force "antlr:antlr:2.7.7",
"cglib:cglib-nodep:2.2",
"commons-codec:commons-codec:1.10",
"commons-io:commons-io:2.4",
"commons-io:commons-io:2.13.0",
"commons-logging:commons-logging:1.1.3",
"hsqldb:hsqldb:2.2.8",
"org.antlr:antlr-runtime:3.5.2",
Expand Down Expand Up @@ -423,7 +423,7 @@ task aggregateJavadoc(type: Javadoc) {
exclude "org/apache/tapestry5/internal/plastic/asm/**"
exclude "org/apache/tapestry5/internal/webresources/**"
exclude "org/apache/tapestry5/webresources/modules/**"

source allMainJavaFiles

classpath += files(allMainSourceSets*.compileClasspath)
Expand Down Expand Up @@ -670,7 +670,7 @@ task updateBootstrap {
def bootstrapVersion = '3.3.7'
def target = new File(temporaryDir, 'bootstrap.zip')
ant.get(src: "https://github.com/twbs/bootstrap/archive/v${bootstrapVersion}.zip", dest: target)

def adjustDirectory = {
def relativePath = it.relativePath
if (relativePath.pathString.contains('/dist/')){
Expand All @@ -680,9 +680,9 @@ task updateBootstrap {
}
println "copying $it.relativePath to $relativePath"
it.relativePath = relativePath

}

copy {
from(zipTree(target)){
include('*/js/*.js')
Expand All @@ -698,13 +698,13 @@ task updateBootstrap {
}
into('tapestry-core/src/main/resources/META-INF/assets/tapestry5/bootstrap/')
}

copy {
from(zipTree(target)){
include('*/js/*.js')
include('*/dist/fonts/*')
include('*/less/**/*.less')

eachFile adjustDirectory
}
into('tapestry-webresources/src/test/webapp/bootstrap/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@ public static ClassNode convertBytecodeToClassNode(byte[] bytecode)

ClassVisitor adapter = new ClassVisitor(Opcodes.ASM9, result)
{
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value)
{
// we need to remove final from non-static fields because otherwise we get:
// IllegalAccessError: update to non-static final field
if ((access & Opcodes.ACC_STATIC) == 0)
{
access &= ~Opcodes.ACC_FINAL;
}
return super.visitField(access, name, descriptor, signature, value);
}

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)
{
Expand Down
8 changes: 4 additions & 4 deletions quickstart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ task processFiltered(type: Copy) {
filter(ReplaceTokens, tokens: [
quickstartVersion: project.parent.version,
tapestryVersion: project.parent.version,
springBootVersion: '2.5.4',
springBootVersion: '3.1.3',
junitVersion: '5.8.2',
jacksonVersion: '2.13.1',
jsonVersion: '1.1.4',
log4jVersion: '2.17.2',
yassonVersion: '2.0.4',
servletVersion: '3.1.0',
servletVersion: '5.0.0',
mavenCompilerVersion: '3.8.1',
mavenSurefireVersion: '3.0.0-M5',
mavenSurefireVersion: '3.1',
mavenWarVersion: '3.3.1',
mavenJettyVersion: '10.0.6',
mavenJettyVersion: '11.0.15',
grettyVersion: '3.0.6'
])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
runtimeOnly("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
runtimeOnly("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}")

runtimeOnly("javax.servlet:javax.servlet-api:${versions.servlet}")
runtimeOnly("jakarta.servlet:jakarta.servlet-api:${versions.servlet}")
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dependencies {
runtimeOnly("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
runtimeOnly("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}")

runtimeOnly("javax.servlet:javax.servlet-api:${versions.servlet}")
runtimeOnly("jakarta.servlet:jakarta.servlet-api:${versions.servlet}")
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@
<version>${D}{jackson-version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${D}{servlet-version}</version>
<scope>provided</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
<version>${D}{jackson-version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${D}{servlet-version}</version>
<scope>provided</scope>
</dependency>
Expand Down Expand Up @@ -165,7 +165,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-version}</version>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;

import javax.servlet.DispatcherType;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.SessionTrackingMode;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.SessionTrackingMode;
import java.util.EnumSet;

@Configuration
Expand Down
7 changes: 3 additions & 4 deletions tapestry-beanvalidator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ description = "Support for JSR-303 Bean Validation via the Hibernate validator i
dependencies {
implementation project(':tapestry-core')

implementation "javax.validation:validation-api:1.0.0.GA"
implementation "org.hibernate:hibernate-validator:4.3.2.Final"
implementation "jakarta.validation:jakarta.validation-api:3.0.2"
implementation "org.hibernate:hibernate-validator:8.0.1.Final"

testImplementation project(':tapestry-test')
implementation "org.seleniumhq.selenium:selenium-leg-rc:${versions.selenium}", {
exclude group: "org.seleniumhq.selenium", module: "jetty-repacked"
exclude group: "org.testng", module: "testng"
exclude group: "javax.servlet", module: "javax.servlet-api"
}
testImplementation "org.junit.jupiter:junit-jupiter:${versions.junitJupiter}"

}

task compileCoffeeScript(type: CompileCoffeeScript) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// limitations under the License.
package org.apache.tapestry5.beanvalidator;

import javax.validation.Configuration;
import jakarta.validation.Configuration;

/**
* Defines the interface for a chain-of-command that updates JSR-303 configuration in some way before the {@link
* javax.validation.ValidatorFactory} is created.
* jakarta.validation.ValidatorFactory} is created.
*
* @since 5.2.0.0
*/
Expand All @@ -27,4 +27,4 @@ public interface BeanValidatorConfigurer
* Passed the configuration so as to make changes.
*/
void configure(Configuration<?> configuration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// limitations under the License.
package org.apache.tapestry5.beanvalidator;

import javax.validation.Validator;
import javax.validation.ValidatorFactory;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;

import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;

/**
* Creates {@link javax.validation.ValidatorFactory}.
* Creates {@link jakarta.validation.ValidatorFactory}.
*
* @since 5.2.0.0
*/
Expand All @@ -36,4 +36,4 @@ public interface BeanValidatorSource
* Returns the ValidatorFactory from which Validators are created.
*/
ValidatorFactory getValidatorFactory();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface ClientConstraintDescriptor
Class getAnnotationClass();

/**
* Names of attributes from the {@link javax.validation.metadata.ConstraintDescriptor} that are relevant.
* Names of attributes from the {@link jakarta.validation.metadata.ConstraintDescriptor} that are relevant.
*/
Set<String> getAttributes();

Expand All @@ -42,7 +42,7 @@ public interface ClientConstraintDescriptor
* @param message
* error message to present to user when the constraint is violated
* @param attributes
* {@linkplain #getAttributes()} selected attributes} from the {@link javax.validation.metadata.ConstraintDescriptor}
* {@linkplain #getAttributes()} selected attributes} from the {@link jakarta.validation.metadata.ConstraintDescriptor}
*/
void applyClientValidation(MarkupWriter writer, String message, Map<String, Object> attributes);
}

0 comments on commit 492577b

Please sign in to comment.