Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Grzegorz Slowikowski
    @gslowikowski
    Hi @JJWTimmer . Can you open an issue and provide test project (or at least Maven execution log with debug info)?
    Jasper Timmer
    @JJWTimmer
    @gslowikowski I'm trying to get everything to work together nicely with https://github.com/Sagacify/sonar-scala. The example on https://github.com/Sagacify/sonar-scala/blob/master/samples/maven/combined-scala-java-multi-module-sonar/pom.xml shows I have to add 2 execution blocks to the scoverage-maven-plugin, is this still necessary with the latest version? It exits successfully if I remove the executions block from the plugin and update to the latest version.
    Jasper Timmer
    @JJWTimmer
    do I miss stuff when I remove executions or is that fine?
    Grzegorz Slowikowski
    @gslowikowski
    @JJWTimmer sorry for not responding for so long, that example you cited should not work at all, pre-compile and post-compile goals should not be called explicitely. They are (and must be) be called in the context of forked scoverage lifecycle.
    Did you manage to generate proper scoverage reports?
    Joaquin Perez
    @jperez-dx
    Hi, I have a question about this plugin. Currently I have the scala compile and scala test plugins in my build, and then I have a profile called coverage that I use in my jenkins builds by doing -Pcoverage. When I run the build without that flag the compile and test goals are excecuted once, but when I use that flag they are excecuted twice. This makes sense, since the check goal is supposed to compile the classes and run the tests. But if I use check-only I get Cannot perform check, instrumentation not performed - skipping. Is there a way to compile and run the tests only once and make the report only when the -Pcoverage flag is set?
    Joaquin Perez
    @jperez-dx
    I currently have this:
    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.scoverage</groupId>
            <artifactId>scoverage-maven-plugin</artifactId>
            <version>${scoverage.plugin.version}</version>
            <configuration>
              <minimumCoverage>${min.code.coverage}</minimumCoverage>
              <failOnMinimumCoverage>${fail.on.code.coverage.check}</failOnMinimumCoverage>
              <scalaVersion>${scala.version}</scalaVersion>
              <highlighting>true</highlighting>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    I could change the goals to this:

                <goals>
                  <goal>pre-compile</goal>
                  <goal>post-compile</goal>
                  <goal>check-only</goal>
                </goals>

    Would that work?

    Grzegorz Slowikowski
    @gslowikowski
    Hi @jperez-dx
    Grzegorz Slowikowski
    @gslowikowski
    This plugin was designed to fork a separate build cycle (like cobertura-maven-plugin) plus additional trick with changing class files location from classes to scoverage-classes and back. This successfully avoids unintentional building and deployment of artifact containing instrumented classes.
    Changing classes location (for all modules in multimodule project, this is important) is performed in pre-compile goal. Changing back in all goals forking scoverage cycle: check, report, package.
    Your idea with calling [pre|post]-compile and [check|report]-only goals probably will work in single-module project. It will not in multi-module one.
    If you want to compile and test exactly once, you should call mvn scoverage:check instead of adding and execution to the build inpom.xmlfile.
    Joaquin Perez
    @jperez-dx
    Ok, I get it
    What would be the problem of building an artifact with the instrumented classes?
    Grzegorz Slowikowski
    @gslowikowski
    It needs scoverage-maven-runtime dependency in the classpath in the runtime and writes coverage data to the disk when used, just like during tests.
    You can build it, but you shouldn't deploy it.
    Joaquin Perez
    @jperez-dx
    Ok. But I still need to put the plugin somewhere in the pom to be able to do mvn scoverage:check, right? Where should it be?
    Grzegorz Slowikowski
    @gslowikowski
    Just the configuration, without executions.
    Joaquin Perez
    @jperez-dx
    :+1:
    Thanks!
    Grzegorz Slowikowski
    @gslowikowski
    I saw misconfigured poms whe scoverage lifecycle was forked from another scoverage lifecycle :)
    and there were classes, scoverage-classes and scoverage-scoverage-classes directories :)
    Joaquin Perez
    @jperez-dx
    Yeah, we were running everything twice. Builds were taking forever.
    Grzegorz Slowikowski
    @gslowikowski
    How big is your project?
    Joaquin Perez
    @jperez-dx
    Pretty big. 10k lines
    for doing check + report is mvn scoverage:check:report ok?
    Grzegorz Slowikowski
    @gslowikowski
    no, mvn scoverage:check scoverage:report-only or mvn scoverage:report scoverage:check-only
    Joaquin Perez
    @jperez-dx
    great, thanks!
    Grzegorz Slowikowski
    @gslowikowski
    The -only goals are to avoid double build if you need both check and report functionalities.
    Joaquin Perez
    @jperez-dx
    :+1:
    Thanks, you were very helpful
    @mgurmendez FYI :point_up_2:
    vijendra singh
    @viju0731_twitter
    Hi how to use scoverage maven plugin
    if any step wise integration guide
    any help
    J0c034j
    @J0c034j

    @J0c034j
    Hi...I am trying to generate code coverage report for my scala code with maven build...I am not able to generate the report file.
    I added following in my pom.xml

    <plugin>
    <groupId>org.scoverage</groupId>
    <artifactId>scoverage-maven-plugin</artifactId>
    <version>1.3.0</version>
    <executions>
    <execution>
    <phase>test</phase>
    <goals>
    <goal>report</goal>
    </goals>
    </execution>
    </executions></plugin>
    In build/plugins
    and

    <reporting>

    <plugins>

    <plugin>

    <groupId>org.scoverage</groupId>

    <artifactId>scoverage-maven-plugin</artifactId>

    <version>1.3.0</version>

    <reportSets>

    <reportSet>

    <reports>

    <report>report</report>
    </reports>
    </reportSet>
    </reportSets>
    </plugin>
    </plugins>
    </reporting>
    in reporting/plugins
    Run the command 'mvn scoverage:report'
    Build is successful but getting message 'Skipping scoverage report generation'
    [INFO]
    [INFO] <<< scoverage-maven-plugin:1.3.0:report (default-cli) < [scoverage]test @ GifRealtimeAnalytics <<<
    [INFO]
    [INFO]
    [INFO] --- scoverage-maven-plugin:1.3.0:report (default-cli) @ GifRealtimeAnalytics ---
    [INFO] Skipping SCoverage report generation
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    Could anyone please help?
    --Jaya.

    Grzegorz Slowikowski
    @gslowikowski
    Hi @J0c034j
    Remove executions and the whole reporting section, you don't need them if you are calling mvn scoverage:report. What is your project's packaging?
    J0c034j
    @J0c034j
    Removed executions and reporting section...still no report generation. The project's packaging is jar.
    Grzegorz Slowikowski
    @gslowikowski
    OK, paste Maven output from mvn scoverage:report here or send it to me directly (you will find email address in my Github profile)
    J0c034j
    @J0c034j
    [INFO] Scanning for projects...
    [WARNING]
    [WARNING] Some problems were encountered while building the effective model for GifDruid:GifRealtimeAnalytics:jar:0.0.1-SNAPSHOT
    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.scala-lang:scala-reflect:jar -> version 2.11.8 vs 2.12.0-M4 @ line 199, column 15
    [WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-scala-plugin is missing. @ line 18, column 12
    [WARNING]
    [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
    [WARNING]
    [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
    [WARNING]
    [INFO]
    [INFO] -------------------< GifDruid:GifRealtimeAnalytics >--------------------
    [INFO] Building spark 0.0.1-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO]
    [INFO] >>> scoverage-maven-plugin:1.3.0:report (default-cli) > [scoverage]test @ GifRealtimeAnalytics >>>
    [WARNING] The POM for org.apache.hadoop:hadoop-client:jar:2.2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for org.roaringbitmap:RoaringBitmap:jar:0.5.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
    [INFO]
    [INFO] --- scoverage-maven-plugin:1.3.0:pre-compile (default-cli) @ GifRealtimeAnalytics ---
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ GifRealtimeAnalytics ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 3 resources
    [INFO]
    [INFO] --- maven-scala-plugin:2.15.2:compile (default) @ GifRealtimeAnalytics ---
    [INFO] Checking for multiple versions of scala
    [WARNING] Invalid POM for org.apache.hadoop:hadoop-client:jar:2.2.0, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] Invalid POM for org.roaringbitmap:RoaringBitmap:jar:0.5.11, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] Invalid POM for org.apache.hadoop:hadoop-client:jar:2.2.0, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] Invalid POM for org.roaringbitmap:RoaringBitmap:jar:0.5.11, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] Invalid POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.0, transitive dependencies (if any) will not be available, enable debug logging for more details
    [WARNING] Expected all dependencies to require Scala version: 2.11.8
    [WARNING] com.twitter:chill_2.11:0.8.0 requires scala version: 2.11.7
    [WARNING] Multiple versions of scala libraries detected!
    [INFO] includes = [/*.java,/.scala,]
    [INFO] excludes = []
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ GifRealtimeAnalytics ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-scala-plugin:2.15.2:compile (compile) @ GifRealtimeAnalytics ---
    [INFO] Checking for multiple versions of scala
    [WARNING] Expected all dependencies to require Scala version: 2.11.8
    [WARNING] com.twitter:chill_2.11:0.8.0 requires scala version: 2.11.7
    [WARNING] Multiple versions of scala libraries detected!
    [INFO] includes = [**/
    .java,*/.scala,]
    [INFO] excludes = []
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- scoverage-maven-plugin:1.3.0:post-compile (default-cli) @ GifRealtimeAnalytics ---
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ GifRealtimeAnalytics ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-te
    @gslowikowski sent you over email.
    Grzegorz Slowikowski
    @gslowikowski

    You need to upgrade Scala Maven plugin version to at least 3.0.0 - read https://github.com/scoverage/scoverage-maven-plugin/#prerequisities--limitations.

    Additionally I see several strange warnings:

    [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.scala-lang:scala-reflect:jar -> version 2.11.8 vs 2.12.0-M4 @ line 199, column 15

    and

    [WARNING] The POM for XXX is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

    You probably didn't set the version of scala maven plugin:

    [WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-scala-plugin is missing. @ line 18, column 12

    BTW, groupId and artifactId of the plugin was changed in version 3.0.0 (http://repo1.maven.org/maven2/net/alchim31/maven/scala-maven-plugin/)

    Ivan
    @renardeinside

    Hi everyone. We are trying to use scoverage-maven-plugin, and we found a strange bug there - when we run mvn -B clean package with this setup:

      <build>
        <plugins>
          <plugin>
            <groupId>org.scoverage</groupId>
            <artifactId>scoverage-maven-plugin</artifactId>
            <version>${scoverage.plugin.version}</version>
            <configuration>
              <aggregate>true</aggregate>
            </configuration>
            <executions>
              <execution>
                <id>scoverage-report</id>
                <phase>package</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    It runs the tests twice - once during the compilation stage, and once during the report stage. Are there any options to fix this and execute tests only once?

    Grzegorz Slowikowski
    @gslowikowski
    Hi @renardeinside
    It's not a bug. It works this way. There is a way to run tests only once - described here https://github.com/scoverage/scoverage-maven-plugin/#checking-minimum-test-coverage-level-automatically
    You have to use version 1.4.0-RC1
    Ivan
    @renardeinside
    Hi @gslowikowski , thanks a lot for the instruction - now it works like a charm!
    munigoti
    @munigoti
    Hi All, I am new to scoverage and need to clarify few questions. I am trying to run scoverage on spark application. Wanted to clarify, is it mandatory to have tests to generate scoverage report? When will scovereage report gets generated build / run time? If I submit my spark application to a Spark cluster, where will the coverage report gets generated?
    munigoti
    @munigoti
    Hi All, I have 2 jars and using few methods of 1st jar in 2nd jar. When I try to run scoverage of 2nd jar, it does not show me coverage of 1st jar. Can anyone let me know how to see coverage of all jars?
    mayank-mahajan-guavus
    @mayank-mahajan-guavus
    Hi all
    I am trying to evaluate scoverage tool to get code-coverage that is triggered by my python scripts.. is this support available.
    i am ok to inject this tool as javaagent and get the report out of it.
    please help