-
-
Notifications
You must be signed in to change notification settings - Fork 352
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
fix: fix Maven source and test source directory resolving #3562
Conversation
Cool! Would you add the corresponding test case? Thanks! |
Not sure why the test is failing, it works locally |
Thanks a lot for the test case + the fix. I guess the CI environment is slightly different or a file is missing? |
…om.xml hierarchy to find the nearest ancestor that declares the source directory. Also added interpolating (project|pom|'').basedir
…e not linked via pom.xml to the model
76db1d3
to
be9816f
Compare
@monperrus fixed the test case, the folder was missing because there were no files 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, we're almost there, see comment below
SpoonPom childModel = pomModel.getModules().get(0); | ||
//contract: source directory is derived from parent pom.xml if not declared in the current | ||
// (childModel) SpoonPom | ||
assertEquals(expected, childModel.getSourceDirectories().get(0).getAbsolutePath(), expected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected should be the second argument, not the last
you can remove the first one, the message, not relevant here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @Strum355 |
By climbing the pom.xml hierarchy to find the nearest ancestor that declares the source directory rather than immediately falling back to src/(main|test)/java if not declared in this immediate pom.
Also added interpolating (project|pom|'').basedir which is not uncommonly found in projects.