Jacoco report jeneration failed when i added <argLine> property to surefire plugin configuration [duplicate]
Asked Answered
T

1

0

I am working on some old old code to fix the Junits, While doing this I am facing a problem.

Previously in pom.xml there was a plugin configuration like below

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkMode combine.self="override">pertest</forkMode>
                </configuration>
            </plugin>

with above configuration i can able to see the jacoco coverage file in /target/site folder after mvn testbuilt successfully

But to fix some junits i had add one argLine to above configuration like below

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <forkMode combine.self="override">pertest</forkMode>
                <argLine>-Djava.security.egd=file:/dev/./urandom</argLine>
            </configuration>
        </plugin>

After adding this i am not seeing any coverage file in target directory after mvn test . Can anybody tell why?

Tuxedo answered 22/4, 2020 at 17:52 Comment(0)
A
1

I assume your pom.xml also contains some jacoco-maven-plugin configuration?

The plugin uses the argLine property to pass the jacoco agent to both surefire and failsafe plugin. If you add your own to the surefire plugin you overwrite those created by the jacoco plugin in the prepare-agent goals.

The docs describe some alternatives how to solve it.

(Either use the argLine as property or use the late evaluation syntax)

If you feel experimental, the property name used to set the jacoco options can be configured, see propertyName config. So you could add that property to the surefire parameter as well. But the two options above should be simpler.

Alternate answered 22/4, 2020 at 20:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.