title: Share local maven repository to agents in Jenkins Pipeline
body: <p>I'm having hard problems with a Jenkinsfile with a Pipeline.</p>
  
  <p>I have a master Jenkins which runs in a docker container and other Jenkins slaves, which are also docker containers and some are Virtual Machines (e.g., Windows 10).</p>
  
  <p>I perform the code checkout from Git in the master as first stage and for the further stages.</p>
  
  <p>A Stage name 'Build' performs the generation of maven artifacts. I use one docker image to build my project (based on Maven and Java 9) <strong>without</strong> sharing any volume across host and container. I pass the source code using the <code>stash</code> / <code>unstash</code> functions.I'm using also the maven-pipeline plugin and the option <code>withMaven(mavenLocalRepo: '')</code></p>
  
  <p>I'd like to share what I've built on one agent to other agents in a Test stage, but it looks like at this point, stashing of repository is not working (it says: 'no file to stash') and I cannot deploy to a central maven repository (I use Nexus), because there are many concurrent builds possible and the deploy could not be safe.</p>
  
  <p>How can I solve this issue?</p>
  
  <p>Example of pipeline:</p>
  
  <pre><code>pipeline{
    agent none
    stages{
      stage('Checkout Repository'){ 
        agent { node { label 'master' } }
        steps{
          checkout scm 
          stash includes: 'project/', name 'project'
        }
      }
      stage('Build'){
        agent { node { label 'docker-app-builder' } }
        steps{
          unstash "project"
          withMaven(mavenLocalRepo: ".repository"){ sh 'mvn clean install' }
          stash includes: ".repository", name "repository"
        }
      }
    }
    stage("Test){
      steps{
        parallel "docker slave": {
          node("docker-app-tester"){
            unstash "repository"
            unstash "project"
            withMaven(mavenLocalRepo: ".repository"){ ... }                
          }
        },
        "Windows Slave": {
           node("windows-tester"){
            unstash "repository"
            unstash "project"
            withMaven(mavenLocalRepo: ".repository"){ ... }                
          }
        }
      }
   }
  }
  </code></pre>