I am working on Multibranch pipelines in Jenkins.We use SVN as repository and maven for build. I have placed the jenkins file in each branch.
In jenkins file,
After initial checkout, I wrote a function to iterate over the workspace and add the folder names to the list that needs to be build ahead.
In Build stage, I used the list size to iterate using for loop, navigate to the directory and run maven command inside the folder where the POM file is located. Issue i am trying to solve is, when there is changes in one of the projects under branch, it runs build for all projects due to above configuration. I am looking for some guidance to run build only for changes using pipelines.
Code Snippet - for ( int i = 0; i < size; i++) {
dir(dirsl[i]) {
try {
withMaven(jdk: 'Java7', maven: 'localmaven') {
bat "mvn clean package"
}
}
catch (e) {
println e
}
}
Also not sure if this is the right way to build using Maven.