-
Notifications
You must be signed in to change notification settings - Fork 270
[MJAVADOC-489] Find the main module descriptor #137
base: trunk
Are you sure you want to change the base?
Conversation
The existing code was checking for the existence of a file "src/main/module-info.java" relative to the current directory. The problem is that in a multi-module build, the current directory is the project root, not the root of the current module. As a result, the module descriptor was not being found and all dependencies were ending up on the classpath instead. Fixes: MJAVADOC-489
for ( String root : roots ) | ||
{ | ||
File descriptorFile = new File( root, "module-info.java" ).getAbsoluteFile(); | ||
if ( descriptorFile.exists() ) |
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.
Won't be better isFile() instead of exists() ?
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.
I agree, I'll update shortly.
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.
Actually, I'm kind of inclined to fail hard and fast if something exists called module-info.java
that isn't a regular file. That almost certainly indicates some sort of problem in the build elsewhere.
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.
Totally makes sense +1
This adjusts the previous patch to quickly and loudly reject filesystem entries named module-info.java that turn out not to be regular files. Affects: MJAVADOC-489
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.
+1 non binding
It looks like only half of this got merged as I didn't use the same ticket title on the second commit. |
The existing code was checking for the existence of a file
"src/main/module-info.java" relative to the current directory. The
problem is that in a multi-module build, the current directory is
the project root, not the root of the current module. As a result,
the module descriptor was not being found and all dependencies were
ending up on the classpath instead.
Fixes: MJAVADOC-489