anchor.diff:  groovy_installation = 'Groovy-default'
   git_url = "ssh://jenkins@<%= @gerrit_host %>:<%= @gerrit_port %>/${project_name}"
   version_props_generate = """
  -	def binaryVersion(env, version) {
  -	    def buildTime = Date.parse('yyyy-MM-dd_HH-mm-ss', env['BUILD_ID'])
  -	    def timestamp = buildTime.format('yyyyMMdd.HHmmss', TimeZone.getTimeZone('UTC'))
  -	    def buildNo = env['BUILD_NUMBER']
  -	    version.replaceFirst(/-SNAPSHOT\$/, \"-\${timestamp}-\${buildNo}\")
  -	}
  -
  -	def env = System.getenv()
  -	def p = new Properties()
  -
  -	def pom = new XmlParser().parse('pom.xml')
  -
  -	p['projectGroupId'] = 'org.asf.demo.webapp'
  -	p['projectArtifactId'] = 'asf-webapp-demo'
  -	p['projectVersion'] = pom.version.text() ?: '1.0.0-SNAPSHOT'
  -
  -	p['buildGroupId'] = p['projectGroupId']
  -	p['buildArtifactId'] = p['projectArtifactId']
  -	p['buildVersion'] = binaryVersion(env, p['projectVersion'])
  -	p['buildJob'] = env['JOB_NAME']
  -	p['buildNumber'] = env['BUILD_NUMBER']
  -	p['buildBranch'] = env['GIT_BRANCH'].replaceFirst('^[^/]+/', '')
  -	p['buildCommit'] = env['GIT_COMMIT']
  -
  -	p.store(new FileWriter('version.properties'), env['BUILD_TAG'])
  +  def binaryVersion(env, version) {
  +      def buildTime = Date.parse('yyyy-MM-dd_HH-mm-ss', env['BUILD_ID'])
  +      def timestamp = buildTime.format('yyyyMMdd.HHmmss', TimeZone.getTimeZone('UTC'))
  +      def buildNo = env['BUILD_NUMBER']
  +      version.replaceFirst(/-SNAPSHOT\$/, \"-\${timestamp}-\${buildNo}\")
  +  }
  +
  +  def env = System.getenv()
  +  def p = new Properties()
  +
  +  def pom = new XmlParser().parse('pom.xml')
  +
  +  p['projectGroupId'] = 'org.asf.demo.webapp'
  +  p['projectArtifactId'] = 'asf-webapp-demo'
  +  p['projectVersion'] = pom.version.text() ?: '1.0.0-SNAPSHOT'
  +
  +  p['buildGroupId'] = p['projectGroupId']
  +  p['buildArtifactId'] = p['projectArtifactId']
  +  p['buildVersion'] = binaryVersion(env, p['projectVersion'])
  +  p['buildJob'] = env['JOB_NAME']
  +  p['buildNumber'] = env['BUILD_NUMBER']
  +  p['buildBranch'] = env['GIT_BRANCH'].replaceFirst('^[^/]+/', '')
  +  p['buildCommit'] = env['GIT_COMMIT']
  +
  +  p.store(new FileWriter('version.properties'), env['BUILD_TAG'])
   """
   
   set_version = """def version = build.getEnvironment(null)['buildVersion']
  
positive.code: def build = Thread.currentThread().executable;
  def envVarsMap = build.parent.builds[0].properties.get("envVars")
  
  def qubellOutputFile = new File("\${envVarsMap.get("WORKSPACE")}/qubell_output.json")
  def userJson = new JsonSlurper().parseText(qubellOutputFile.text)
  
  def pa = new ParametersAction([
  
negative.code: 		    configure { project ->
  			    project << globalSettings(
  			    class:'org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider',
  			    plugin:"config-file-provider@<%= @plugins['config-file-provider'] %>") {
  				    settingsConfigId('<%= @settings_id %>')
  				  }
  		    }
  	    }
      }
  }
  
  job(type: Maven) {
    name "${project_name}/fb-build"
    jdk("/usr/lib/jvm/java/")
    configure { project ->
      project << globalSettings(class:'org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider', plugin:'config-file-provider@<%= @plugins['config-file-provider'] %>') {
        settingsConfigId('<%= @settings_id %>')
      }
    }
    scm {
      git {
        remote {
          name('origin')
          url(git_url)
        }
        branch('*/fb-*')
      }
    }
    triggers {
      gerrit {
        events {
          RefUpdated
        }
        project("${project_name}", "ant:fb-*")
      }
    }
  
    preBuildSteps {
      groovyCommand(version_props_generate, groovy_installation)
      environmentVariables {
          propertiesFile('version.properties')
      }
      maven {
          goals('versions:set -DnewVersion=\${buildVersion}')
          mavenInstallation(maven_installation)
      }
    }
    goals('-e')
    goals('clean')
    goals('install')
    mavenInstallation(maven_installation)
  
    postBuildSteps {
      maven {
        goals("""deploy:deploy-file -B
    -DgroupId=\${buildGroupId}
            -DartifactId=asf-webapp-demo
  -Dversion=\${buildVersion}
  -Dpackaging=war
  -DrepositoryId=builds-feature
  -Dfile=\${WORKSPACE}/spring-petclinic/target/petclinic.war
  -Durl=\${NEXUS_URL}/content/repositories/builds-feature""")
        mavenInstallation(maven_installation)
        configure { project ->
          project << globalSettings(
            class:'org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider',
            plugin:'config-file-provider@<%= @plugins['config-file-provider'] %>') {
              settingsConfigId('<%= @settings_id %>')
            }
        }
      }
      maven {
        rootPOM("spring-petclinic-test/pom.xml")
        goals('-P functional-test clean verify -Dpetclinic.version=${projectVersion}')
        mavenInstallation(maven_installation)
        configure { project ->
          project << globalSettings(
            class:'org.jenkinsci.plugins.configfiles.maven.job.MvnGlobalSettingsProvider',
            plugin:"config-file-provider@<%= @plugins['config-file-provider'] %>") {
              settingsConfigId('<%= @settings_id %>')
            }
        }
      }
    }
  }
  