Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void doExecute() throws MisconfiguredToolchainException, MojoFailureExce
if (toolchain == null) {
throw new MojoFailureException(
"Cannot find matching toolchain definitions for the following toolchain types:" + requirements
+ System.lineSeparator()
+ "\n"
+ "Define the required toolchains in your ~/.m2/toolchains.xml file.");
}

Expand Down Expand Up @@ -262,8 +262,17 @@ private boolean matches(String key, String reqVal, String tcVal) {
}

private String getJdkHome(ToolchainPrivate toolchain) {
return ((Xpp3Dom) toolchain.getModel().getConfiguration())
.getChild("jdkHome")
.getValue();
ToolchainModel model = toolchain.getModel();
if (model == null) {
return null;
}
Object configuration = model.getConfiguration();
if (configuration instanceof Xpp3Dom) {
Xpp3Dom child = ((Xpp3Dom) configuration).getChild("jdkHome");
if (child != null) {
return child.getValue();
}
}
return null;
}
}
Loading