title: Unable to find the war file but exit in target folder
body: <p>As i am building the file and uploading it to nexus repository. In the way i can build the file and the war file is present in target folder (/var/lib/jenkins/workspace/Declerative_pipeline/target/orders-2.0.0.war) But while Uploading war file to nexus i am getting an error saying &quot;order-2.0.0.war file doesn't exist. find the below console output and Jenkinsfile and help me with a solution.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>+ mvn clean package
  [INFO] Scanning for projects...
  [INFO] 
  [INFO] -------------------------&lt; in.javahome:orders &gt;-------------------------
  [INFO] Building orders 2.0.0
  [INFO] --------------------------------[ war ]---------------------------------
  [INFO] 
  [INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ orders ---
  [INFO] Deleting /var/lib/jenkins/workspace/Declerative_pipeline/target
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ orders ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Declerative_pipeline/src/main/resources
  [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Declerative_pipeline/src/main/resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ orders ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 2 source files to /var/lib/jenkins/workspace/Declerative_pipeline/target/classes
  [INFO] 
  [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ orders ---
  [INFO] Using 'UTF-8' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/Declerative_pipeline/src/test/resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ orders ---
  [INFO] Changes detected - recompiling the module!
  [INFO] Compiling 1 source file to /var/lib/jenkins/workspace/Declerative_pipeline/target/test-classes
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ orders ---
  [INFO] Surefire report directory: /var/lib/jenkins/workspace/Declerative_pipeline/target/surefire-reports
  
  -------------------------------------------------------
   T E S T S
  -------------------------------------------------------
  Running in.javahome.orders.AppTest
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.014 sec - in in.javahome.orders.AppTest
  
  Results :
  
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
  
  [INFO] 
  [INFO] --- maven-war-plugin:2.6:war (default-war) @ orders ---
  [INFO] Packaging webapp
  [INFO] Assembling webapp [orders] in [/var/lib/jenkins/workspace/Declerative_pipeline/target/orders-2.0.0]
  [INFO] Processing war project
  [INFO] Webapp assembled in [128 msecs]
  [INFO] Building war: /var/lib/jenkins/workspace/Declerative_pipeline/target/orders-2.0.0.war
  [INFO] 
  [INFO] --- spring-boot-maven-plugin:1.5.3.RELEASE:repackage (default) @ orders ---
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time:  6.936 s
  [INFO] Finished at: 2020-12-09T07:37:04Z
  [INFO] ------------------------------------------------------------------------
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] stage
  [Pipeline] { (upload artifacts)
  [Pipeline] tool
  [Pipeline] envVarsForTool
  [Pipeline] withEnv
  [Pipeline] {
  [Pipeline] script
  [Pipeline] {
  [Pipeline] readMavenPom
  [Pipeline] nexusArtifactUploader
  order-2.0.0.war file doesn't exist
  [Pipeline] }
  [Pipeline] // script
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // stage
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // withEnv
  [Pipeline] }
  [Pipeline] // node
  [Pipeline] End of Pipeline
  [Checks API] No suitable checks publisher found.
  java.io.IOException: order-2.0.0.war file doesn't exist
      at sp.sd.nexusartifactuploader.steps.NexusArtifactUploaderStep$Execution$1.call(NexusArtifactUploaderStep.java:267)
      at sp.sd.nexusartifactuploader.steps.NexusArtifactUploaderStep$Execution$1.call(NexusArtifactUploaderStep.java:256)
      at hudson.FilePath.act(FilePath.java:1163)
      at sp.sd.nexusartifactuploader.steps.NexusArtifactUploaderStep$Execution.run(NexusArtifactUploaderStep.java:256)
      at sp.sd.nexusartifactuploader.steps.NexusArtifactUploaderStep$Execution.run(NexusArtifactUploaderStep.java:217)
      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      at hudson.security.ACL.impersonate(ACL.java:367)
      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  Finished: FAILURE</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>pipeline{
      agent any
      tools{
          maven 'maven3'
      }
       stages{
             stage('Build'){
                 steps{
                    sh 'mvn clean package'
                 }
             }
            stage('upload artifacts'){
                steps{
                    script{
  
                      def mavenPom = readMavenPom file: 'pom.xml'
                        nexusArtifactUploader artifacts: 
                        [
                            [
                                artifactId: 'orders', 
                                classifier: '', 
                                file: "/var/lib/jenkins/workspace/Declerative_pipeline/target/order-${mavenPom.version}.war", 
                                type: 'war'
                            ]
                        ], 
                        credentialsId: 'Nexusnir', 
                        groupId: 'in.javahome', 
                        nexusUrl: '13.232.6.115:8081', 
                        nexusVersion: 'nexus3', 
                        protocol: 'http', 
                        repository: 'Declarative_Pipeline', 
                        version: "${mavenPom.version}"
                    }
                }
            }
      }
  }</code></pre>
  </div>
  </div>
  </p>