Search code examples
javapluginsjenkinswcf-ria-services

Jenkins with Copy Artifact plugin


I'm trying to copy the artifacts from an upstream job using the "Copy Artifact" Jenkins plugin but I'm getting this error message:

Failed to copy [upstream_dir]\Generated_Code\XX.XX.g.cs to [downstream_dir]\XX.XX.g.cs due to java.io.FileNotFoundException [downstream_dir]\Generated_Code\XX.XX.g.cs (Access is denied)

It occurs only while trying to copy this file, which is auto generated by WCF RIA Services.

I'm using the "Upstream build that triggered this job" option for the "Which build" setting, copying all artifacts by using the "**" wildcards.

Jenkins: ver. 1.436 Copy Artifact Plugin: ver. 1.19


Solution

  • After months...

    I decided to by pass the death star (@BlessedGeek reference) locking schema, so this bat file runs before all other steps:

    ECHO OFF
    CLS
    
    ECHO Perfect Unlock application to avoid Ria Services locking errors
    ECHO.
    ECHO STATUS: 
    IF NOT EXIST "C:\Jenkins....\Generated_Code\MyApp.WebServices.g.cs" GOTO NOWINDIR
    
    attrib -r "C:\Jenkins....\Generated_Code\MyApp.WebServices.g.cs" /d /s
    ECHO Sucess!
    ECHO.
    EXIT 0
    
    :NOWINDIR
    ECHO At first build there is no folder or file to unlock.
    ECHO.
    EXIT 0