I have a multi-module maven project which contains nested some other reactor submodules. As result I have a 3 level hierarchy of modules.
In the past I refactored the hierachy, moving some nested modules from one to another. I modified as well the names of some of the modules.
On Jenkins, the old modules - now unexistent - appear in the build report as "didn't run". When I do locally a maven install these modules don't appear in the reactor summary.
Is this behavior somehow expected? I mean, are there any setting in jenkins which makes the reactor runner remember old sub-modules?
The "Delete workspace before build starts" option is enabled.
If, for some reason, Delete All Disabled Modules is not available, then you can run this Groovy script in Manage Jenkins -> Script Console (https://<JENKINS_URL>/script
). Based upon a script I found on the Jenkins Jira and improved with feedback here on Stack Overflow.
import jenkins.model.Jenkins
import hudson.maven.MavenModuleSet
import hudson.model.Result
Jenkins.instance
.getAllItems(Job.class)
.findAll({ job -> job instanceof MavenModuleSet })
.each {
job ->
build = job.getLastBuild()
if (build && build.getResult() == Result.SUCCESS) {
println("==> Processing job " + job.name)
build.getModuleBuilds().each {
module, build ->
if (build.isEmpty()) {
//module.delete()
println(" --> Deleted module " + module.name)
}
}
} else {
println("Warning: Skipped job " + job.name + " because its last build failed.")
}
}
return null
How to use:
module.delete()
.Side effect: any archived builds that still had that module in the past, will no longer have the deleted module. In my use case this was acceptable.
Have you tried the action Delete All Disabled Modules available between Configure and Modules on the project page ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With