Show warnings about bad settings.xml

Description

If user has bad settings.xml at the home folder, e.g. the top level element is not <settings>, the settings are currently silently ignored.

Maven shows a warning in this case:

Fix should be to simply get the list of problems from settings result and output them:

https://github.com/apache/maven/blob/59bd396e6e85295c69b0cda98796821a97c28562/maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java#L152-L162

Some notes for implementation:

1. get-settings is currently called multiple times, the validation should only happen once
2. Looks like DefaultMavenSettingsBuilder doesn't allow access to SettingsBuildingResult, only returning Settings. Using classes from org.apache.maven.settings.building would require reimplementing logic in DefaultMavenSettingsBuilder to select the config files?

Related, docs currently don't include <settings> as top level tag: https://github.com/clojure/clojure-site/pull/416/commits

Environment

None

Activity

Show:
Alex Miller
February 5, 2021, 3:38 PM

Just relying on Maven here, not going to go to extraordinary measures to extend their validation.

Alex Miller
November 24, 2020, 8:17 PM

Many bad settings files will cause an error to be thrown, this particular one is not an error, just a warning.

Won't Fix

Assignee

Unassigned

Reporter

Juho Teperi