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

surefire-reports not detected for android-maven-plugin

    • 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.

          [JENKINS-16776] surefire-reports not detected for android-maven-plugin

          Richard Mortimer added a comment - See pull request https://github.com/jenkinsci/jenkins/pull/704

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          changelog.html
          maven-plugin/src/main/java/hudson/maven/reporters/TestMojo.java
          maven-plugin/src/test/java/hudson/maven/reporters/TestMojoTest.java
          http://jenkins-ci.org/commit/jenkins/981366696199a73980fcc9218b93afe15faad189
          Log:
          [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: changelog.html maven-plugin/src/main/java/hudson/maven/reporters/TestMojo.java maven-plugin/src/test/java/hudson/maven/reporters/TestMojoTest.java http://jenkins-ci.org/commit/jenkins/981366696199a73980fcc9218b93afe15faad189 Log: [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin

          Code changed in jenkins
          User: Christoph Kutzinski
          Path:
          changelog.html
          maven-plugin/src/main/java/hudson/maven/reporters/TestMojo.java
          maven-plugin/src/test/java/hudson/maven/reporters/TestMojoTest.java
          http://jenkins-ci.org/commit/jenkins/1d3521c73cbcea86e1ea0acc1215861bd4c87070
          Log:
          Merge pull request #704 from oldelvet/jenkins-16776

          [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin

          Compare: https://github.com/jenkinsci/jenkins/compare/adeed34c6c56...1d3521c73cbc


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Christoph Kutzinski Path: changelog.html maven-plugin/src/main/java/hudson/maven/reporters/TestMojo.java maven-plugin/src/test/java/hudson/maven/reporters/TestMojoTest.java http://jenkins-ci.org/commit/jenkins/1d3521c73cbcea86e1ea0acc1215861bd4c87070 Log: Merge pull request #704 from oldelvet/jenkins-16776 [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin Compare: https://github.com/jenkinsci/jenkins/compare/adeed34c6c56...1d3521c73cbc – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          kutzi added a comment -

          I still struggle to understand why it used to work before my refactoring. Can you explain why?

          kutzi added a comment - I still struggle to understand why it used to work before my refactoring. Can you explain why?

          I didn't look into that too deeply. I can only assume that somehow reportsDirectory is set for android-maven-plugin (although I can't find it in my copy of the source - which is about 6 months old) and hence it never fell through to the fallback mechanism.

          That seems to just have been luck because the code does hardcode the output as follows in AbstractInstrumentationMojo.java

          String directory =  new StringBuilder()
                  .append(project.getBuild().getDirectory())
                  .append("/surefire-reports")
                  .toString();
          

          Richard Mortimer added a comment - I didn't look into that too deeply. I can only assume that somehow reportsDirectory is set for android-maven-plugin (although I can't find it in my copy of the source - which is about 6 months old) and hence it never fell through to the fallback mechanism. That seems to just have been luck because the code does hardcode the output as follows in AbstractInstrumentationMojo.java String directory = new StringBuilder() .append(project.getBuild().getDirectory()) .append( "/surefire-reports" ) .toString();

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2267

          Result = SUCCESS

          dogfood added a comment - Integrated in jenkins_main_trunk #2267 Result = SUCCESS

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          src/main/java/hudson/maven/reporters/TestMojo.java
          src/test/java/hudson/maven/reporters/TestMojoTest.java
          http://jenkins-ci.org/commit/maven-plugin/cd8ae4e07188439732c1be0e951a3b2c69ca81fe
          Log:
          [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin

          Originally-Committed-As: 981366696199a73980fcc9218b93afe15faad189

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: src/main/java/hudson/maven/reporters/TestMojo.java src/test/java/hudson/maven/reporters/TestMojoTest.java http://jenkins-ci.org/commit/maven-plugin/cd8ae4e07188439732c1be0e951a3b2c69ca81fe Log: [FIXED JENKINS-16776] surefire-reports not detected for android-maven-plugin Originally-Committed-As: 981366696199a73980fcc9218b93afe15faad189

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

              Created:
              Updated:
              Resolved: