how do I make mvn cobertura:cobertura not run more tests than mvn test

139 views Asked by At

I'm working on a project that uses the CEF DSS library to handle digital signatures. This library comes with a large test suite, which obviously we're not interested in and thus it isn't run on mvn test.

We wanted to create code coverage reports for our test suite, as part of a push to increase test coverage, and my first try there was to run mvn cobertura:cobertura to get a cobertura report. However, for some reason, this now runs the full test suite of the CEF DSS component, which is not something I'm interested in.

Why does this happen? How can I avoid it?

1

There are 1 answers

0
Gerold Broser On

See cobertura:cobertura:

Description:

Instrument the compiled classes, run the unit tests and generate a Cobertura report.

Attributes:

  • ...
  • Invokes the execution of the lifecycle phase test prior to executing itself.

There is no optional parameter to skip this.

But, you use this library with:

    <dependencyManagement>
        <dependencies>
            <!-- DSS -->
            <dependency>
                <groupId>eu.europa.ec.joinup.sd-dss</groupId>
                <artifactId>dss-...</artifactId>
                <version>${dss.version}</version>
            ...

The test phase usually runs test code in your project's src/test/java directory. I can't comprehend (yet) why the library's tests are performed.

BTW:

  • If you configure a dependency in <dependencyManagement>, e.g. with <exclusions>, you don't have to repeat that configuration when actually using it (in your child projects' POMs). That's what <dependencyManagement> is for. :)
  • <dependency><scope>compile is the default. You don't have to declare it explicitely (in signandvalidation-ws' POM).