Skip to content

Commit

Permalink
[maven] Apply user properties as Environment.PropertiesSource. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Jul 28, 2021
1 parent 994eb8a commit 04dbe5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ public void mergeExtraProperties(Map<String, Object> extraProperties) {
public Map<String, Object> asMap(boolean full) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("path", path);
map.put("platform", platform);
map.put("transform", transform);
map.put("platform", platform);
map.put("extraProperties", getResolvedExtraProperties());
return map;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ private JReleaserModelConfigurer() {

public static JReleaserModel configure(JReleaserModel model, MavenProject mavenProject, MavenSession session) {
Properties properties = new Properties();
properties.putAll(mavenProject.getModel().getProperties());
properties.putAll(mavenProject.getProperties());
properties.putAll(session.getUserProperties());
Environment.PropertiesSource propertiesSource = new Environment.PropertiesPropertiesSource(properties);

model.getEnvironment().setPropertiesSource(propertiesSource);

configureProject(model.getProject(), mavenProject, session);

return model;
Expand All @@ -66,6 +67,9 @@ private static void configureProject(Project project, MavenProject mavenProject,
if (isBlank(project.getWebsite())) {
project.setWebsite(mavenProject.getUrl());
}
if (isBlank(project.getWebsite()) && (null != mavenProject.getOrganization())) {
project.setWebsite(mavenProject.getOrganization().getUrl());
}
if (project.getAuthors().isEmpty()) {
project.setAuthors(resolveAuthors(mavenProject.getDevelopers()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import static org.jreleaser.util.StringUtils.isBlank;
import static org.jreleaser.util.StringUtils.isNotBlank;

/**
Expand Down

0 comments on commit 04dbe5c

Please sign in to comment.