Apache Tomcat Maven Plugin
  1. Apache Tomcat Maven Plugin
  2. MTOMCAT-208

JaCoCo instrumentation errors when running StandaloneWarMojo

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: tomcat7
    • Labels:
      None

      Description

      We've run into issues with using the plugin with jacoco for code coverage getting instrumentation errors on classes (saying they've already been instrumented). We found that this was due to how the exec-war and standalone-war goals work because they fork and start a new package phase (at least from what I've read that's what they're doing), so it's getting executed twice and the second time when it tries to instrument the classes it gets the errors. I found this doesn't occur with the exec-war-only goal, so I updated the StandaloneWarMojo class to not have the @Execute(phase = LifeCyclePhase.PACKAGE) annotation on it and that appeared to resolve the issue. Not sure if it would make more sense to add another goal such as 'standalone-war-only' and keep the existing standalone-war or not.

      1. StandaloneWarMojo.java.patch
        0.8 kB
        Tim Astle
      2. tomcat-maven-plugin.patch
        3 kB
        Tim Astle

        Activity

        Hide
        Tim Astle added a comment -

        If anyone has any suggestions on the best way to approach this, let me know. We're willing to put some time into fixing this. Ideally we'd like to get this into the 2.1 release.

        Show
        Tim Astle added a comment - If anyone has any suggestions on the best way to approach this, let me know. We're willing to put some time into fixing this. Ideally we'd like to get this into the 2.1 release.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        standalone-war-only sounds a better approach for me.
        The current one fork a lifecycle which is correct for when you use: mvn tomcat7:standalone-war
        Can you provide a patch ? (for both tomcat 6 and 7)
        Thanks

        Show
        Olivier Lamy (*$^¨%`£) added a comment - standalone-war-only sounds a better approach for me. The current one fork a lifecycle which is correct for when you use: mvn tomcat7:standalone-war Can you provide a patch ? (for both tomcat 6 and 7) Thanks
        Hide
        Tim Astle added a comment -

        This patch creates a new StandaloneWarOnlyMojo.java class and fixes a typo in the root README.txt.

        Pretty sure this is all we need, but I'll have my colleague at work verify since I'm out of the office tomorrow.

        Show
        Tim Astle added a comment - This patch creates a new StandaloneWarOnlyMojo.java class and fixes a typo in the root README.txt. Pretty sure this is all we need, but I'll have my colleague at work verify since I'm out of the office tomorrow.
        Hide
        Tim Astle added a comment -

        btw, what has to be updated in the tomcat6-maven-plugin? I think this is tomcat7-maven-plugin specific. If I missed something, let me know.

        Show
        Tim Astle added a comment - btw, what has to be updated in the tomcat6-maven-plugin? I think this is tomcat7-maven-plugin specific. If I missed something, let me know.
        Hide
        Richard added a comment -

        This should only affect the tomcat7-maven-plugin, I don't think tomcat6 supports embedding.

        Show
        Richard added a comment - This should only affect the tomcat7-maven-plugin, I don't think tomcat6 supports embedding.
        Hide
        Tim Astle added a comment -

        Richard, did you confirm that the patch works for you?

        Show
        Tim Astle added a comment - Richard , did you confirm that the patch works for you?
        Hide
        Richard added a comment -

        Yeah, I tested it out and it's working properly.

        Show
        Richard added a comment - Yeah, I tested it out and it's working properly.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        patch applied.
        Thanks !

        Show
        Olivier Lamy (*$^¨%`£) added a comment - patch applied. Thanks !
        Hide
        Tim Astle added a comment -

        And many thanks to you Olivier for applying this so quickly! Cheers!

        Show
        Tim Astle added a comment - And many thanks to you Olivier for applying this so quickly! Cheers!
        Hide
        Hudson added a comment -

        Integrated in TomcatMavenPlugin-mvn3.x #240 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/240/)
        MTOMCAT-208 JaCoCo instrumentation errors when running StandaloneWarMojo
        Submitted by Tim Astle. (Revision 1447735)

        Result = SUCCESS
        olamy : http://svn.apache.org/viewvc/?view=rev&rev=1447735
        Files :

        • /tomcat/maven-plugin/trunk/README.txt
        Show
        Hudson added a comment - Integrated in TomcatMavenPlugin-mvn3.x #240 (See https://builds.apache.org/job/TomcatMavenPlugin-mvn3.x/240/ ) MTOMCAT-208 JaCoCo instrumentation errors when running StandaloneWarMojo Submitted by Tim Astle. (Revision 1447735) Result = SUCCESS olamy : http://svn.apache.org/viewvc/?view=rev&rev=1447735 Files : /tomcat/maven-plugin/trunk/README.txt

          People

          • Assignee:
            Olivier Lamy (*$^¨%`£)
            Reporter:
            Tim Astle
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development