jira-importer opened a new issue, #324:
URL: https://github.com/apache/maven-build-cache-extension/issues/324

   **[Hu 
Wang](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER308834)**
 opened 
**[MBUILDCACHE-117](https://issues.apache.org/jira/browse/MBUILDCACHE-117?redirect=false)**
 and commented
   
   I am testing out this great extension 1.2.0 in Jenkins pipeline, I am using 
the example maven-build-cache-config.xml and it works great until I configured 
it with \<attachedOutputs> . The config is like:
   
   \<attachedOutputs>
   
     \<dirNames>
   
        \<dirName>lib\</dirName>
   
      \</dirNames>
   
   \</attachedOutputs>
   
   …
   
   I am using Artifactory plugin in our Jenkins pipeline, it looks like:
   
   buildInfo = rtMaven.run pom: "pom.xml", goals: “clean install”
   
   Project is built fine, but it errored out when constructing the buildinfo 
and failed on File Not Found. Error is like below, in which the 
horizon-cache-test-scm is the module that has target/lib to be attached as an 
artifact, but the file 
/tmp/maven-incremental-4470226598730272536horizon-cache-test-scm has been 
deleted  
   
   **14:55:53**  java.lang.IllegalArgumentException: **File not found: 
/tmp/maven-incremental-4470226598730272536horizon-cache-test-scm**
   
   **14:55:53**   at 
org.jfrog.build.extractor.clientConfiguration.deploy.DeployDetails$Builder.build(DeployDetails.java:153)
   
   **14:55:53**   at 
org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.lambda$invoke$0(BuildInfo.java:396)
   
   **14:55:53**   at 
java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986)
   
   **14:55:53**   at 
org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.invoke(BuildInfo.java:386)
   
   **14:55:53**   at 
org.jfrog.hudson.pipeline.common.types.buildInfo.BuildInfo$DeployPathsAndPropsCallable.invoke(BuildInfo.java:362)
   
   **14:55:53**   at 
hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)
   
   **14:55:53**   at hudson.remoting.UserRequest.perform(UserRequest.java:211)
   
   **14:55:53**   at hudson.remoting.UserRequest.perform(UserRequest.java:54)
   
   **14:55:53**   at hudson.remoting.Request$2.run(Request.java:376)
   
   **14:55:53**   at 
hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
   
   **14:55:53**   at 
java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
   
   **14:55:53**   at 
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
   
   **14:55:53**   at 
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
   
   **14:55:53**   at 
hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:121)
   
   **14:55:53**   at java.base/java.lang.Thread.run(Thread.java:1583)
   
   Further digging into the source code of the extension, I found in 
https://github.com/apache/maven-build-cache-extension/blob/e9fbe3532d16d7fff96340f27da0e0b77aa6b9ff/src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java#L878
   
   the to-be-attached artifact is deleted by deletedOnExit()
   
   I changed temp.toFile().deleteOnExit(); to temp.toFile(); and tested, it 
worked just fine and the temp artifacts are attached and later deployed to 
Artifactory even though I actually don't expect those artifacts. I then was 
able to exclude them by using:
   rtMaven.deployer.artifactDeploymentPatterns.addExclude("**mvn-cache**.zip")
   
   
   ---
   
   **Affects:** 1.2.0
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to