Skip to content

Conversation

@betanzos
Copy link
Contributor

@betanzos betanzos commented Feb 16, 2020

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


String outputDirectory = project.getBuild().getOutputDirectory();
if (outputDirectory == null || outputDirectory.isEmpty()) {
throw new MojoExecutionException("Output directory doesn't exist, compile first");
Copy link
Collaborator

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?

Copy link
Contributor Author

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"

Copy link
Collaborator

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"

Comment on lines -186 to -188
getLog().debug("Output directory was empty, compiling...");
classes = new File(outputDirectory).listFiles();
if (classes == null || classes.length == 0) {
Copy link
Collaborator

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

Copy link
Contributor Author

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");
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.

Comment on lines 191 to 193
} else {
// TODO: verify if classes require compiling
}
Copy link
Collaborator

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

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 this pull request may close these issues.

javafx:jlink goal requires manual compile

3 participants