mirror of https://github.com/apache/maven.git
[MNG-4390] Make parsing of settings.xml lenient with respect to unrecognized tags
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@824188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a98ec9089f
commit
a13a336cea
|
@ -121,22 +121,33 @@ public class DefaultSettingsBuilder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
boolean strict = true;
|
Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.TRUE );
|
||||||
|
|
||||||
Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.valueOf( strict ) );
|
try
|
||||||
|
{
|
||||||
|
settings = settingsReader.read( settingsFile, options );
|
||||||
|
}
|
||||||
|
catch ( SettingsParseException e )
|
||||||
|
{
|
||||||
|
options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.FALSE );
|
||||||
|
|
||||||
settings = settingsReader.read( settingsFile, options );
|
settings = settingsReader.read( settingsFile, options );
|
||||||
|
|
||||||
|
problems.add( new DefaultSettingsProblem( e.getMessage(), SettingsProblem.Severity.WARNING,
|
||||||
|
settingsFile.getAbsolutePath(), e.getLineNumber(),
|
||||||
|
e.getColumnNumber(), e ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( SettingsParseException e )
|
catch ( SettingsParseException e )
|
||||||
{
|
{
|
||||||
problems.add( new DefaultSettingsProblem( "Non-parseable settings " + settingsFile,
|
problems.add( new DefaultSettingsProblem( "Non-parseable settings " + settingsFile + ": " + e.getMessage(),
|
||||||
SettingsProblem.Severity.FATAL, settingsFile.getAbsolutePath(),
|
SettingsProblem.Severity.FATAL, settingsFile.getAbsolutePath(),
|
||||||
e.getLineNumber(), e.getColumnNumber(), e ) );
|
e.getLineNumber(), e.getColumnNumber(), e ) );
|
||||||
return new Settings();
|
return new Settings();
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
problems.add( new DefaultSettingsProblem( "Non-readable settings " + settingsFile,
|
problems.add( new DefaultSettingsProblem( "Non-readable settings " + settingsFile + ": " + e.getMessage(),
|
||||||
SettingsProblem.Severity.FATAL, settingsFile.getAbsolutePath(),
|
SettingsProblem.Severity.FATAL, settingsFile.getAbsolutePath(),
|
||||||
-1, -1, e ) );
|
-1, -1, e ) );
|
||||||
return new Settings();
|
return new Settings();
|
||||||
|
|
Loading…
Reference in New Issue