Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Local properties are not prioritized in BOM #26

Open
joke opened this issue Nov 21, 2016 · 1 comment
Open

Local properties are not prioritized in BOM #26

joke opened this issue Nov 21, 2016 · 1 comment

Comments

@joke
Copy link

joke commented Nov 21, 2016

Hi,

I'm using plugin version 3.6.2. It seems the current behavior of maven bom provider does not prioritize local properties when they are defined in the pom alwell. I'm not sure if it is a bug or intended behavior but it is contradictory to a common use case like spring boot.

ext['hibernate.version'] = '5.2.4.Final'
dependencyRecommendations {
	mavenBom module: "org.springframework.boot:spring-boot-dependencies:1.4.2.RELEASE"
}

The maven pom sets the property hibernate.version to 5.0.11.Final in its properties block. The recommendation plugin does consider the local version 5.2.4.Final as the higher priority. The documentation Maven-BOM-Provider on the over hand states properties can be at least supplied via the ext mechanism. And most likely the later ones should take priority.

Regards
Joke

@tobiash
Copy link

tobiash commented Oct 5, 2017

I have encountered the same problem. I debugged through it and it seems the value sources are used in order - but I'm not completely sure, the maven code is somewhat complicated.

If I'm correct, the order needs to be changed here, so that the project properties come first:

public List<ValueSource> createValueSources(Model model, File projectDir, ModelBuildingRequest request, ModelProblemCollector collector) {
List<ValueSource> sources = new ArrayList<>();
sources.addAll(super.createValueSources(model, projectDir, request, collector));
sources.add(new PropertiesBasedValueSource(System.getProperties()));
sources.add(new MapBasedValueSource(project.getProperties()));
return sources;
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants