You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Hu Wang (Jira)" <ji...@apache.org> on 2025/03/03 16:40:00 UTC

[jira] [Updated] (MBUILDCACHE-117) temp artifacts created by extension are not found in Jenkins pipeline job

     [ https://issues.apache.org/jira/browse/MBUILDCACHE-117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hu Wang updated MBUILDCACHE-117:
--------------------------------
    Summary: temp artifacts created by extension are not found in Jenkins pipeline job  (was: temp artifacts are not found in Jenkins pipeline job)

> temp artifacts created by extension are not found in Jenkins pipeline job
> -------------------------------------------------------------------------
>
>                 Key: MBUILDCACHE-117
>                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-117
>             Project: Maven Build Cache Extension
>          Issue Type: Bug
>          Components: remote build cache
>    Affects Versions: 1.2.0
>         Environment: linux
>            Reporter: Hu Wang
>            Priority: Minor
>
> 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")



--
This message was sent by Atlassian Jira
(v8.20.10#820010)