I am using below Jenkinsfile to create maven build and archive it after.
pipeline {
agent any
stages {
stage('Build') {
steps {
withMaven(maven: 'mvn installed') {
sh "mvn clean package"
}
}
post {
success {
archiveArtifacts 'target/*.jar'
}
}
}
}
After archiving the build it gets saved to target folder which has the jar file I want to use. However the build folder also contains the original com.. folder that contains the same jar. Is there any way I can delete this com folder after archiving, because it is just taking extra space in my server that I am not using at all.
Edit: I am not looking to clean the workspace but rather the original com folder inside the builds/<build_no>/archive/ folder