From dcb3949ba4490dd126bec642be238ba17e87b412 Mon Sep 17 00:00:00 2001 From: Dave Maffitt Date: Thu, 6 Aug 2026 16:22:22 -0500 Subject: [PATCH] Migrate batch-launch plugin to XNAT 1.11.0 (jakarta / Tomcat 10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applies the jakarta / Tomcat 10 / Turbine 7 / Restlet 2.6 / Spring 6 migration on top of the GitHub monorepo/CI structure (branched off origin/develop = 9493aba, still javax at vXnat 1.10.1-SNAPSHOT, artifact "batch-launch"), rather than the old Bitbucket gh/main (0.9.0) lineage. The monorepo commit didn't touch src, so the migrated source applied cleanly. Source (4 files): Turbine 7 RunData -> PipelineData in the action/screens; org.apache.commons.lang.StringUtils -> org.apache.commons.lang3. build.gradle (kept gh/develop's monorepo shape — xnatPluginJar, CI publishing, gitManifestAttrs): vXnat -> 1.11.0-SNAPSHOT; scoped mavenLocal; Java toolchain(21) + compile fork=true (Lombok 1.18.34 on JDK 21); `configurations.all { exclude }` -> `configureEach` (Gradle 9 forbids post-resolution exclude mutation); XNAT- provided deps -> compileOnly; turbine:turbine -> org.apache.turbine:turbine and velocity -> velocity-engine-core; springfox (dead on Spring 6) -> io.swagger:swagger-annotations; javax.servlet -> jakarta.servlet; commons-lang 2.6 -> commons-lang3; container-service 3.2.0:fat -> 3.9.0-SNAPSHOT:fat. Verified: clean xnatPluginJar builds batch-launch-0.9.0-SNAPSHOT-xpl.jar. Co-Authored-By: Claude Opus 4.8 --- build.gradle | 89 +++++++++++-------- .../modules/actions/BulkLaunchAction.java | 4 +- .../modules/screens/UserDashboard.java | 4 +- .../screens/XDATScreen_bulk_action.java | 4 +- .../repository/WorkflowRepository.java | 2 +- 5 files changed, 59 insertions(+), 44 deletions(-) diff --git a/build.gradle b/build.gradle index 563c96b..ed6332c 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { ext { - vXnat = "1.10.1-SNAPSHOT" + vXnat = "1.11.0-SNAPSHOT" // jakarta / Tomcat 10 line } } @@ -31,57 +31,62 @@ version "0.9.0-SNAPSHOT" description "XNAT Batch Launch Plugin" repositories { - mavenLocal() + // Scope mavenLocal to org.nrg.* so a locally-published SNAPSHOT of core is consumed without shadowing + // partial third-party artifacts (e.g. ehcache-*-jakarta classifiers). See migration guide. + mavenLocal { content { includeGroupByRegex 'org\\.nrg.*' } } maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-release" } maven { url "https://nrgxnat.jfrog.io/nrgxnat/libs-snapshot" } mavenCentral() } configurations { - all { + // Gradle 9 forbids mutating a configuration's excludes after it has been resolved (the old + // `all { exclude }` form triggers this). Apply excludes lazily per-configuration instead. + configureEach { exclude group: "javax.sql" exclude group: "javax.transaction" exclude group: "javax.jms" } + implementAndInclude implementation.extendsFrom(implementAndInclude) } +dependencyManagement.imports { + mavenBom "org.nrg:parent:${vXnat}" +} + dependencies { - implementation platform("org.nrg:parent:${vXnat}") - - // Even though container-service plugin version is specified in the parent - // BOM, it needs to be added here because the copyPlugins task in docker-compose - // won't resolve it properly against the BOM. - implementation "org.nrg.xnatx.plugins:container-service:3.2.0:fat" - - implementation "org.nrg.xnat:web" - implementation "io.springfox:springfox-swagger2" - - implementation("turbine:turbine") { - exclude group: "commons-dbcp" - exclude group: "commons-email" - exclude group: "commons-pool" - exclude group: "fulcrum" - exclude group: "javax.activation", module: "activation" - exclude group: "javax.mail" - exclude group: "javax.servlet" - exclude group: "jython" - exclude group: "xalan" - exclude group: "xml-apis" - exclude group: "log4j", module: "log4j" - exclude group: "berkeleydb" - exclude group: "javax.sql" - exclude group: "jndi" - exclude group: "mysql" - exclude group: "tomcat" - exclude group: "xerces" - exclude group: "velocity", module: "texen" - exclude group: "jamon", module: "jamon" - } - compileOnly("org.apache.velocity:velocity") { transitive = false } - compileOnly "javax.servlet:javax.servlet-api" - compileOnly "commons-lang:commons-lang:2.6" + // XNAT host API + Turbine 7 / Velocity 2 (provided by XNAT at runtime). + compileOnly "org.nrg.xnat:web" + compileOnly "org.nrg.xdat:core" + compileOnly "org.nrg:framework" + // 1.11.0 coordinate renames: turbine:turbine -> org.apache.turbine:turbine (7.0), + // org.apache.velocity:velocity -> org.apache.velocity:velocity-engine-core (2.4.1) + compileOnly "org.apache.turbine:turbine" + compileOnly "org.apache.velocity:velocity-engine-core" + + // org.nrg.action.ClientException exposes org.restlet.data.Status in its API (Status.CLIENT_ERROR_*), + // so restlet must be on the compile classpath. 2.6 keeps the standard HTTP statuses used here. compileOnly "org.restlet:org.restlet" + + // springfox is dead on Spring 6; the xapi controller only uses io.swagger.annotations.* -> provide those directly. + compileOnly "io.swagger:swagger-annotations:1.5.20" + + // batch-launch drives container-service (WorkflowService/Workflow reference its API). Provided at runtime. + compileOnly "org.nrg.xnatx.plugins:container-service:3.9.0-SNAPSHOT:fat" + + compileOnly "org.springframework:spring-web" + compileOnly "org.springframework:spring-webmvc" + compileOnly "org.springframework:spring-context" + compileOnly "org.springframework:spring-beans" + + compileOnly "jakarta.servlet:jakarta.servlet-api" + compileOnly "com.google.code.findbugs:jsr305" // javax.annotation.Nonnull/Nullable (JSR-305, stays javax) + compileOnly "org.apache.commons:commons-lang3" + compileOnly "com.google.guava:guava" + compileOnly "com.fasterxml.jackson.core:jackson-annotations" + compileOnly "com.fasterxml.jackson.core:jackson-databind" + compileOnly "org.slf4j:slf4j-api" } // Pulls in the Jenkins BUILD_NUMBER environment variable if available. @@ -139,8 +144,9 @@ Building artifacts with manifest attributes: """ java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + // toolchain (not sourceCompatibility) so compile runs on JDK 21 regardless of the daemon JDK — + // matches container-service/mfa and keeps Lombok 1.18.34's javac hooks working. See migration guide. + toolchain { languageVersion = JavaLanguageVersion.of(21) } manifest { attributes gitManifestAttrs @@ -150,6 +156,11 @@ java { withJavadocJar() } +compileJava { + dependsOn xnatDataBuilder + options.fork = true // a cross-JDK toolchain (21) must fork; also lets Lombok 1.18.34 run on JDK 21 +} + lombok { version = "1.18.34" sha256 = "1ea5ad6c6afcff902d75072b2aaa6695585aebee9f12127e15c0036ba95d2918" diff --git a/src/main/java/org/nrg/xnat/turbine/modules/actions/BulkLaunchAction.java b/src/main/java/org/nrg/xnat/turbine/modules/actions/BulkLaunchAction.java index c3d7870..f5fc4a4 100644 --- a/src/main/java/org/nrg/xnat/turbine/modules/actions/BulkLaunchAction.java +++ b/src/main/java/org/nrg/xnat/turbine/modules/actions/BulkLaunchAction.java @@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.util.RunData; import org.apache.velocity.context.Context; import org.nrg.xdat.exceptions.InvalidSearchException; @@ -39,7 +40,8 @@ @Slf4j public class BulkLaunchAction extends DisplaySearchAction { @Override - public void doPerform(final RunData data, final Context context) { + public void doPerform(final PipelineData pipelineData, final Context context) { + final RunData data = pipelineData.getRunData(); final UserI user = getUser(); try { final String rawSearchXml = data.getParameters().getString("search_xml"); diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/UserDashboard.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/UserDashboard.java index c6c4daf..3a4e2df 100644 --- a/src/main/java/org/nrg/xnat/turbine/modules/screens/UserDashboard.java +++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/UserDashboard.java @@ -2,7 +2,7 @@ package org.nrg.xnat.turbine.modules.screens; -import org.apache.turbine.util.RunData; +import org.apache.turbine.pipeline.PipelineData; import org.apache.velocity.context.Context; import org.nrg.xdat.turbine.modules.screens.SecureScreen; @@ -11,6 +11,6 @@ public class UserDashboard extends SecureScreen { * {@inheritDoc} */ @Override - protected void doBuildTemplate(RunData data, Context context) throws Exception { + protected void doBuildTemplate(PipelineData pipelineData, Context context) throws Exception { } } diff --git a/src/main/java/org/nrg/xnat/turbine/modules/screens/XDATScreen_bulk_action.java b/src/main/java/org/nrg/xnat/turbine/modules/screens/XDATScreen_bulk_action.java index 307532d..f520994 100644 --- a/src/main/java/org/nrg/xnat/turbine/modules/screens/XDATScreen_bulk_action.java +++ b/src/main/java/org/nrg/xnat/turbine/modules/screens/XDATScreen_bulk_action.java @@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.util.RunData; import org.apache.velocity.context.Context; import org.nrg.action.ClientException; @@ -25,7 +26,8 @@ public class XDATScreen_bulk_action extends SecureScreen { @Override - protected void doBuildTemplate(final RunData data, final Context context) throws ClientException { + protected void doBuildTemplate(final PipelineData pipelineData, final Context context) throws ClientException { + final RunData data = pipelineData.getRunData(); final UserI user = XDAT.getUserDetails(); context.put("timezoneOffset", Calendar.getInstance().getTimeZone().getOffset(Calendar.getInstance().getTimeInMillis())); diff --git a/src/main/java/org/nrg/xnatx/plugins/batch/workflows/repository/WorkflowRepository.java b/src/main/java/org/nrg/xnatx/plugins/batch/workflows/repository/WorkflowRepository.java index 3b6786a..5037623 100644 --- a/src/main/java/org/nrg/xnatx/plugins/batch/workflows/repository/WorkflowRepository.java +++ b/src/main/java/org/nrg/xnatx/plugins/batch/workflows/repository/WorkflowRepository.java @@ -19,7 +19,7 @@ import org.nrg.xft.exception.XFTInitException; import org.nrg.xnatx.plugins.batch.workflows.model.Workflow; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.nrg.xft.event.persist.PersistentWorkflowI; import org.nrg.xft.event.persist.PersistentWorkflowUtils; import org.nrg.xft.security.UserI;