You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/12/03 13:59:29 UTC

[maven-site] 01/01: Clean workspace before build

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

sjaranowski pushed a commit to branch clean-workspace
in repository https://gitbox.apache.org/repos/asf/maven-site.git

commit f28d3dc9a46e96bdc601b88c8241f36a2c729283
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Sat Dec 3 14:58:45 2022 +0100

    Clean workspace before build
    
    Old workspace can contain corrupted git data
    or contain data created by another git version
---
 Jenkinsfile | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Jenkinsfile b/Jenkinsfile
index 1a807fe3..efa8d145 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -27,6 +27,11 @@
                 not { branch 'master' }
             }
             steps {
+                // Clean before build
+                cleanWs()
+                // We need to explicitly checkout from SCM here
+                checkout scm
+                // build with Maven
                 withMaven(jdk:'jdk_17_latest', maven:'maven_3_latest', mavenLocalRepo:'.repository', options: [
                   artifactsPublisher(disabled: true),
                   junitPublisher(disabled: true),
@@ -42,6 +47,11 @@
                 branch 'master'
             }
             steps {
+                // Clean before build
+                cleanWs()
+                // We need to explicitly checkout from SCM here
+                checkout scm
+                // build with Maven
                 withMaven(jdk:'jdk_17_latest', maven:'maven_3_latest', mavenLocalRepo:'.repository', options: [
                   artifactsPublisher(disabled: true),
                   junitPublisher(disabled: true),
@@ -65,5 +75,7 @@
         //timestamps()
         disableConcurrentBuilds()
         ansiColor('xterm')
+        // This is required if you want to clean before build
+        skipDefaultCheckout(true)
     }
 }