-
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
Add some javadoc / website doc to known maven properties #1597
Conversation
Missing:
|
@michael-o Defining |
Both refer to it as config dir: |
# Maven user properties | ||
# | ||
|
||
maven.user.home = ${user.home}/.m2 |
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.
Based on my previous comment: maven.user.conf
? Akin to maven.conf
?
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.
for ref (and ideas): https://github.com/maveniverse/mima/blob/main/context/src/main/java/eu/maveniverse/maven/mima/context/MavenUserHome.java
Meaning, I am 100% with value key name.
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.
That wouldn't be consistent with the global props. All of those XML files are config files, at the end.
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 disagree, as that IS "maven user home", so "user home" plus something, local repo is not config, is it?
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.
Plus, that is where mvnd daemons logs, where indexer put some files, resolver put file locks, and so on... it is IMHO really "maven user home".
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 disagree, as that IS "maven user home", so "user home" plus something, local repo is not config, is it?
It is not, and this is the reason why it has its own property to be relocated. For technical reasons we can only assume the user home to be writable, but that can be a problem if it is NFS mounted or similar.
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.
Plus, that is where mvnd daemons logs, where indexer put some files, resolver put file locks, and so on... it is IMHO really "maven user home".
Then we need maven.user.workdir
or similar.
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.
@cstamas The problem you describe has been solved by Windows with APPDATA\{Roaming,Local,LocalLow}
the the conf files will roam, but the generated stuff will be in Local
, if not even LocalLow
, thus never be network mounted.
@michael-o I don't have a strong opinion on the naming, but I'd really like them to be consistent. So if we can come up with clear rules, that would be the best imho. |
We should strive for repeatable consistency. |
I would perform these renames... these "options" were hidden (like maven.buildNumber, am sure, was used by me only, as it was nor even documented). So no harm, but we have 3.x to 4.x change as well, so I'd do all to make those "pretty clear", and many of those do need rename as were mostly ad-hoc named as 4.x was done.... |
Which exactly do you mean? |
What about:
|
One question: before it was "maven system home" and "maven user home"... why "global" now? IMHO is not global for sure, especially as you can have multiple maven versions in multiple terminals (like with sdkman) and as single user. So "global" is kinda misleading to me. I like more "maven system..." |
But overall, this PR is something that was missing a LOT, this is very cool! |
Also one nit: |
Regarding this: we have discussed this notion last year with @rfscholte and came up with https://cwiki.apache.org/confluence/display/MAVEN/Commandline+inheritance. Globals to the installation. We don't have inter-Maven config like other applications have. |
This is all about "precedence". Take for example settings:
but both can be overridden, so you could have "inter-maven" settings like "workstation specific" (for example all uers of given workstation access network in same way, so HTTP proxy as example) + "user specific" (users use user specific credentials). IMHO, this is more about specificity and/or precedence... so "user" MAY override things from "system", the final settings is built by "layering" in proper order. |
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.
Yet another stupid comment to pick up @cstamas' concerns: Since the user home contains handwritten conf and generated stuff, wouldn't it rather wise to introduce a new property, say maven.user.work
which will point by default to maven.user.home
, but can be remounted to host all the stuff like local repo, wrapper, indexes, etc? Those who do not want to have something like this on a network mount.
@@ -29,14 +29,14 @@ under the License. | |||
| | |||
| -s /path/to/user/settings.xml | |||
| | |||
| 2. Global Level. This settings.xml file provides configuration for all Maven | |||
| 2. System Level. This settings.xml file provides configuration for all Maven |
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 consider this a wrong as "global". See https://cwiki.apache.org/confluence/display/MAVEN/Commandline+inheritance. It should be "installation" level.
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.
And what if I have defined on workstation MAVEN_ARGS=-gs=/etc/maven/settings.xml
? Is that still "installation" level? Moreover. what if that env variable is defined in /etc/profile.d ?
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.
Well, that is an override. It will then instruct the currently running Maven installation use that settings file. It could be in the profile or just in the current shell session, but there is no explicit system wide settings for all Maven installations by default. This is what I mean.
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 that differently. We have "system" and "user" settings, and the utter difference between the two is precedence. Whatever they come from, or are they "default" or "override", their precedence is all that matters.
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.
This is very much alike how we build "effective POM/models", Maven does not care from where the bits come (is current POM in local repo, or in reactor, is parent POM resolved from remote...), what Maven cares is HOW the final result is assembled.
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.
FQN is "Maven System Level". We discussed here in context of Maven. So "Maven User Level" and "Maven System Level".
As in 'Maven System' and not Maven in the entire system (OS, etc)?
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.
@gnodet What I like is you are picking up the idea of https://github.com/apache/tomcat/blob/main/conf/catalina.properties#L33.
Honestly, I cannot decipher it: ${cli:it:-${cli:gt:-${maven.install.conf}/toolchains.xml}}
Takes too much brain muscles from first glance.
I wonder why those XML files cannot be optional by default and Maven would simply iterate over
?${maven.install.extensions} \
?${maven.project.extensions} \
?${maven.user.extensions}
At the end we define the semantics how a property is interpreted. Git or Subversion do search for a user and global config and it is not a failure if both isn't there. Same here. We could log the absence at debug level. WDYT?
This would make the ?
redudant.
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 fine with removing the ?
and assuming all those files are optional.
But that does not address CLI parameters. Right now, they are supported by dedicated code in MavenCli. The code would check if -t
is set, and set the user toolchain file accordingly, else compute the default. It's one OR is the other, not both. So we need a way to have default values in the syntax, that's what the following would do:
maven.user.toolchains.default = ${maven.user.conf}/toolchains.xml}
maven.user.toolchains = ${cli:t:-${maven.user.toolchains.default}}
maven.toolchains = ${maven.install.toolchains} \
${maven.project.toolchains} \
${maven.user.toolchains}
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.
Actually, we may still need the ?
. Currently, if you specify -t foo.xml
, maven will fail if foo.xml
file does not exist. Whereas default files can be safely ignored if they don't exist. So we need to be able to know if a file was explicitely specified or just defaulted imho. So maybe:
maven.user.toolchains = ${cli:t:-?${maven.user.toolchains.default}}
Note that we could use cli.t
instead of cli:t
, this may be less confusing:
maven.user.toolchains = ${cli.t:-?${maven.user.toolchains.default}}
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.
One problem is that project settings are validated differently than user or install settings... If we have a single list, it will be hard to keep that information. I think this is the only case where those xml files (toolchains, settings, extensions) are loaded differently.
Another problem which is not currently addressed, is the merge of extensions.xml
, but that's a different topic...
* @since 3.0.0 | ||
*/ | ||
@Config(source = Config.Source.MODEL, defaultValue = "yyyy-MM-dd'T'HH:mm:ss'Z'") | ||
public static final String MAVEN_BUILD_TIMESTAMP_FORMAT = "maven.build.timestamp.format"; |
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.
One of the problems with this is that the timezone (offset) is missing here. It should be either mentioned or we should switch to yyyy-MM-dd'T'HH:mm:ssXXX
which will produce the same output as with Etc/UTC
.
type = type.substring(javaLangPackage.length()); | ||
} | ||
} | ||
return nvl(type, "n/a"); |
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.
"N/A"
* Enhancement of the standard <code>Properties</code> | ||
* managing the maintain of comments, etc. | ||
*/ | ||
public class Properties extends AbstractMap<String, String> { |
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.
Maven this class should be called MavenProperties
to avoid confusion?
* | ||
* @param str the <code>String</code> to unescape, may be null | ||
* @return the processed string | ||
* @throws IllegalArgumentException if the Writer is <code>null</code> |
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.
Which writer?
inUnicode = false; | ||
hadSlash = false; | ||
} catch (NumberFormatException nfe) { | ||
throw new IllegalArgumentException("Unable to parse unicode value: " + unicode, nfe); |
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.
Does this require documentation?
|
||
public static final String INCLUDES_PROPERTY = "${includes}"; // mandatory includes | ||
|
||
public static final String OPTIONALS_PROPERTY = "${optionals}"; // optionals include |
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.
Maybe we can make optionals more succint with ${includes?}
like we have in here: https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#dashClassifier
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.
This is the property key, you want to rename and use ${includes?} = ${user.home}/.m2/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.
Yes, as an idea. Maybe it is a bad one. I am open to ideas. Comments should read "mandatory includes"/"optional includes", but the property names aren't consistent in this regard.
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.
Another possibility is to have a single list, and if the first character is a ?
, then make it optional.
${includes} = ?${user.home}/.m2/maven.properties, \
?${session.rootDirectory}/.mvn/maven.properties
We have this syntax for profiles.
src/site/markdown/configuration.md
Outdated
|
||
| No | Key | Type | Description | Default Value | Since | Source | | ||
| --- | --- | --- | --- | --- | --- | --- | | ||
| 1. | `maven.build.timestamp.format` | `String` | Build timestamp format. | `yyyy-MM-dd'T'HH:mm:ss'Z'` | 3.0.0 | Model 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.
I think that the desc should contain the time zone information.
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, this is generated from the defaultValue
above.
I meant this one Line 49 in fd8f99e
But is not present in this PR yet. Essentially, I find this property badly named, that's all. As many other, but renaming these is IMHO out of scope for this PR. |
This I don't understand. While the user settings can be shared between Maven versions, there is no global settings which is sourced by every Maven installation like |
Is there even proper docs for this property? |
|
…ame system->install
# The '-is' flag will override the 'maven.install.settings' property. | ||
# The '-ps' flag will override the 'maven.project.settings' property. | ||
# The '-s' flag will override the 'maven.user.settings' property. | ||
maven.install.settings = ${maven.install.conf}/settings.xml |
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.
Attention: This must not be confused with the Maven Install Plugin, hence: maven.installation.<prop>
Closing this PR in favour of #1595 |
Follow-up to #1595
This PR adds an annotation, a class in the API to contain all config properties, and add a doc generation for those.