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

NSFE: diktat-rules\src\test\resources\test\paragraph2\header when running mvn test from diktat-rules/ #1345

Closed
0x6675636b796f75676974687562 opened this issue Jun 3, 2022 · 0 comments · Fixed by #1366
Assignees
Milestone

Comments

@0x6675636b796f75676974687562
Copy link
Member

The approach used in diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/generation/Generation.kt will work if Maven is invoked from the project root, e. g.:

$ mvn test

or

$ mvn -pl diktat-rules test

Yet, a quite legitimate scenario (particularly, used by IDEA when creating Maven run configurations) is invoking a Maven goal from the module directory, e. g.:

cd diktat-rules/ && mvn test

In this latter case, Maven execution will fail with:

java.nio.file.NoSuchFileException: diktat-rules\src\test\resources\test\paragraph2\header
    at sun.nio.fs.WindowsException.translateToIOException (WindowsException.java:79)
    at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:97)
    at sun.nio.fs.WindowsException.rethrowAsIOException (WindowsException.java:102)
    at sun.nio.fs.WindowsDirectoryStream.<init> (WindowsDirectoryStream.java:86)
    at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream (WindowsFileSystemProvider.java:518)
    at java.nio.file.Files.newDirectoryStream (Files.java:457)
    at java.nio.file.Files.list (Files.java:3451)
    at org.cqfn.diktat.ruleset.generation.GenerationKt.validateYear (Generation.kt:67)
    at org.cqfn.diktat.ruleset.generation.GenerationKt.main (Generation.kt:36)
    at org.cqfn.diktat.ruleset.generation.GenerationKt.main (Generation.kt)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:750)

Originally posted by @0x6675636b796f75676974687562 in #1296 (comment)

@0x6675636b796f75676974687562 0x6675636b796f75676974687562 changed the title java.nio.file.NoSuchFileException: diktat-rules\src\test\resources\test\paragraph2\header when running mvn test from diktat-rules/ NSFE: diktat-rules\src\test\resources\test\paragraph2\header when running mvn test from diktat-rules/ Jun 3, 2022
@nulls nulls added this to the 1.1.2 milestone Jun 16, 2022
@nulls nulls modified the milestones: 1.1.2, 1.1.1 Jun 17, 2022
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

Successfully merging a pull request may close this issue.

2 participants