Skip to content

[MNG-5659] Provide project-specific settings located in ${session.rootdir}/.mvn/settings.xml by default#1059

Merged
gnodet merged 1 commit intoapache:masterfrom
gnodet:MNG-5659-project-settings
Jun 19, 2023
Merged

[MNG-5659] Provide project-specific settings located in ${session.rootdir}/.mvn/settings.xml by default#1059
gnodet merged 1 commit intoapache:masterfrom
gnodet:MNG-5659-project-settings

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 16, 2023

This add support for project specific settings using:

  • a default location of ${session.rootDirectory}/.mvn/settings.xml
  • an alternate location specified by -ps or --project-settings and resolved against the current dir if provided with a relative path

Note that project settings have some limitations:

  • no localRepository
  • no interactiveMode
  • no offline
  • no proxies
  • no server[x].username, server[x].password, server[x].privateKey, server[x].passphrase, server[x].filePermissions, server[x].directoryPermissions
  • no usePluginRegistry

Simple IT provided with apache/maven-integration-testing#265

===
Related discussions to be considered (but note that this PR does not depend on the following):

  • MNG-6762 suggests to also modify other file resolution, but there was a strong opposition to modify the existing behaviour. This PR is coherent with the current code where relative files are resolved against the current directory.

@gnodet gnodet marked this pull request as draft March 16, 2023 12:35
@gnodet gnodet force-pushed the MNG-5659-project-settings branch from a0e1e25 to 641cdc6 Compare March 16, 2023 12:43
@gzm55
Copy link
Contributor

gzm55 commented Mar 16, 2023

usePluginRegistry in project settings should also be ignored.

@rmannibucau
Copy link
Contributor

Can ${maven.multiModuleProjectDirectory}/.mvn/settings.xml become ${maven.multiModuleProjectDirectory}/.mvn/project.settings.xml or something like that since .mvn/settings.xml is sometimes used by users so something more unlikely would be great.

@gnodet gnodet changed the title [MNG-5659] Provide project-specific settings located in [root]/.mvn/settings.xml by default [MNG-5659] Provide project-specific settings located in ${session.rootdir}/.mvn/settings.xml by default Apr 14, 2023
@gnodet gnodet force-pushed the MNG-5659-project-settings branch from 641cdc6 to 58d4e65 Compare April 14, 2023 13:01
@gnodet gnodet marked this pull request as ready for review April 14, 2023 14:03
@gnodet gnodet force-pushed the MNG-5659-project-settings branch from 58d4e65 to 6dee758 Compare April 20, 2023 11:16
@gnodet gnodet added this to the 4.0.0-alpha-6 milestone May 16, 2023
Copy link
Member

@cstamas cstamas left a comment

Choose a reason for hiding this comment

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

While I like this, I'd generalize the approach (maybe no now) in similar way like "chained LRM" works. Example:

-s remains as today "user settings override"
And "settings tail" is s1, s2, s3.... global setting (that also can be overridden from CLI). And this list is ordered from "most dominant" to "most recessive", meaning, that even settings builder could be modified to make a for-loop to build effective settings in this order:
"user settings", s1, s2, s3.... "global settings"

@jira-importer
Copy link

Resolve #6464

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.

5 participants