mojohaus / cobertura-maven-plugin

Cobertura Maven Plugin
https://www.mojohaus.org/cobertura-maven-plugin/
25 stars 20 forks source link

Cobertura does not include into coverage report classes which have interface import from java.util.stream #29

Open MEZk opened 7 years ago

MEZk commented 7 years ago

Based on https://github.com/mojohaus/cobertura-maven-plugin/issues/21#issuecomment-281437726 and https://github.com/mojohaus/cobertura-maven-plugin/issues/18

Main.java

import java.util.stream.Stream;
public class Main {
    public static void main(String[] args) {
        Stream.of("a", "b");
    }
}

MainTest.java

import org.junit.Test;

public class MainTest {
    @Test
    public void testMain() {
    }
}

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>
</dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
</project>

CMD: mvn clean cobertura:cobertura Expected result: class Main is included into coverage report (0% coverage) Actual result: class Main is not included into coverage report (report is empty)

jaypatel512 commented 4 years ago

Seeing the same issue here. Preventing us from successfully migrating to newer version of Java language.