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

Deletion of productive m2.conf in maven installation during post build step

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: artifactory-plugin
    • Labels:
      None
    • Environment:
      Microsoft Windows 7 64 bit
      Jenkins 2.6.0 slave
      jdk1.7.0_71
      Artifactory Plugin 2.11.0
      maven 3.5.0
    • Similar Issues:

      Description

      After upgrading the Artifactory Plugin from 2.10.4 to 2.11.0 in every post build step the file 'm2.conf' gets deleted. This causes further build jobs to fail since the file is given via parameter 'Dclassworlds.conf' and is therefore neccessary to run maven.

      To find the root cause of this problem we opened the file 'm2.conf' to hold a lock on it. This caused our build job to fail with the following details in the post build step

      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 28.041 s
      [INFO] Finished at: 2017-05-22T13:17:34+02:00
      [INFO] Final Memory: 60M/388M
      [INFO] ------------------------------------------------------------------------
      FATAL: Could not delete temp file: C:\Program Files\Maven3\bin\m2.conf
      java.io.IOException: Could not delete temp file: C:\Program Files\Maven3\bin\m2.conf
      	at org.jfrog.hudson.action.ActionableHelper.deleteFilePath(ActionableHelper.java:255)
      	at org.jfrog.hudson.maven3.Maven3Builder.RunMaven(Maven3Builder.java:114)
      	at org.jfrog.hudson.maven3.Maven3Builder.perform(Maven3Builder.java:90)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
      	at hudson.model.Build$BuildExecution.build(Build.java:206)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      	at hudson.model.Run.execute(Run.java:1733)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:405)
      Discard old builds...
      #321 is removed because old than numToKeep
      #320 is removed because old than numToKeep
      Finished: FAILURE
      

      The following commit seems to cause this issue: https://github.com/JFrogDev/jenkins-artifactory-plugin/commit/1634b7138631d11b0bb60ef7a7fe930ea855938b

      Related JIRA issue: https://www.jfrog.com/jira/projects/HAP/issues/HAP-917

      We think that the deleteFilePathOnExit in Maven3Builder.java:184 should be moved into the 'if (artifactoryIntegration)' block beginning in line 166.

      Workaround is reverting the Artifactory Plugin to version 2.10.4 or disabling the Plugin. Our assumption is that this bug only affects users who have installed the Artifactory Plugin but don't actually use it in any build.

        Attachments

          Activity

          Hide
          yahaviz Yahav Itzhak added a comment -

          Martin Dönicke,

          Thanks for your detailed analysis.
          You can track this issue in this JIRA.

          Show
          yahaviz Yahav Itzhak added a comment - Martin Dönicke , Thanks for your detailed analysis. You can track this issue in this JIRA .
          Hide
          yahaviz Yahav Itzhak added a comment -

          Martin Dönicke
          We fixed the issue. You can find a snapshot in our JIRA ticket.
          We would appreciate your feedback for it.

          Show
          yahaviz Yahav Itzhak added a comment - Martin Dönicke We fixed the issue. You can find a snapshot in our JIRA ticket . We would appreciate your feedback for it.
          Hide
          nfalco Nikolas Falco added a comment -

          In our case, the file was deleted with success corrupting that maven tool so any job that use the same maven tool fail with

          java.io.FileNotFoundException: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.3/bin/m2.conf (No such file or directory)
          	at java.io.FileInputStream.open0(Native Method)
          	at java.io.FileInputStream.open(FileInputStream.java:195)
          	at java.io.FileInputStream.<init>(FileInputStream.java:138)
          	at java.io.FileInputStream.<init>(FileInputStream.java:93)
          	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:390)
          	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
          Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE
          Build step 'Invoke Artifactory Maven 3' marked build as failure
          

          I've a look into the code, it's a good idea add unit test to avoid these regression in the future

          Show
          nfalco Nikolas Falco added a comment - In our case, the file was deleted with success corrupting that maven tool so any job that use the same maven tool fail with java.io.FileNotFoundException: /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven_3.3/bin/m2.conf (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at java.io.FileInputStream.<init>(FileInputStream.java:93) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:390) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE Build step 'Invoke Artifactory Maven 3' marked build as failure I've a look into the code, it's a good idea add unit test to avoid these regression in the future

            People

            • Assignee:
              eyalbe Eyal Ben Moshe
              Reporter:
              martindoenicke Martin Dönicke
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: