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

android emulator logcat temporary file breaks maven-release-plugin

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins 1.436, android-emulator-plugin 1.18, Ubuntu 10.04 master, ubuntu 11.04 or windows 7 slave.
      Using maven-release-plugin with javasvn provider.
    • Similar Issues:

      Description

      Use of maven-release-plugin with the android-emulator-plugin fails because the logcat temporary log file is captured as a modified file in the maven workspace.

      mavenExecutionResult exceptions not empty
      message : Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.2.1:prepare (default-cli) on project parent: Cannot prepare the release because you have local modifications : 
      [C:\jenkins\slave\workspace\testjob\logcat_5637825123254995961.log:unknown]
      
      cause : Cannot prepare the release because you have local modifications : 
      [C:\jenkins\slave\workspace\testjob\logcat_5637825123254995961.log:unknown]
      
      Stack trace : 
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.2.1:prepare (default-cli) on project parent: Cannot prepare the release because you have local modifications : 
      [C:\jenkins\slave\workspace\testjob\logcat_5637825123254995961.log:unknown]
      
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      	at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
      	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:112)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:287)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: org.apache.maven.plugin.MojoFailureException: Cannot prepare the release because you have local modifications : 
      [C:\jenkins\slave\workspace\testjob\logcat_5637825123254995961.log:unknown]
      
      	at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:310)
      	at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:258)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
      	... 27 more
      Caused by: org.apache.maven.shared.release.ReleaseFailureException: Cannot prepare the release because you have local modifications : 
      [C:\jenkins\slave\workspace\testjob\logcat_5637825123254995961.log:unknown]
      
      	at org.apache.maven.shared.release.phase.ScmCheckModificationsPhase.execute(ScmCheckModificationsPhase.java:153)
      	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:206)
      	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:142)
      	at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:104)
      	at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:302)
      	... 30 more
      

      I cannot easily work around this by adding a checkModificationExcludes entry into the release:prepare parameters because it does not take a wildcard filename (needed to match the logcat_*.log temporary filename).

      I have managed to workaround this by building a local copy of the plugin that uses a file suffix of .log~ (maven ignores that because it treats is as a backup file). Example patch snippet to do this below.

      -        final FilePath logcatFile = build.getWorkspace().createTempFile("logcat_", ".log");
      +        final FilePath logcatFile = build.getWorkspace().createTempFile("logcat_", ".log~");
      

      That is not a proper solution but it does work.

      I guess that the proper solution will involve generating a temporary file outside of the workspace somewhere on the build slave.

        Attachments

          Activity

          Hide
          oldelvet Richard Mortimer added a comment -

          Use a variant of the temp file allocation routines that creates the file in the java.io.tmpdir directory rather than in the workspace.

          https://github.com/jenkinsci/android-emulator-plugin/pull/6

          Show
          oldelvet Richard Mortimer added a comment - Use a variant of the temp file allocation routines that creates the file in the java.io.tmpdir directory rather than in the workspace. https://github.com/jenkinsci/android-emulator-plugin/pull/6
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
          http://jenkins-ci.org/commit/android-emulator-plugin/f1af66a356e94c124e37d962339d9e82b8391140
          Log:
          JENKINS-11492 android emulator logcat temporary file breaks maven-release-plugin

          Use createTextTempFile to allocate the temporary file. Force the temporary
          file to be created in the java.io.tmpdir directory instead of the job
          workspace by passing parameter isThisDirectory as false.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java http://jenkins-ci.org/commit/android-emulator-plugin/f1af66a356e94c124e37d962339d9e82b8391140 Log: JENKINS-11492 android emulator logcat temporary file breaks maven-release-plugin Use createTextTempFile to allocate the temporary file. Force the temporary file to be created in the java.io.tmpdir directory instead of the job workspace by passing parameter isThisDirectory as false.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Christopher Orr
          Path:
          src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
          http://jenkins-ci.org/commit/android-emulator-plugin/a564c7e5d917a62fa2391cad59a59a4a5bab60ad
          Log:
          Merge pull request #6 from oldelvet/jenkins-11492

          [FIXED JENKINS-11492] Write logcat output to file in temp directory.

          Compare: https://github.com/jenkinsci/android-emulator-plugin/compare/367d5c9...a564c7e

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christopher Orr Path: src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java http://jenkins-ci.org/commit/android-emulator-plugin/a564c7e5d917a62fa2391cad59a59a4a5bab60ad Log: Merge pull request #6 from oldelvet/jenkins-11492 [FIXED JENKINS-11492] Write logcat output to file in temp directory. Compare: https://github.com/jenkinsci/android-emulator-plugin/compare/367d5c9...a564c7e

            People

            • Assignee:
              oldelvet Richard Mortimer
              Reporter:
              oldelvet Richard Mortimer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: