title: Job build- failed-Defining Jenkins pipeline
body: <p>As a beginner to Jenkins pipeline. I'm defining a simple Jenkins pipeline(Declarative syntax) through classic UI but when I run the pipeline it show an error.don't know what went wrong and couldn't find any helpful answer on google as yet.</p>
  
  <blockquote>
    <blockquote>
      <p><strong>This is my project git hub project url</strong></p>
    </blockquote>
  </blockquote>
  
  <pre><code>[https://github.com/pknowledge/my-app.git/]
  </code></pre>
  
  <blockquote>
    <blockquote>
      <p><strong>This is my pipeline script</strong></p>
    </blockquote>
  </blockquote>
  
  <pre><code>pipeline {
      agent any
      stages {
          stage ('clone and clean') {
              steps {
                  sh "rm -rf my-app"
                  sh "git clone https://github.com/pknowledge/my-app.git"
                  sh "mvn clean -f my-app"
              }
          }
          stage ( 'test') {
              steps {
                  sh "mvn test -f my-app"
              }
          }
          stage ('deploy') {
              steps {
                  sh "mvn deploy -f my-app"
              }
          }
      }
  }
  </code></pre>
  
  <p><strong>After build it shows below output</strong></p>
  
  <blockquote>
    <blockquote>
      <p><strong>Jenkins console output</strong></p>
    </blockquote>
  </blockquote>
  
  <pre><code> Started by user raj
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] node
      Running on Jenkins in /var/lib/jenkins/workspace/Jenkinspipeline-demo
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (clone and clean)
      [Pipeline] sh
      + rm -rf my-app
      [Pipeline] sh
      + git clone https://github.com/pknowledge/my-app.git
      Cloning into 'my-app'...
      [Pipeline] sh
      + mvn clean -f my-app
      [[1;34mINFO[m] Scanning for projects...
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1mBuilding my-app 1.0-SNAPSHOT[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-clean-plugin:2.5:clean[m [1m(default-clean)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Deleting /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1;32mBUILD SUCCESS[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] Total time: 0.254 s
      [[1;34mINFO[m] Finished at: 2018-12-31T12:58:26Z
      [[1;34mINFO[m] Final Memory: 8M/150M
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (test)
      [Pipeline] sh
      + mvn test -f my-app
      [[1;34mINFO[m] Scanning for projects...
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1mBuilding my-app 1.0-SNAPSHOT[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:resources[m [1m(default-resources)[m @ [36mmy-app[0;1m ---[m
      [[1;33mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [[1;34mINFO[m] skip non existing resourceDirectory /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/src/main/resources
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-compiler-plugin:3.1:compile[m [1m(default-compile)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Changes detected - recompiling the module!
      [[1;33mWARNING[m] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [[1;34mINFO[m] Compiling 1 source file to /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/classes
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:testResources[m [1m(default-testResources)[m @ [36mmy-app[0;1m ---[m
      [[1;33mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [[1;34mINFO[m] skip non existing resourceDirectory /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/src/test/resources
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-compiler-plugin:3.1:testCompile[m [1m(default-testCompile)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Changes detected - recompiling the module!
      [[1;33mWARNING[m] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
      [[1;34mINFO[m] Compiling 1 source file to /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/test-classes
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-surefire-plugin:2.12.4:test[m [1m(default-test)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Surefire report directory: /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/surefire-reports
  
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running com.mycompany.app.AppTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec
  
      Results :
  
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1;32mBUILD SUCCESS[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] Total time: 1.934 s
      [[1;34mINFO[m] Finished at: 2018-12-31T12:58:30Z
      [[1;34mINFO[m] Final Memory: 16M/191M
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (deploy)
      [Pipeline] sh
      + mvn deploy -f my-app
      [[1;34mINFO[m] Scanning for projects...
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1mBuilding my-app 1.0-SNAPSHOT[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:resources[m [1m(default-resources)[m @ [36mmy-app[0;1m ---[m
      [[1;33mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [[1;34mINFO[m] skip non existing resourceDirectory /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/src/main/resources
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-compiler-plugin:3.1:compile[m [1m(default-compile)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Nothing to compile - all classes are up to date
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:testResources[m [1m(default-testResources)[m @ [36mmy-app[0;1m ---[m
      [[1;33mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
      [[1;34mINFO[m] skip non existing resourceDirectory /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/src/test/resources
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-compiler-plugin:3.1:testCompile[m [1m(default-testCompile)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Nothing to compile - all classes are up to date
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-surefire-plugin:2.12.4:test[m [1m(default-test)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Surefire report directory: /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/surefire-reports
  
      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running com.mycompany.app.AppTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.018 sec
  
      Results :
  
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-jar-plugin:2.4:jar[m [1m(default-jar)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Building jar: /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/my-app-1.0-SNAPSHOT.jar
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-install-plugin:2.4:install[m [1m(default-install)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] Installing /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/target/my-app-1.0-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.jar
      [[1;34mINFO[m] Installing /var/lib/jenkins/workspace/Jenkinspipeline-demo/my-app/pom.xml to /var/lib/jenkins/.m2/repository/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.pom
      [[1;34mINFO[m] 
      [[1;34mINFO[m] [1m--- [0;32mmaven-deploy-plugin:2.7:deploy[m [1m(default-deploy)[m @ [36mmy-app[0;1m ---[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] [1;31mBUILD FAILURE[m
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;34mINFO[m] Total time: 1.790 s
      [[1;34mINFO[m] Finished at: 2018-12-31T12:58:33Z
      [[1;34mINFO[m] Final Memory: 13M/251M
      [[1;34mINFO[m] [1m------------------------------------------------------------------------[m
      [[1;31mERROR[m] Failed to execute goal [32morg.apache.maven.plugins:maven-deploy-plugin:2.7:deploy[m [1m(default-deploy)[m on project [36mmy-app[m: [1;31mDeployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter[m -&gt; [1m[Help 1][m
      [[1;31mERROR[m] 
      [[1;31mERROR[m] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
      [[1;31mERROR[m] Re-run Maven using the [1m-X[m switch to enable full debug logging.
      [[1;31mERROR[m] 
      [[1;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
      [[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 1
      Finished: FAILURE
  </code></pre>