Unable to use clover in multi module project in maven 2.1.0 and option -am -pl

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 2.6.2
    • Affects Version/s: 2.5
    • Component/s: None
    • None

      I tried to use clover with multi module project with maven 2.1.0

      However I have a problem because the clover database is not correctly aggregated with all the project. I attached the zip file of a dummy project as a test case. This is inspired by the multi module project you use in your repository.

      There is 4 jars project :

      jar1
      jar2
      groupOfJars1 > jar3
      groupOfJars1 > jar4

      and one war depending on all jars.

      My goal is to create a war with instrumented code so that I can provide a war "code coverage ready" to our QA.

      If I try this command :

      mvn clean clover2:setup clover2:aggregate -Dmaven.test.skip -o
      
      ....
      
      [INFO] Scanning for projects...
      [INFO] Reactor build order:
      [INFO]   Maven Clover Plugin Multiproject Sample
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 1
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 2
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 3
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 4
      [INFO]   Maven Clover Plugin Multiproject Group Of Jar - PARENT 1
      
      ....
      
      [INFO] Building Maven Clover Plugin Multiproject Sample
      [INFO]    task-segment: [clover2:aggregate] (aggregator-style)
      [INFO] ------------------------------------------------------------------------
      [INFO] [clover2:aggregate]
      [INFO] No 'maven.clover.licenseLocation' configured. Using default evaluation license.
      Merging database 1 of 4: D:\Developpement\checkout\cloverMPExported\cloverMp\groupOfJars1\jar4\target\clover\clover.db
      Merging database 2 of 4: D:\Developpement\checkout\cloverMPExported\cloverMp\groupOfJars1\jar3\target\clover\clover.db
      Merging database 3 of 4: D:\Developpement\checkout\cloverMPExported\cloverMp\jar2\target\clover\clover.db
      Merging database 4 of 4: D:\Developpement\checkout\cloverMPExported\cloverMp\jar1\target\clover\clover.db
      Writing merged database registry
      Merge complete
      
      [INFO]   Maven Clover Plugin Multiproject Sample - WAR 1
      

      The merge is ok.

      However in my real life project, I would like to use this command instead :

      mvn clean clover2:setup clover2:aggregate -Dmaven.test.skip -o -am -pl war1
      

      Because I have many wars created in my reactor and I don't want to have a clover database with all the jars even the unused jars for war1.

      and the result is :

      [INFO] Scanning for projects...
      [INFO] Reactor build order:
      [INFO]   Maven Clover Plugin Multiproject Sample
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 1
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 2
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 3
      [INFO]   Maven Clover Plugin Multiproject Sample - JAR 4
      [INFO]   Maven Clover Plugin Multiproject Sample - WAR 1
      
      .... 
      
      [INFO] Building Maven Clover Plugin Multiproject Sample
      [INFO]    task-segment: [clover2:aggregate] (aggregator-style)
      [INFO] ------------------------------------------------------------------------
      [INFO] [clover2:aggregate]
      [INFO] No 'maven.clover.licenseLocation' configured. Using default evaluation license.
      Merging database 1 of 2: D:\Developpement\checkout\cloverMPExported\cloverMp\jar2\target\clover\clover.db
      Merging database 2 of 2: D:\Developpement\checkout\cloverMPExported\cloverMp\jar1\target\clover\clover.db
      Writing merged database registry
      Merge complete
      

      This time, the merge is not ok as I don't have the jar3 and jar4 merged with the others.

      If I modify the pom.xml

          <modules>
              <module>jar1</module>
              <module>jar2</module>
      		<module>groupOfJars1</module>
              <module>war1</module>
          </modules>
      

      to

          <modules>
              <module>jar1</module>
              <module>jar2</module>
      		<module>groupOfJars1/jar3</module>
      		<module>groupOfJars1/jar4</module>
              <module>war1</module>
          </modules>
      

      it works again, but it is not equivalent for me.

              Assignee:
              Nick
              Reporter:
              hugo lassiege
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: