Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33884

java.io.IOException: Failed to rename Maven installation directory

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I run Jenkins 2.0 beta binary under Windows 10.
      I declared a Maven installtion "M3" under Global Tool Configuration.
      I created the pipeline job with the following script:

      node {
        git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
        def mvnHome = tool 'M3'
        bat "${mvnHome}\\bin\\mvn -B verify"
      }
      

      I get the following error when installing Maven:

      Started by user Administrateur
      [Pipeline] Allocate node : Start
      Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
      [Pipeline] node {
      [Pipeline] git
      Cloning the remote Git repository
      remote: Counting objects
      Receiving objects
      Resolving deltas
      Updating references
      Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
      First time build. Skipping changelog.
      [Pipeline] tool
      Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
      [Pipeline] } //node
      [Pipeline] Allocate node : End
      [Pipeline] End of Pipeline
      java.io.IOException: Failed to rename C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\apache-maven-3.3.9 to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\apache-maven-3.3.9.__rename
      	at hudson.FilePath$40.invoke(FilePath.java:1963)
      	at hudson.FilePath$40.invoke(FilePath.java:1956)
      	at hudson.FilePath.act(FilePath.java:990)
      	at hudson.FilePath.act(FilePath.java:968)
      	at hudson.FilePath.moveAllChildrenTo(FilePath.java:1956)
      	at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:80)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
      	at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:622)
      	at hudson.tasks.Maven$MavenInstallation.forNode(Maven.java:449)
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:128)
      	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:111)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:49)
      	at hudson.security.ACL.impersonate(ACL.java:213)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Finished: FAILURE
      

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          Weird. We didn't touch this particular functionality in the 2.0 update. Looks like some Windows file locking going on, possibly by Windows Search or antivirus process? Are they running? Could you monitor open files while this happens? Is this reproducible?

          Show
          danielbeck Daniel Beck added a comment - Weird. We didn't touch this particular functionality in the 2.0 update. Looks like some Windows file locking going on, possibly by Windows Search or antivirus process? Are they running? Could you monitor open files while this happens? Is this reproducible?
          Hide
          lautou Laurent TOURREAU added a comment -

          Today. I relaunched the job -> Same result. So it is reproductible.

          I disabled McAfee LiveSafe - Internet Security real time analysis and rerun the job. Now it run correctly:

          [Pipeline] bat
          [myPipeline] Running batch script
          
          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify 
          'C:\Program' is not recognized as internal or external command...
          
          [Pipeline] } //node
          

          Obviously it is another error now (I will dig this topic in another JIRA) but Maven has been installed.

          If I re-enable McAfee and i run the job again, of course the Maven installation issue won't occur since it is already installed.

          The main question is : How can it be fixed to avoid antivirus issue when dynamically install Maven or any other tool? We can't ask to disable antivirus because the installation event could not be defined beforehand.

          Show
          lautou Laurent TOURREAU added a comment - Today. I relaunched the job -> Same result. So it is reproductible. I disabled McAfee LiveSafe - Internet Security real time analysis and rerun the job. Now it run correctly: [Pipeline] bat [myPipeline] Running batch script C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify 'C:\Program' is not recognized as internal or external command... [Pipeline] } //node Obviously it is another error now (I will dig this topic in another JIRA) but Maven has been installed. If I re-enable McAfee and i run the job again, of course the Maven installation issue won't occur since it is already installed. The main question is : How can it be fixed to avoid antivirus issue when dynamically install Maven or any other tool? We can't ask to disable antivirus because the installation event could not be defined beforehand.
          Hide
          danielbeck Daniel Beck added a comment -

          How can it be fixed to avoid antivirus issue when dynamically install Maven or any other tool? We can't ask to disable antivirus because the installation event could not be defined beforehand.

          Keep antivirus out of your Jenkins 'tools' directory. You'll also have a bad time if antivirus runs on workspaces. Just exclude those directories.

          Show
          danielbeck Daniel Beck added a comment - How can it be fixed to avoid antivirus issue when dynamically install Maven or any other tool? We can't ask to disable antivirus because the installation event could not be defined beforehand. Keep antivirus out of your Jenkins 'tools' directory. You'll also have a bad time if antivirus runs on workspaces. Just exclude those directories.
          Hide
          lautou Laurent TOURREAU added a comment -

          Could what you said about antivirus be documented in the wiki? I think it should be mentionned in Windows installation section.

          Show
          lautou Laurent TOURREAU added a comment - Could what you said about antivirus be documented in the wiki? I think it should be mentionned in Windows installation section.
          Hide
          lautou Laurent TOURREAU added a comment -

          Daniel, one interesting thing :
          I have got rid of MacAfee LiveSafe and installed Avast Free Antivirus instead. I performed a clean install of Jenkins and relaunched the job -> Maven installation works without any problem.
          We can conclude this issue could depend of the antivirus installed.

          Show
          lautou Laurent TOURREAU added a comment - Daniel, one interesting thing : I have got rid of MacAfee LiveSafe and installed Avast Free Antivirus instead. I performed a clean install of Jenkins and relaunched the job -> Maven installation works without any problem. We can conclude this issue could depend of the antivirus installed.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            lautou Laurent TOURREAU
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: