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

surefire-reports not detected for android-maven-plugin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None
    • Ubuntu 12.04 Jenkins 1.500

      Recent Jenkins releases have stopped detecting the test results produced by android-maven-plugin. This seems to be due to the refactoring done as part of the fix for JENKINS-8334.

      After digging into the failure the problem is due to the reportsDir fallback code that gets executed if the mojo does not support a reportsDirectory config value.

      Specifically (from SurefireArchiver.java and now TestMojo.java)

      if (reportsDir == null) {
         // if test mojo doesn't have such config value, still almost all
         // default to target/surefire-reports
         reportsDir = new File(pom.getBasedir(),
               pom.getBuild().getDirectory()+File.separator+"surefire-reports");
         return true;
      }
      

      The code was moved between files during the fix but was not altered. It looks like the maven-android-plugin code is now falling through to that
      and exposing a bug in the old code.

      Basically pom.getBuild().getDirectory() returns a full path to the build directory and not just the bare directory name (usually "target").
      See http://stackoverflow.com/questions/9318935/get-project-build-directory-from-mavenproject

      I have tested a proposed fix (pull request coming soon) and it works in my environment.

            oldelvet Richard Mortimer
            oldelvet Richard Mortimer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: