Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-13208

Improve Automatic Clover integration for multi-module maven builds


    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Currently, it's planned to deliver the feature in two steps:

      • Bamboo 5.8 - changes in Bamboo Clover Plugin UI
      • Bamboo 5.9 - enabling this feature by upgrading dependency to Clover 4.0.3+

      A build can fail during test execution in case when Automatic Clover integration is used and the project is a Maven project with multiple modules having dependencies between each other.



      Maven goal is called: clean test. Compilation order will be:

      MasterModule clean
      MasterModule test
      ModuleB clean
      ModuleB test
      ModuleB jar <-- JAR is created
      ModuleA clean
      ModuleA test  <-- using ModuleB.jar in classpath 

      What happens when Automatic Clover integration is enabled? Goals are enhanced as follows: clean test clean clover2:setup verify clover2:aggregate clover2:clover. What happens? A compilation is as follows:

      ModuleB clean
      ModuleB test
      ModuleB clean
      ModuleB clover2:setup
      ModuleB verify
      ModuleB jar <-- JAR is created with instrumented classes!
      ModuleA clean
      ModuleA test  <-- using ModuleB.jar in classpath with instrumented classes, but we're before clover2:setup so clover.jar artifact is not available, build fails
      //expected to have ModuleA clover2:setup verify ...

      Issue affects all Bamboo versions.

      Possible improvement:

      1) Analyze which goals are defined in Maven task. Next add Clover goals in between:

      • add "clover2:setup" after the "clean" (if present) and before other goals
        • but "jaxb2:generate clover2:setup"
        • but "wsdl2java clover2:setup"
      • what to do in case when "install" or "deploy" phase is declared? deploying instrumented JARs shall be avoided in general
        • write help for "automatically integrate clover" radio button?
        • write warning in UI if such goals are found?
        • write warning in a build log if such goals are found?
      • add "clover2:aggregate clover2:clover" after all goals

      2) Alternatively, call Clover first and clean everything after Clover finishes, e.g. something like:

      mvn clean clover2:setup verify clover2:clover clean <original goals>

      but this causes a problem that all Clover reports will be wiped out after last clean. They'd have to be stored somewhere.

      3) Alternatively, we could add an extra Maven task at the end of the Job with would run "clean" + Clover goals. But this would change build configuration.

            mparfianowicz Marek Parfianowicz
            mparfianowicz Marek Parfianowicz
            1 Vote for this issue
            4 Start watching this issue