Skip to content
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

Coverage report is generating for a springboot + maven project, but there is an NPE #701

Open
Ruhshan opened this issue Nov 2, 2024 · 1 comment · Fixed by #702
Open
Assignees
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch

Comments

@Ruhshan
Copy link

Ruhshan commented Nov 2, 2024

Hello,

I have just added kover with my spring boot project. I can run tests and also generate coverage reports. But there is this NPE:

img

Though the coverage is generated. Can you please tell me I'm doing something wrong? Or what could resolve this.

Here is a minimal project that generates this issue:

https://github.com/Ruhshan/springboot-maven-kt

@Ruhshan Ruhshan added Question Support request issue type S: untriaged Status: issue reported but unprocessed labels Nov 2, 2024
@shanshin
Copy link
Collaborator

shanshin commented Nov 4, 2024

Hi,
thanks for the report and the reproducer!

To workaround this bug you may add empty sourceDirs element to the kotlin-maven-plugin configuration.
Like

            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <configuration>
                    <args>
                        <arg>-Xjsr305=strict</arg>
                    </args>
                    <compilerPlugins>
                        <plugin>spring</plugin>
                    </compilerPlugins>
                    <sourceDirs></sourceDirs> <!-- fix Kover NPE -->
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.jetbrains.kotlin</groupId>
                        <artifactId>kotlin-maven-allopen</artifactId>
                        <version>${kotlin.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

shanshin added a commit that referenced this issue Nov 4, 2024
When a configuration is specified in the execution for the `compile` target, but the `sourceDirs` child element is missing, an error occurred.
A check has been added to fix the error.

Fixes #701
@shanshin shanshin added S: in progress Status: implementing or design in process and removed S: untriaged Status: issue reported but unprocessed labels Nov 4, 2024
@shanshin shanshin reopened this Nov 8, 2024
@shanshin shanshin added S: ready for release Status: merged in the main branch Bug Bug issue type and removed S: in progress Status: implementing or design in process Question Support request issue type labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants