This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts-site.git


The following commit(s) were added to refs/heads/main by this push:
     new b57b82a49 ci: provision maven and jdk 17 via tools block in javadocs 
pipeline (#310)
b57b82a49 is described below

commit b57b82a4928a5010888ec4493fec22bf60344eb6
Author: Lukasz Lenart <[email protected]>
AuthorDate: Wed Jul 1 09:55:26 2026 +0200

    ci: provision maven and jdk 17 via tools block in javadocs pipeline (#310)
    
    The first run failed with 'mvn: not found' (exit 127): MAVEN_3_LATEST_HOME
    is not set on the git-websites/websites2 agent, so prepending it to PATH
    added nothing. Replace the PATH hack with a declarative tools block
    (maven 'maven_3_latest', jdk 'jdk_17_latest'), matching the apache/struts
    build. Struts 7 also requires JDK 17, which the block now supplies.
    
    Co-authored-by: Claude Opus 4.8 <[email protected]>
---
 Jenkinsfile.javadocs                                      |  8 ++++++--
 .../plans/2026-07-01-jenkins-javadocs-pipeline.md         |  8 ++++++--
 .../specs/2026-07-01-jenkins-javadocs-pipeline-design.md  | 15 +++++++++++----
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/Jenkinsfile.javadocs b/Jenkinsfile.javadocs
index 4fc90a4f6..e79c6c263 100644
--- a/Jenkinsfile.javadocs
+++ b/Jenkinsfile.javadocs
@@ -14,10 +14,14 @@ pipeline {
     disableConcurrentBuilds()
     skipStagesAfterUnstable()
   }
+  tools {
+    // Provisions `mvn` and JDK 17 on PATH via Jenkins tool installers, 
matching
+    // the apache/struts build. Struts 7 requires JDK 17.
+    jdk 'jdk_17_latest'
+    maven 'maven_3_latest'
+  }
   environment {
     MAVEN_OPTS = '-Xmx2048m -Dhttps.protocols=TLSv1.2 -DfailOnError=false'
-    // Required: resolves `mvn` on the ASF agent (we use plain mvn, not the 
wrapper).
-    PATH = "${MAVEN_3_LATEST_HOME}:${env.PATH}"
   }
   stages {
     stage('Build Struts & Maven site') {
diff --git a/docs/superpowers/plans/2026-07-01-jenkins-javadocs-pipeline.md 
b/docs/superpowers/plans/2026-07-01-jenkins-javadocs-pipeline.md
index 3b6fb75c8..607608ba1 100644
--- a/docs/superpowers/plans/2026-07-01-jenkins-javadocs-pipeline.md
+++ b/docs/superpowers/plans/2026-07-01-jenkins-javadocs-pipeline.md
@@ -54,10 +54,14 @@ pipeline {
     disableConcurrentBuilds()
     skipStagesAfterUnstable()
   }
+  tools {
+    // Provisions `mvn` and JDK 17 on PATH via Jenkins tool installers, 
matching
+    // the apache/struts build. Struts 7 requires JDK 17.
+    jdk 'jdk_17_latest'
+    maven 'maven_3_latest'
+  }
   environment {
     MAVEN_OPTS = '-Xmx2048m -Dhttps.protocols=TLSv1.2 -DfailOnError=false'
-    // Required: resolves `mvn` on the ASF agent (we use plain mvn, not the 
wrapper).
-    PATH = "${MAVEN_3_LATEST_HOME}:${env.PATH}"
   }
   stages {
     stage('Build Struts & Maven site') {
diff --git 
a/docs/superpowers/specs/2026-07-01-jenkins-javadocs-pipeline-design.md 
b/docs/superpowers/specs/2026-07-01-jenkins-javadocs-pipeline-design.md
index 9f72588c7..d00d834d9 100644
--- a/docs/superpowers/specs/2026-07-01-jenkins-javadocs-pipeline-design.md
+++ b/docs/superpowers/specs/2026-07-01-jenkins-javadocs-pipeline-design.md
@@ -31,9 +31,12 @@ existing website-build pipeline already in this repo.
 
 ## Deliberate changes vs. the current shell script
 
-1. **`./mvnw` → `mvn`.** Use the Maven installation on the ASF agent instead 
of the
-   Struts project's Maven wrapper. This makes the `MAVEN_3_LATEST_HOME` PATH 
entry
-   load-bearing (it is what resolves `mvn`), so it is kept.
+1. **`./mvnw` → `mvn`.** Use a Jenkins-provisioned Maven instead of the Struts 
project's
+   Maven wrapper. Maven and JDK 17 are supplied via a declarative `tools` block
+   (`maven 'maven_3_latest'`, `jdk 'jdk_17_latest'`), matching the 
apache/struts build.
+   (An earlier draft prepended `MAVEN_3_LATEST_HOME` to `PATH`; that env var 
is not set on
+   the `git-websites`/`websites2` agent, so `mvn` was not found — the `tools` 
block is the
+   correct mechanism.)
 2. **`git push origin main` → `git push asf main`.** Mirror the existing 
`Jenkinsfile`'s
    explicit `asf` remote pattern rather than relying on the ambient `origin`.
 
@@ -68,9 +71,13 @@ options {
   skipStagesAfterUnstable()
 }
 
+tools {
+  jdk 'jdk_17_latest'            // Struts 7 requires JDK 17
+  maven 'maven_3_latest'        // puts `mvn` on PATH on whatever node runs
+}
+
 environment {
   MAVEN_OPTS = '-Xmx2048m -Dhttps.protocols=TLSv1.2 -DfailOnError=false'
-  PATH = "${MAVEN_3_LATEST_HOME}:${env.PATH}"   // required: resolves `mvn` on 
the ASF agent
 }
 ```
 

Reply via email to