Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

[MJAVADOC-489] Find the main module descriptor #137

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

io7m
Copy link

@io7m io7m commented Nov 18, 2017

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

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() )

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() ?

Copy link
Author

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.

Copy link
Author

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.

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
Copy link

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 non binding

@io7m
Copy link
Author

io7m commented Nov 19, 2017

It looks like only half of this got merged as I didn't use the same ticket title on the second commit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants