Skip to content

Commit

Permalink
Merge pull request #10450 from geoand/dev-mojo-npe
Browse files Browse the repository at this point in the history
Avoid very unlikely NPE
  • Loading branch information
geoand authored Jul 3, 2020
2 parents 8fbb04d + 5fea82b commit 1351db3
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -407,21 +407,25 @@ private void triggerCompile() throws MojoExecutionException {
*/
private void handleResources() throws MojoExecutionException {
List<Resource> resources = project.getResources();
if (!resources.isEmpty()) {
Plugin resourcesPlugin = project.getPlugin(ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_RESOURCES_PLUGIN);
MojoExecutor.executeMojo(
MojoExecutor.plugin(
MojoExecutor.groupId(ORG_APACHE_MAVEN_PLUGINS),
MojoExecutor.artifactId(MAVEN_RESOURCES_PLUGIN),
MojoExecutor.version(resourcesPlugin.getVersion()),
resourcesPlugin.getDependencies()),
MojoExecutor.goal("resources"),
getPluginConfig(resourcesPlugin),
MojoExecutor.executionEnvironment(
project,
session,
pluginManager));
if (resources.isEmpty()) {
return;
}
Plugin resourcesPlugin = project.getPlugin(ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_RESOURCES_PLUGIN);
if (resourcesPlugin == null) {
return;
}
MojoExecutor.executeMojo(
MojoExecutor.plugin(
MojoExecutor.groupId(ORG_APACHE_MAVEN_PLUGINS),
MojoExecutor.artifactId(MAVEN_RESOURCES_PLUGIN),
MojoExecutor.version(resourcesPlugin.getVersion()),
resourcesPlugin.getDependencies()),
MojoExecutor.goal("resources"),
getPluginConfig(resourcesPlugin),
MojoExecutor.executionEnvironment(
project,
session,
pluginManager));
}

private void executeCompileGoal(Plugin plugin, String groupId, String artifactId) throws MojoExecutionException {
Expand Down

0 comments on commit 1351db3

Please sign in to comment.