diktat
diktat copied to clipboard
Cannot invoke "java.io.File.toPath()" because the return value of "org.apache.maven.project.MavenProject.getBasedir()" is null
Describe the bug
Installed diktat 2.0 into a multimodule maven project as per the github page. Copied the diktat plugin settings from the multimodule example and changed the version to be 2.0.0 explicitly.
Expected behavior
mvn diktat:check runs and generates data about the project.
Observed behavior
Plugin fails with Cannot invoke "java.io.File.toPath()" because the return value of "org.apache.maven.project.MavenProject.getBasedir()" is null
Steps to Reproduce
I have a multimodule project with kotlin already configured. I went to the top-level project (the parent) and installed diktat, and ran mvn diktat:check - and got the error described above.
I did nothing but install diktat and run mvn diktat:check.
Environment information
- diktat version: 2.0
- build tool (maven/gradle): maven 3.9.6
- how is diktat run (CLI, plugin, etc.): cli, mvnw; also, IDEA (using the maven wrapper, so 3.9.6)
- kotlin version: 1.9.21
- operating system: MacOS
- link to a project (if your project is public): I'm sorry, it's not public.
@jottinger hey once again! Have you tried to run it with the same layout as we have in examples? I am checking our multi-module example and everything works well...
May be you did not add diktat-analysis.yml configuration or aware of some huge differences between example and your project layout? This will help us a lot :)
I added a diktat-analysis.yml to the project, yes, although the "see how we do it here" didn't point that out clearly. (Always assume your users are idiots!) I have four modules; all follow the same conventions for kotlin; all mirror pretty tightly (as far as I can see) the multi-module example you have.
I THOUGHT it might have been because one of the projects has no actual kotlin to check - src/main/kotlin and src/test/kotlin exist, but were empty (it's a placeholder project for transitive dependencies). So I added files in those trees just to give it something to look for; same problem, and it doesn't really seem related to the error anyway.