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

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-dist-tool.git


The following commit(s) were added to refs/heads/master by this push:
     new 3a2e4f4  use a token
3a2e4f4 is described below

commit 3a2e4f4e2c2ecdbfc227ea150d4c3f7c8953e196
Author: Olivier Lamy <[email protected]>
AuthorDate: Fri Mar 13 19:14:54 2026 +1000

    use a token
    
    Signed-off-by: Olivier Lamy <[email protected]>
---
 Jenkinsfile                                               | 12 +++++++-----
 pom.xml                                                   | 13 +++++++++++++
 src/main/java/org/apache/maven/dist/tools/JsoupRetry.java |  1 +
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index ca0bc7b..4f9d2f5 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -57,11 +57,13 @@ pipeline {
                 branch 'master'
             }
             steps {
-                withMaven(jdk:'jdk_21_latest', maven:'maven_3_latest', 
mavenLocalRepo:'.repository', options: [
-                  artifactsPublisher(disabled: true),
-                  findbugsPublisher(disabled: true),
-                ]) {
-                    sh "mvn -ntp -V -e failsafe:integration-test"
+                withCredentials([string(credentialsId: 'API_TOKEN', variable: 
'API_TOKEN')]) {
+                    withMaven(jdk:'jdk_21_latest', maven:'maven_3_latest', 
mavenLocalRepo:'.repository', options: [
+                      artifactsPublisher(disabled: true),
+                      findbugsPublisher(disabled: true),
+                    ]) {
+                        sh "mvn -ntp -V -e failsafe:integration-test"
+                    }
                 }
             }
         }
diff --git a/pom.xml b/pom.xml
index 9d9bb00..cebeb27 100644
--- a/pom.xml
+++ b/pom.xml
@@ -201,6 +201,19 @@
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <configuration>
+            <environmentVariables>
+              <API_TOKEN>${env.API_TOKEN}</API_TOKEN>
+            </environmentVariables>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
         <groupId>org.eclipse.sisu</groupId>
diff --git a/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java 
b/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
index f8366e5..c08b8ef 100644
--- a/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
+++ b/src/main/java/org/apache/maven/dist/tools/JsoupRetry.java
@@ -49,6 +49,7 @@ public class JsoupRetry {
         for (int i = 1; i <= MAX_RETRY; i++) {
             try {
                 return Jsoup.connect(url)
+                        .header("Authorization", "Basic " + 
System.getenv("API_TOKEN"))
                         .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; 
rv:25.0) Gecko/20100101 Firefox/25.0")
                         .maxBodySize(0)
                         .get();

Reply via email to