def myFile= new File("/var/lib/jenkins/jobs/Test_DSL/workspace/configuration2.xml") def parser=new XmlSlurper().parseText(myFile.text); def allModule=parser.module.each { def projectName= it.name as String def sourceCodeType=it.sourceCode.@type def URLSource=it.sourceCode as String def mvnGoal= it.goal as String def hasSonar= it.sonar as String job { name 'DSL_'+projectName if(sourceCodeType.equals("SVN")) { using ('dnet-svn-template') } triggers { scm('*/10 * * * *') } configure { project -> def goalModule=project / goals goalModule.value=mvnGoal if(sourceCodeType.equals("SVN")) { def scm= project / scm def remoteNode= scm.locations.'hudson.scm.SubversionSCM_-ModuleLocation'[0].remote[0] remoteNode.value=URLSource } if (hasSonar.equals("YES")) { def pubblish=(project /publishers).appendNode('hudson.plugins.sonar.SonarPublisher') pubblish << { branch('') language('') mavenOpts('') jobAdditionalProperties('') } pubblish.appendNode('triggers') <<{ skipScmCause('false') skipUpstreamCause('false') envVar() } } } } }