Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    vijendra singh
    @viju0731_twitter
    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 Trusov
    @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 Trusov
    @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
    Azimboy
    @Azimboy
    Hi everyone!
    Azimboy
    @Azimboy

    I'm using scoverage in Maven with a parallel build, this will lead to Maven warning about threadsafety:

    [WARNING] The following plugins are not marked @threadSafe in quality-of-service:
    [WARNING] org.scoverage:scoverage-maven-plugin:1.4.0-RC1
    [WARNING] Enable debug to see more precisely which goals are not marked @threadSafe.
    [WARNING] *
    [WARNING] contains the following plugin(s) that have goals not marked
    [WARNING] as @threadSafe to support parallel building.
    [WARNING] While this /may/ work fine, please look for plugin updates
    [WARNING] and/or request plugins be made thread-safe.
    [WARNING] If reporting an issue, report it against the plugin in
    [WARNING] question, not against maven-core
    [WARNING] *
    [WARNING] The following plugins are not marked @threadSafe in commons:
    [WARNING] org.scoverage:scoverage-maven-plugin:1.4.0-RC1
    [WARNING] Enable debug to see more precisely which goals are not marked @threadSafe.
    [WARNING] *

    Have you experimented this in multithreaded build?

    Grzegorz Slowikowski
    @gslowikowski
    Version 1.4.0 was released. Sorry for delay.
    @Azimboy, no, I didn't test multithreaded build.
    @mayank-mahajan-guavus, Scala classes must be compiled with Scoverage plugin enabled. It's not important, how they are called/executed. If you need more precise answer, provide example project.
    Mostafa Mahmoud
    @moustafaalaa

    Hi everyone!

    I have the below maven config

    <scoverage-plugin-version>1.4.1</scoverage-plugin-version>
     <skipTests>true</skipTests><!-- Skip Scala Unit Tests -->
      <!-- Maven scala coverage plugin -->
                <plugin>
                    <groupId>org.scoverage</groupId>
                    <artifactId>scoverage-maven-plugin</artifactId>
                    <version>${scoverage-plugin-version}</version>
                    <configuration>
                        <highlighting>true</highlighting>
                        <minimumCoverage>80</minimumCoverage>
                        <failOnMinimumCoverage>true</failOnMinimumCoverage>
                        <additionalForkedProjectProperties>skipTests=false</additionalForkedProjectProperties>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

    After running maven clean install site, I got statement coverage 60% and my minimum is 80% however, the build passed.

    [INFO] 
    [INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ ScalaDemoTemplate ---
    [INFO] Tests are skipped.
    [INFO] 
    [INFO] --- scalatest-maven-plugin:2.0.0:test (test) @ ScalaDemoTemplate ---
    Discovery starting.
    Discovery completed in 1 second, 92 milliseconds.
    Run starting. Expected test count is: 1
    MainTest:
    - Test wordCount Function with input string
    Run completed in 1 second, 354 milliseconds.
    Total number of tests run: 1
    Suites: completed 2, aborted 0
    Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
    All tests passed.
    [INFO] 
    [INFO] <<< scoverage-maven-plugin:1.4.1:report < [scoverage]test @ ScalaDemoTemplate <<<
    [INFO] 
    [INFO] '[scoverage]test' forked phase execution for scoverage-maven-plugin:report report preparation done
    [INFO] 1 report configured for scoverage-maven-plugin:1.4.1: report
    [INFO] Statement coverage.: 66.67%
    [INFO] Branch coverage....: 100.00%
    [INFO] Coverage reports completed.
    [INFO] Generating "FindBugs" report      --- findbugs-maven-plugin:3.0.5:findbugs
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS

    My question, How to force the build to fail if the minimumCoverage less than 80%

    mayank-mahajan-guavus
    @mayank-mahajan-guavus
    @gslowikowski thanks for the reply.
    @gslowikowski I m looking to get insight on code coverage not by unit tests but by integration tests written in some other language like python. Test code is present in different repository and it calls apis that invoke scala code deployed as JVM. I am able to get using javaagent for java-codes, but for scala I am yet to be successful. If this can in anyway help me get this info for scala classes, it would be great start for me. Please reply. Thanks in advance.
    Mostafa Mahmoud
    @moustafaalaa
    @moustafaalaa @gslowikowski Do you have any idea why my config has not failed when the minimum coverage less than 80%?
    Grzegorz Slowikowski
    @gslowikowski
    Hi @moustafaalaa . You probably have scoverage in <reporting> section, because I see scoverage:report goal was executed. scoverage:check wasn't executed and only because <phase> wasn't specified and there is no default phase. I see that it's not specified in all configuration snippets in readme file. My bad. <phase> is required.
    @mayank-mahajan-guavus Scoverage instruments class files during compilation. It's similar to Cobertura, but with Cobertura you instrument classes after compilation. You cannot use javaagent like with JaCoCo. Instead, you can build jar using scoverage:package and use this jar for testing.
    Mostafa Mahmoud
    @moustafaalaa
    @gslowikowski Thanks, It works!
    abhisam
    @abhisam
    <build>
            <sourceDirectory>src/main/scala</sourceDirectory>
            <testSourceDirectory>src/test/scala</testSourceDirectory>
            <plugins>
    
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.4.4</version>
                    <executions>
                        <execution>
                            <phase>test-compile</phase>
                            <goals>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <jvmArgs>
                            <jvmArg>-Xms64m</jvmArg>
                            <jvmArg>-Xmx1024m</jvmArg>
                        </jvmArgs>
                    </configuration>
                </plugin>
                <plugin>
            <groupId>org.scoverage</groupId>
            <artifactId>scoverage-maven-plugin</artifactId>
            <version>1.4.0-M5</version>
            <configuration>
              <aggregate>true</aggregate>
            </configuration>
            <executions>
              <execution>
                <id>scoverage-report</id>
                <phase>package</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.6</version>
          </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
    
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    
            </plugins>
        </build>
    </project>
    I couldn't generate HTML report my project.
    would you please help me. what is wrong in this pom file.
    @gslowikowski
    Grzegorz Slowikowski
    @gslowikowski
    Hi @abhisam . You have to execute scala:compile goal in compile phase, not test-compile. Please observe when scoverage:pre-compile and scoverage:post-compile goals are executed. Compilation must happen between them.
    abhisam
    @abhisam
    HI @gslowikowski , I changed test-compile to compile but test cases are not running. do i need to update anything.would you please share sample pom file if you have.
    abhisam
    @abhisam
    @arahuja
    Alfonso Roa
    @alfonsorr
    Hi all!
    I've been experiencing strange behavior with the plugin in the CI workflow, but not in local (how strange) :P, the bad part is that I can't configure the CI workflow, and I don't know the profiles / options that they use.
    The thing is that i have a multimodule project with a structure like the following
    root
    • module-A
    • module-B (depends on A)
    • module-C1 (depends on B)
    • module-C2 (depends on B)
      ...
    • module-Cn (depends on B)
    Alfonso Roa
    @alfonsorr
    but when it runs for the module C1 the coverage report, it tries to download the module B from the nexus, not from local
    i have the plugin configured this way
                <plugin>
                    <groupId>org.scoverage</groupId>
                    <artifactId>scoverage-maven-plugin</artifactId>
                    <version>${scoverage.plugin.version}</version>
                    <executions>
                        <execution>
                            <id>report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <
    i've tried only having it in the parent with aggregate true, without aggreagtion on each module, with and without pluginManagement
    just what options or whatever could be doing this behaviour
    Alfonso Roa
    @alfonsorr
    Thanks for any information
    Alfonso Roa
    @alfonsorr
    I show the issue scoverage/scoverage-maven-plugin#51 , and i have also a test-class of A
    Mostafa Mahmoud
    @moustafaalaa

    Hi,

    I have a question If I need to add some custom rules for project build for example

    • If the number of tests less than 2 let the build fail.
    • If there is any "println" or some special commands.

    Can we use Scoverage for this case?