title: How to set Jenkinsfile for upload maven artifact to Artifactory
body: <p>I've my .Jenkinsfile like this:</p>
  
  <pre><code>properties([[$class: 'GitLabConnectionProperty', gitLabConnection: 'gitlab@srv']])
  node {
    env.JAVA_HOME = tool 'JDK 7'
    def mvnHome = tool 'Maven 3.2.2'
    def nodeJS = tool 'IA_NodeJS'
    env.PATH = "${mvnHome}/bin:${nodeJS}/bin:${env.JAVA_HOME}/bin:${env.PATH}"
  
    stage ('checkout') {
      checkout scm
    }
  
    stage ('build') {
      gitlabCommitStatus("build") {
        // your build steps
        sh 'mvn clean install -Denv=dev -P !faster'
      }
    }
  
    stage ('upload') {
      gitlabCommitStatus("upload") {
        def server = Artifactory.server "artifactory@ibsrv02"
        def buildInfo = Artifactory.newBuildInfo()
        buildInfo.env.capture = true
        buildInfo.env.collect()
  
        def uploadSpec = """{
          "files": [
            {
              "pattern": "**/target/*.jar",
              "target": "libs-snapshot-local"
            }, {
              "pattern": "**/target/*.pom",
              "target": "libs-snapshot-local"
            }, {
              "pattern": "**/target/*.war",
              "target": "libs-snapshot-local"
            }
          ]
        }"""
        // Upload to Artifactory.
        server.upload spec: uploadSpec, buildInfo: buildInfo
  
        buildInfo.retention maxBuilds: 10, maxDays: 7, deleteBuildArtifacts: true
        // Publish build info.
        server.publishBuildInfo buildInfo
      }
    }
  }
  </code></pre>
  
  <p>with this method jenkins uploads artifacts without make the "maven's style" layout (packages subfolder and poms).</p>
  
  <p>I want to upload resulting artifact to Artifactory like a normal job uploads it with "Maven3-Artifactory Integration" checked.</p>