Skip to content

Commit

Permalink
Merge pull request #379 from jglick/dependencyManagement
Browse files Browse the repository at this point in the history
Add a `dependencyManagement` section if missing
  • Loading branch information
jglick authored Aug 12, 2022
2 parents fd40b6d + 1c45754 commit a5a4fbc
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,12 @@ private static void applyOverrides(
throw new MojoExecutionException("Cannot add self to dependency management section");
}
DependencyManagement dm = project.getDependencyManagement();
if (dm != null) {
log.info(String.format("Adding dependency management entry %s:%s", key, dependency.getVersion()));
dm.addDependency(dependency);
} else {
throw new MojoExecutionException(String.format("Failed to add dependency management entry %s:%s because the project does not have a dependency management section", key, overrides.get(key)));
if (dm == null) {
dm = new DependencyManagement();
project.getModel().setDependencyManagement(dm);
}
log.info(String.format("Adding dependency management entry %s:%s", key, dependency.getVersion()));
dm.addDependency(dependency);
overrideAdditions.add(key);
}
} else {
Expand Down

0 comments on commit a5a4fbc

Please sign in to comment.