Template Jenkins JobDSL:

def prj = 'My Project'
def branchName = 'master'
def jobName = "${prj} - ${branchName}".replaceAll('/','-')
job(jobName) {

  logRotator(-1, 10, -1, -1)
  
scm {
  
  git{
    remote {
        url('git@bitbucket.org:myuser/mygitproject.git')
      }
    branch 'master'
  }
}
triggers {
     scm 'H/5 * * * *'
}
steps {
  gradle{
    tasks "clean build test"
    useWrapper false
    rootBuildScriptDir 'server/'
    gradleName 'mygradlesetupinjenkins'
  }
}
}