3

We have projects where we use jacoco to aggregate code coverage over several modules. We also have some project that use the Fabric8 docker-maven-plugin to run black box test. But for the first time we would now like to run them both i the same project. And it kind of works but not in the same maven command.

We can run mvn test and then jacoco does it job perfecly. we can run mvn install -Djacoco.skip=true and the black box tests start the necessary docker-containers and run the tests on them.

But running mvn install and thus saying that both blackbox-tests and jacoco codecoverage should run will fail saying that jacoco doesn't find dependencies in a central repository (where they are not supposed to be anyway).

So, my question, what could docker-maven-plugin do to interfere with jacoco? It seems like docker-maven-plugin deletes stuff that jacoco expect to be there.

My configuration for jacoco is using the invoker-plugin (as many of the guides for multi module exampels for jacoco does) with localRepositoryPath, could it be colliding? Or do docker-maven-plugin clean the workspace? Se plugin-definition below.

<plugin>
    <!-- To run with different Maven versions use -Dinvoker.mavenHome -->
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-invoker-plugin</artifactId>
    <version>1.5</version>
    <configuration>
      <skipInvocation>${skipTests}</skipInvocation>
      <projectsDirectory>it</projectsDirectory>
      <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
      <pomIncludes>
        <pomInclude>*/pom.xml</pomInclude>
      </pomIncludes>
      <postBuildHookScript>verify</postBuildHookScript>
      <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
      <goals>
        <goal>clean</goal>
        <goal>install</goal>
      </goals>
      <settingsFile>it/settings.xml</settingsFile>
      <extraArtifacts>
        <extraArtifact>org.jacoco:org.jacoco.agent:0.8.3:jar:runtime</extraArtifact>
      </extraArtifacts>
    </configuration>
    <executions>
      <execution>
        <goals>
          <goal>install</goal>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
Roland
  • 5,328
  • 10
  • 37
  • 55
  • is it possible for you to paste the configuration for invoker plugin? – Mahesh_Loya Oct 25 '20 at 03:50
  • @Mahesh_Loya Sorry for the delay, I add the bounty again. The xml is added. – Roland Nov 11 '20 at 09:57
  • Is there a reason why you are using such an old version of maven-invoker-plugin? Version 1.5 is from 2009 ? Furthermore why is the jacoco version also an old version? What kind of project are you using? Implementing a plugin? What is the intention of using invoker plugin? – khmarbaise Nov 16 '20 at 10:22
  • @khmarbaise The project is old and we are on a goverment agency with, well lets say less than flexible way to change dependencies. I'm not sure why the invoker-plugin is needed, is was used in the example I was following, and it worked. There was a pain to get Jacoco to aggregate the coverage over multipl modules until I found a solution that worked. And then I was kind of tired and fed up with Jacoco so I didn't ask any questions why it worked. – Roland Nov 16 '20 at 13:32
  • this may help https://github.com/fabric8io/docker-maven-plugin/issues/717#issuecomment-280591612 – Rob Evans Nov 17 '20 at 19:35

0 Answers0