Skip to content

Added a global preference for user settings.xml for Maven projects#9282

Open
Achal1607 wants to merge 1 commit intoapache:masterfrom
Achal1607:custom-user-settings-xml
Open

Added a global preference for user settings.xml for Maven projects#9282
Achal1607 wants to merge 1 commit intoapache:masterfrom
Achal1607:custom-user-settings-xml

Conversation

@Achal1607
Copy link
Copy Markdown
Collaborator

Added a new preference in the MavenSettings for custom user settings.xml file.
Also, exposed it to the LSP
Below is the screenshot for the new preference Netbeans IDE UI:

Screenshot 2026-03-17 at 11 43 09 AM

Closes #4263

@Achal1607 Achal1607 requested review from lahodaj and mbien March 17, 2026 06:20
@Achal1607 Achal1607 added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests LSP [ci] enable Language Server Protocol tests labels Mar 17, 2026
@apache apache locked and limited conversation to collaborators Mar 17, 2026
@apache apache unlocked this conversation Mar 17, 2026
@lahodaj lahodaj requested a review from sdedic March 17, 2026 10:21
@lahodaj
Copy link
Copy Markdown
Contributor

lahodaj commented Mar 17, 2026

On a cursory look, seems reasonable to me. @sdedic - any comments? Thanks!

@mbien mbien added this to the NB30 milestone Mar 18, 2026
@mbien
Copy link
Copy Markdown
Member

mbien commented Mar 18, 2026

useful feature! I found two issues while testing:

  • the settings.xml node in the Project Files folder of maven projects is always linking to the default location (even after restart)
  • the profile switcher combo box in the main tool bar is only updating after restart (edit: i tested this by having different profiles in the custom-settings.xml)

@mbien mbien added the ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) label Mar 18, 2026
Comment on lines +1057 to +1060
JsonPrimitive newMavenUserSettingsPath = null;
if (c instanceof JsonPrimitive) {
newMavenUserSettingsPath = (JsonPrimitive) c;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nitpick:

        JsonPrimitive newMavenUserSettingsPath = c instanceof JsonPrimitive jp ? jp : null;

@Achal1607 Achal1607 requested a review from mbien March 23, 2026 06:16
@Achal1607 Achal1607 force-pushed the custom-user-settings-xml branch 2 times, most recently from 4f66572 to 39b4c45 Compare March 24, 2026 10:43
@Achal1607
Copy link
Copy Markdown
Collaborator Author

useful feature! I found two issues while testing:

  • the settings.xml node in the Project Files folder of maven projects is always linking to the default location (even after restart)
  • the profile switcher combo box in the main tool bar is only updating after restart (edit: i tested this by having different profiles in the custom-settings.xml)

I have fixed both the issues @mbien. Can you please review again? Thanks for pointing it out.

Fixed project files and profile combo box to reflect custom settings.xml
@Achal1607 Achal1607 force-pushed the custom-user-settings-xml branch from 39b4c45 to 45b9f00 Compare March 24, 2026 10:53
@Achal1607
Copy link
Copy Markdown
Collaborator Author

The tests are passing locally, can someone please re-run the tests?

@apache apache locked and limited conversation to collaborators Mar 30, 2026
@apache apache unlocked this conversation Mar 30, 2026
@neilcsmith-net
Copy link
Copy Markdown
Member

Thanks for this addition, although I'm not sure it fully addresses #4263 Ideally, NetBeans should always match the settings Maven would use. So, settings in global execution options, project configuration, (in v4) project settings, etc. would ideally all work. This seems good as a stopgap solution, but will probably all need a rethink when we come to upgrading to Maven 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests Maven [ci] enable "build tools" tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maven configuration settings.xml

4 participants