Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Check Maven user properties with highest precedence when fetching a property value #4345

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

breun
Copy link

@breun breun commented Jan 8, 2025

Fixes #4344 🛠️

@ldetmer
Copy link

ldetmer commented Mar 10, 2025

/gcbrun

*/
@Nullable
public static String getProperty(
String propertyName, @Nullable MavenProject project, @Nullable MavenSession session) {
if (session != null && session.getSystemProperties().containsKey(propertyName)) {
return session.getSystemProperties().getProperty(propertyName);
if (session != null && session.getUserProperties().containsKey(propertyName)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can getUserProperties be null? if so can you please add null check too?

Copy link
Author

@breun breun Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Javadoc for org.apache.maven.execution.MavenSession#getUserProperties says:

@return The user properties, never {@code null}.

So, a null check should not be necessary.

Similarly project.getProperties() and session.getSystemProperties() also promise to be non-null.

@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
## [unreleased]

### Added
- Check Maven user properties with highest precedence when fetching a property value ([#4344](https://github.com/GoogleContainerTools/jib/issues/4344))
Copy link

@ldetmer ldetmer Mar 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update to

"Update retrieval of maven properties to use the following order: user, project, system"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated the changelog via breun@fba991f.

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

Successfully merging this pull request may close these issues.

Jib Maven Plugin 3.4.4 doesn't consider user properties properly (breaks on Maven 4)
3 participants