-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[MNG-7914] Provide a single entry point for configuration #1595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a conceptual problem here. There are only Maven user properties and Java system properties, but not Maven system properties. We are trying to get rid of them. That should clear in a new solution. I wouldn't even try to make system properties right. @slawekjaranowski
Yes, it makes sense. I've removed the system properties support to only keep |
There is one conceptual problem I have here: How does this relate to |
It's imho, a much better way to provide configuration properties. |
I see, then we also should educate users when to use what. |
Agreed. I suppose enhancing https://maven.apache.org/configure.html would be a first step. |
maven-embedder/src/main/java/org/apache/maven/cli/props/InterpolationHelper.java
Outdated
Show resolved
Hide resolved
c7c6455
to
f658846
Compare
I will get back to this tomorrow. This is a crucial change which needs careful design. |
f658846
to
0cb4067
Compare
maven-api-impl/src/main/java/org/apache/maven/internal/impl/DefaultSettingsBuilder.java
Outdated
Show resolved
Hide resolved
maven-api-impl/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsBuilder.java
Outdated
Show resolved
Hide resolved
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/MavenBuildTimestamp.java
Outdated
Show resolved
Hide resolved
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
Show resolved
Hide resolved
4481525
to
72e905d
Compare
# Comma-separated list of files to include. | ||
# Each item may be enclosed in quotes to gracefully include spaces. Items are trimmed before being loaded. | ||
# If the first character of an item is a question mark, the load will silently fail if the file does not exist. | ||
${includes} = "?${maven.user.conf}/maven.properties", \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you are quoting now the value, wouldn't it be more natural to put the question mark at the end? Unless you want to use "¿" as well. Maybe qoutes should be mandatory. Worth looking into Tomcat code for ths. I do not remember the motiviation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure quotes are mandatory, but they certainly avoid any problem with spaces inside path.
About the location of the '?', I fear that putting it at end will be less prominent.
It's also the same syntax than for optional profiles, see https://maven.apache.org/guides/introduction/introduction-to-profiles.html#explicit-profile-activation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. Shouldn't then the question mark be outside of the quotation marks to make the entire space-containing value optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added support for moving the '?' before the quotes (both before and after are supported), the default config file moves them before.
maven-api-impl/src/main/java/org/apache/maven/internal/impl/model/MavenBuildTimestamp.java
Show resolved
Hide resolved
maven-embedder/src/main/java/org/apache/maven/cli/props/MavenPropertiesLoader.java
Outdated
Show resolved
Hide resolved
maven-embedder/src/main/java/org/apache/maven/cli/props/InterpolationHelper.java
Outdated
Show resolved
Hide resolved
my test in project
looks like executed:
It will be great to support user properties in such case to have a possibility:
and
|
maven-embedder/src/main/java/org/apache/maven/cli/props/MavenPropertiesLoader.java
Outdated
Show resolved
Hide resolved
I've added a unit test showing this now works. |
maven-embedder/src/main/java/org/apache/maven/cli/props/MavenPropertiesLoader.java
Outdated
Show resolved
Hide resolved
@michael-o @slawekjaranowski @cstamas any more comments on that one ? |
Will give it a spin again today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is lacking completely is documentation how feature rich this approach is with inclusiion and optional files w/o reading source code.
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Outdated
Show resolved
Hide resolved
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Outdated
Show resolved
Hide resolved
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Outdated
Show resolved
Hide resolved
userProperties.stringPropertyNames().stream() | ||
.filter(k -> !sys.contains(k)) | ||
.forEach(k -> System.setProperty(k, userProperties.getProperty(k))); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must seriously reconsider this promotion in the future before GA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best we should not change a System property at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've raised #1661 to assess if there are any failing ITs as a first step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoker and friends are our worst enemies here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evaluate properties from cmd
Could you expand a bit more ? |
more in comments: #1595 (review) here only as reason why I marek PR as require change |
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Outdated
Show resolved
Hide resolved
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Outdated
Show resolved
Hide resolved
Thx. I modified the UT and fixed the use case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok for me.
We need to review documentation for it at all, generated and manually written.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great
# Conflicts: # maven-embedder/src/main/java/org/apache/maven/cli/props/MavenProperties.java
8ef8f9e
to
d5946f0
Compare
No description provided.