-
Notifications
You must be signed in to change notification settings - Fork 65
#68 Automatically compile project before execute javafx:jlink goal, if needed #69
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
Conversation
|
|
||
| String outputDirectory = project.getBuild().getOutputDirectory(); | ||
| if (outputDirectory == null || outputDirectory.isEmpty()) { | ||
| throw new MojoExecutionException("Output directory doesn't exist, compile first"); |
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.
In theory, the compiler plugin will do its job, and target shouldn't be null. However this is a sanity check to prevent any possible situation where target is removed even after compile creates it? Maybe we can rephrase the message instead?
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.
Agree.
What do you think of this message: "Output directory doesn't exist after compile"
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 would just say "Error: Output directory doesn't exist"
| getLog().debug("Output directory was empty, compiling..."); | ||
| classes = new File(outputDirectory).listFiles(); | ||
| if (classes == null || classes.length == 0) { |
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.
remove these three lines only
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.
OK
| getLog().debug("Output directory was empty, compiling..."); | ||
| classes = new File(outputDirectory).listFiles(); | ||
| if (classes == null || classes.length == 0) { | ||
| throw new MojoExecutionException("Output directory is empty, compile first"); |
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.
keep the exception, rephrasing the message, to prevent a possible NPE if classes is null or empty.
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.
Agree.
| } else { | ||
| // TODO: verify if classes require compiling | ||
| } |
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.
This can be safely removed
Compilation is carried out through the Maven compile phase instead the goal compiler:compile. Because of this, any goal associated with said phase will also be executed.
Fixes #68