Skip to content

Java coverage not present in HTML report #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ilmirons opened this issue Jan 26, 2023 · 1 comment
Closed

Java coverage not present in HTML report #108

ilmirons opened this issue Jan 26, 2023 · 1 comment

Comments

@ilmirons
Copy link

ilmirons commented Jan 26, 2023

Hi. I have a project with Java and Scala sources, but scoverage report shows only Scala classes coverage. Here is the layout of the project and a pom.xml snippet. Note that Scala test cover both Java and Scala file. Is this a bug? Is there a way to have my Java coverage rendered in HTML by the plugin?

.
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │       └── example
│   │   │           ├── AnotherFile.java
│   │   │           └── ...
│   │   ├── resources
│   │   └── scala
│   │       └── com
│   │           └── example
│   │             ├──File.scala
│   │             └── ...
│   └── test
│       ├── resources
│       └── scala
│           └── com
│               └── example
│                   ├── FileSpec.scala
│                   └── ...
└── target
    ├── cobertura.xml
    └── ...
<build>
<plugins>
    <!-- ... -->
    <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.10.1</version>
              <configuration>
                  <release>17</release>
              </configuration>
              <executions>
                  <execution>
                      <phase>compile</phase>
                      <goals>
                          <goal>compile</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>
          <plugin>
              <groupId>net.alchim31.maven</groupId>
              <artifactId>scala-maven-plugin</artifactId>
              <version>4.8.0</version>
              <configuration>
                  <scalaVersion>${scala.version}</scalaVersion>
              </configuration>
              <executions>
                  <execution>
                      <id>scala-compile-first</id>
                      <phase>process-resources</phase>
                      <goals>
                          <goal>add-source</goal>
                          <goal>compile</goal>
                      </goals>
                  </execution>
                  <execution>
                      <id>scala-test-compile</id>
                      <phase>process-test-resources</phase>
                      <goals>
                          <goal>testCompile</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>
          <!-- disable surefire -->
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.7</version>
              <configuration>
                  <skipTests>true</skipTests>
              </configuration>
          </plugin>
          <!-- enable scalatest -->
          <plugin>
              <groupId>org.scalatest</groupId>
              <artifactId>scalatest-maven-plugin</artifactId>
              <version>2.2.0</version>
              <configuration>
                  <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                  <junitxml>.</junitxml>
                  <filereports>WDF TestSuite.txt</filereports>
              </configuration>
              <executions>
                  <execution>
                      <id>test</id>
                      <goals>
                          <goal>test</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>
          <plugin>
              <groupId>org.scoverage</groupId>
              <artifactId>scoverage-maven-plugin</artifactId>
              <version>${scoverage.plugin.version}</version>
              <configuration>
                  <scalaVersion>${scala.version}</scalaVersion>
                  <aggregate>true</aggregate>
              </configuration>
          </plugin>
    <!-- ... -->
</plugins>
</build>
<reporting>
        <plugins>
            <plugin>
                <groupId>org.scoverage</groupId>
                <artifactId>scoverage-maven-plugin</artifactId>
                <version>${scoverage.plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>integration-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

Thanks for your work.

@jozic
Copy link
Collaborator

jozic commented Dec 23, 2023

Hi @ilmirons
afaik this plugin instruments only Scala code and it can't get coverage from Java code.
most likely you will need to get coverage for Scala and Java code separately

@jozic jozic closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants