aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java277
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java71
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java160
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java166
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java70
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java90
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java131
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java50
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java100
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java35
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java69
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java60
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java110
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java120
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java81
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecrypter.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java71
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java113
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java118
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsParseException.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsReader.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsWriter.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/merge/MavenSettingsMerger.java142
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java285
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/SettingsValidator.java41
30 files changed, 2910 insertions, 0 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
new file mode 100644
index 00000000..3cdae7d0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
@@ -0,0 +1,277 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.building.FileSource;
+import org.apache.maven.building.Source;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.TrackableBase;
+import org.apache.maven.settings.io.SettingsParseException;
+import org.apache.maven.settings.io.SettingsReader;
+import org.apache.maven.settings.io.SettingsWriter;
+import org.apache.maven.settings.merge.MavenSettingsMerger;
+import org.apache.maven.settings.validation.SettingsValidator;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+
+/**
+ * Builds the effective settings from a user settings file and/or a global settings file.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = SettingsBuilder.class )
+public class DefaultSettingsBuilder
+ implements SettingsBuilder
+{
+
+ @Requirement
+ private SettingsReader settingsReader;
+
+ @Requirement
+ private SettingsWriter settingsWriter;
+
+ @Requirement
+ private SettingsValidator settingsValidator;
+
+ private MavenSettingsMerger settingsMerger = new MavenSettingsMerger();
+
+ public DefaultSettingsBuilder setSettingsReader( SettingsReader settingsReader )
+ {
+ this.settingsReader = settingsReader;
+ return this;
+ }
+
+ public DefaultSettingsBuilder setSettingsWriter( SettingsWriter settingsWriter )
+ {
+ this.settingsWriter = settingsWriter;
+ return this;
+ }
+
+ public DefaultSettingsBuilder setSettingsValidator( SettingsValidator settingsValidator )
+ {
+ this.settingsValidator = settingsValidator;
+ return this;
+ }
+
+ @Override
+ public SettingsBuildingResult build( SettingsBuildingRequest request )
+ throws SettingsBuildingException
+ {
+ DefaultSettingsProblemCollector problems = new DefaultSettingsProblemCollector( null );
+
+ Source globalSettingsSource =
+ getSettingsSource( request.getGlobalSettingsFile(), request.getGlobalSettingsSource() );
+ Settings globalSettings = readSettings( globalSettingsSource, request, problems );
+
+ Source userSettingsSource =
+ getSettingsSource( request.getUserSettingsFile(), request.getUserSettingsSource() );
+ Settings userSettings = readSettings( userSettingsSource, request, problems );
+
+ settingsMerger.merge( userSettings, globalSettings, TrackableBase.GLOBAL_LEVEL );
+
+ problems.setSource( "" );
+
+ userSettings = interpolate( userSettings, request, problems );
+
+ // for the special case of a drive-relative Windows path, make sure it's absolute to save plugins from trouble
+ String localRepository = userSettings.getLocalRepository();
+ if ( localRepository != null && localRepository.length() > 0 )
+ {
+ File file = new File( localRepository );
+ if ( !file.isAbsolute() && file.getPath().startsWith( File.separator ) )
+ {
+ userSettings.setLocalRepository( file.getAbsolutePath() );
+ }
+ }
+
+ if ( hasErrors( problems.getProblems() ) )
+ {
+ throw new SettingsBuildingException( problems.getProblems() );
+ }
+
+ return new DefaultSettingsBuildingResult( userSettings, problems.getProblems() );
+ }
+
+ private boolean hasErrors( List<SettingsProblem> problems )
+ {
+ if ( problems != null )
+ {
+ for ( SettingsProblem problem : problems )
+ {
+ if ( SettingsProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 )
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private Source getSettingsSource( File settingsFile, Source settingsSource )
+ {
+ if ( settingsSource != null )
+ {
+ return settingsSource;
+ }
+ else if ( settingsFile != null && settingsFile.exists() )
+ {
+ return new FileSource( settingsFile );
+ }
+ return null;
+ }
+
+ private Settings readSettings( Source settingsSource, SettingsBuildingRequest request,
+ DefaultSettingsProblemCollector problems )
+ {
+ if ( settingsSource == null )
+ {
+ return new Settings();
+ }
+
+ problems.setSource( settingsSource.getLocation() );
+
+ Settings settings;
+
+ try
+ {
+ Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.TRUE );
+
+ try
+ {
+ settings = settingsReader.read( settingsSource.getInputStream(), options );
+ }
+ catch ( SettingsParseException e )
+ {
+ options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.FALSE );
+
+ settings = settingsReader.read( settingsSource.getInputStream(), options );
+
+ problems.add( SettingsProblem.Severity.WARNING, e.getMessage(), e.getLineNumber(), e.getColumnNumber(),
+ e );
+ }
+ }
+ catch ( SettingsParseException e )
+ {
+ problems.add( SettingsProblem.Severity.FATAL, "Non-parseable settings " + settingsSource.getLocation()
+ + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ return new Settings();
+ }
+ catch ( IOException e )
+ {
+ problems.add( SettingsProblem.Severity.FATAL, "Non-readable settings " + settingsSource.getLocation()
+ + ": " + e.getMessage(), -1, -1, e );
+ return new Settings();
+ }
+
+ settingsValidator.validate( settings, problems );
+
+ return settings;
+ }
+
+ private Settings interpolate( Settings settings, SettingsBuildingRequest request,
+ SettingsProblemCollector problems )
+ {
+ StringWriter writer = new StringWriter( 1024 * 4 );
+
+ try
+ {
+ settingsWriter.write( writer, null, settings );
+ }
+ catch ( IOException e )
+ {
+ throw new IllegalStateException( "Failed to serialize settings to memory", e );
+ }
+
+ String serializedSettings = writer.toString();
+
+ RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+
+ interpolator.addValueSource( new PropertiesBasedValueSource( request.getUserProperties() ) );
+
+ interpolator.addValueSource( new PropertiesBasedValueSource( request.getSystemProperties() ) );
+
+ try
+ {
+ interpolator.addValueSource( new EnvarBasedValueSource() );
+ }
+ catch ( IOException e )
+ {
+ problems.add( SettingsProblem.Severity.WARNING, "Failed to use environment variables for interpolation: "
+ + e.getMessage(), -1, -1, e );
+ }
+
+ interpolator.addPostProcessor( new InterpolationPostProcessor()
+ {
+ @Override
+ public Object execute( String expression, Object value )
+ {
+ if ( value != null )
+ {
+ // we're going to parse this back in as XML so we need to escape XML markup
+ value = value.toString().replace( "&", "&amp;" ).replace( "<", "&lt;" ).replace( ">", "&gt;" );
+ return value;
+ }
+ return null;
+ }
+ } );
+
+ try
+ {
+ serializedSettings = interpolator.interpolate( serializedSettings, "settings" );
+ }
+ catch ( InterpolationException e )
+ {
+ problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1,
+ e );
+
+ return settings;
+ }
+
+ Settings result;
+ try
+ {
+ Map<String, ?> options = Collections.singletonMap( SettingsReader.IS_STRICT, Boolean.FALSE );
+ result = settingsReader.read( new StringReader( serializedSettings ), options );
+ }
+ catch ( IOException e )
+ {
+ problems.add( SettingsProblem.Severity.ERROR, "Failed to interpolate settings: " + e.getMessage(), -1, -1,
+ e );
+ return settings;
+ }
+
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java
new file mode 100644
index 00000000..e728ec55
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilderFactory.java
@@ -0,0 +1,71 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.settings.io.DefaultSettingsReader;
+import org.apache.maven.settings.io.DefaultSettingsWriter;
+import org.apache.maven.settings.io.SettingsReader;
+import org.apache.maven.settings.io.SettingsWriter;
+import org.apache.maven.settings.validation.DefaultSettingsValidator;
+import org.apache.maven.settings.validation.SettingsValidator;
+
+/**
+ * A factory to create settings builder instances when no dependency injection is available. <em>Note:</em> This class
+ * is only meant as a utility for developers that want to employ the settings builder outside of the Maven build system,
+ * Maven plugins should always acquire settings builder instances via dependency injection. Developers might want to
+ * subclass this factory to provide custom implementations for some of the components used by the settings builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultSettingsBuilderFactory
+{
+
+ protected SettingsReader newSettingsReader()
+ {
+ return new DefaultSettingsReader();
+ }
+
+ protected SettingsWriter newSettingsWriter()
+ {
+ return new DefaultSettingsWriter();
+ }
+
+ protected SettingsValidator newSettingsValidator()
+ {
+ return new DefaultSettingsValidator();
+ }
+
+ /**
+ * Creates a new settings builder instance.
+ *
+ * @return The new settings builder instance, never {@code null}.
+ */
+ public DefaultSettingsBuilder newInstance()
+ {
+ DefaultSettingsBuilder builder = new DefaultSettingsBuilder();
+
+ builder.setSettingsReader( newSettingsReader() );
+ builder.setSettingsWriter( newSettingsWriter() );
+ builder.setSettingsValidator( newSettingsValidator() );
+
+ return builder;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java
new file mode 100644
index 00000000..5a4824e0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java
@@ -0,0 +1,160 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Collects settings that control building of effective settings.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultSettingsBuildingRequest
+ implements SettingsBuildingRequest
+{
+
+ private File globalSettingsFile;
+
+ private File userSettingsFile;
+
+ private SettingsSource globalSettingsSource;
+
+ private SettingsSource userSettingsSource;
+
+ private Properties systemProperties;
+
+ private Properties userProperties;
+
+ @Override
+ public File getGlobalSettingsFile()
+ {
+ return globalSettingsFile;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile )
+ {
+ this.globalSettingsFile = globalSettingsFile;
+
+ return this;
+ }
+
+ @Override
+ public SettingsSource getGlobalSettingsSource()
+ {
+ return globalSettingsSource;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setGlobalSettingsSource( SettingsSource globalSettingsSource )
+ {
+ this.globalSettingsSource = globalSettingsSource;
+
+ return this;
+ }
+
+ @Override
+ public File getUserSettingsFile()
+ {
+ return userSettingsFile;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setUserSettingsFile( File userSettingsFile )
+ {
+ this.userSettingsFile = userSettingsFile;
+
+ return this;
+ }
+
+ @Override
+ public SettingsSource getUserSettingsSource()
+ {
+ return userSettingsSource;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setUserSettingsSource( SettingsSource userSettingsSource )
+ {
+ this.userSettingsSource = userSettingsSource;
+
+ return this;
+ }
+
+ @Override
+ public Properties getSystemProperties()
+ {
+ if ( systemProperties == null )
+ {
+ systemProperties = new Properties();
+ }
+
+ return systemProperties;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setSystemProperties( Properties systemProperties )
+ {
+ if ( systemProperties != null )
+ {
+ this.systemProperties = new Properties();
+ // MNG-5670 guard against ConcurrentModificationException
+ for ( String key : System.getProperties().stringPropertyNames() )
+ {
+ this.systemProperties.put( key, System.getProperty( key ) );
+ }
+ }
+ else
+ {
+ this.systemProperties = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public Properties getUserProperties()
+ {
+ if ( userProperties == null )
+ {
+ userProperties = new Properties();
+ }
+
+ return userProperties;
+ }
+
+ @Override
+ public DefaultSettingsBuildingRequest setUserProperties( Properties userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = new Properties();
+ this.userProperties.putAll( userProperties );
+ }
+ else
+ {
+ this.userProperties = null;
+ }
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
new file mode 100644
index 00000000..5c1392a6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
@@ -0,0 +1,58 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.settings.Settings;
+
+/**
+ * Collects the output of the settings builder.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultSettingsBuildingResult
+ implements SettingsBuildingResult
+{
+
+ private Settings effectiveSettings;
+
+ private List<SettingsProblem> problems;
+
+ public DefaultSettingsBuildingResult( Settings effectiveSettings, List<SettingsProblem> problems )
+ {
+ this.effectiveSettings = effectiveSettings;
+ this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+ }
+
+ @Override
+ public Settings getEffectiveSettings()
+ {
+ return effectiveSettings;
+ }
+
+ @Override
+ public List<SettingsProblem> getProblems()
+ {
+ return problems;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java
new file mode 100644
index 00000000..b261fa1d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblem.java
@@ -0,0 +1,166 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Describes a problem that was encountered during settings building. A problem can either be an exception that was
+ * thrown or a simple string message. In addition, a problem carries a hint about its source, e.g. the settings file
+ * that exhibits the problem.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultSettingsProblem
+ implements SettingsProblem
+{
+
+ private final String source;
+
+ private final int lineNumber;
+
+ private final int columnNumber;
+
+ private final String message;
+
+ private final Exception exception;
+
+ private final Severity severity;
+
+ /**
+ * Creates a new problem with the specified message and exception.
+ *
+ * @param message The message describing the problem, may be {@code null}.
+ * @param severity The severity level of the problem, may be {@code null} to default to
+ * {@link SettingsProblem.Severity#ERROR}.
+ * @param source A hint about the source of the problem like a file path, may be {@code null}.
+ * @param lineNumber The one-based index of the line containing the problem or {@code -1} if unknown.
+ * @param columnNumber The one-based index of the column containing the problem or {@code -1} if unknown.
+ * @param exception The exception that caused this problem, may be {@code null}.
+ */
+ public DefaultSettingsProblem( String message, Severity severity, String source, int lineNumber, int columnNumber,
+ Exception exception )
+ {
+ this.message = message;
+ this.severity = ( severity != null ) ? severity : Severity.ERROR;
+ this.source = ( source != null ) ? source : "";
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ this.exception = exception;
+ }
+
+ @Override
+ public String getSource()
+ {
+ return source;
+ }
+
+ @Override
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+
+ @Override
+ public int getColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ @Override
+ public String getLocation()
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+
+ if ( getSource().length() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( getSource() );
+ }
+
+ if ( getLineNumber() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( "line " ).append( getLineNumber() );
+ }
+
+ if ( getColumnNumber() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( "column " ).append( getColumnNumber() );
+ }
+
+ return buffer.toString();
+ }
+
+ @Override
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String msg;
+
+ if ( message != null && message.length() > 0 )
+ {
+ msg = message;
+ }
+ else
+ {
+ msg = exception.getMessage();
+
+ if ( msg == null )
+ {
+ msg = "";
+ }
+ }
+
+ return msg;
+ }
+
+ @Override
+ public Severity getSeverity()
+ {
+ return severity;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+
+ buffer.append( "[" ).append( getSeverity() ).append( "] " );
+ buffer.append( getMessage() );
+ buffer.append( " @ " ).append( getLocation() );
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java
new file mode 100644
index 00000000..6721379b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsProblemCollector.java
@@ -0,0 +1,70 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.settings.io.SettingsParseException;
+
+/**
+ * Collects problems that are encountered during settings building.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultSettingsProblemCollector
+ implements SettingsProblemCollector
+{
+
+ private List<SettingsProblem> problems;
+
+ private String source;
+
+ public DefaultSettingsProblemCollector( List<SettingsProblem> problems )
+ {
+ this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+ }
+
+ public List<SettingsProblem> getProblems()
+ {
+ return problems;
+ }
+
+ public void setSource( String source )
+ {
+ this.source = source;
+ }
+
+ @Override
+ public void add( SettingsProblem.Severity severity, String message, int line, int column, Exception cause )
+ {
+ if ( line <= 0 && column <= 0 && ( cause instanceof SettingsParseException ) )
+ {
+ SettingsParseException e = (SettingsParseException) cause;
+ line = e.getLineNumber();
+ column = e.getColumnNumber();
+ }
+
+ SettingsProblem problem = new DefaultSettingsProblem( message, severity, source, line, column, cause );
+
+ problems.add( problem );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
new file mode 100644
index 00000000..3c2d32ac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/FileSettingsSource.java
@@ -0,0 +1,59 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+
+import org.apache.maven.building.FileSource;
+
+/**
+ * Wraps an ordinary {@link File} as a settings source.
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link FileSource}
+ */
+@Deprecated
+public class FileSettingsSource extends FileSource
+ implements SettingsSource
+{
+
+ /**
+ * Creates a new settings source backed by the specified file.
+ *
+ * @param settingsFile The settings file, must not be {@code null}.
+ */
+ public FileSettingsSource( File settingsFile )
+ {
+ super( settingsFile );
+ }
+
+ /**
+ * Gets the settings file of this model source.
+ *
+ * @return The underlying settings file, never {@code null}.
+ * @deprecated instead use {@link #getFile()}
+ */
+ @Deprecated
+ public File getSettingsFile()
+ {
+ return getFile();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java
new file mode 100644
index 00000000..61e34e99
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuilder.java
@@ -0,0 +1,40 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Builds the effective settings from a user settings file and/or a global settings file.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsBuilder
+{
+
+ /**
+ * Builds the effective settings of the specified settings files.
+ *
+ * @param request The settings building request that holds the parameters, must not be {@code null}.
+ * @return The result of the settings building, never {@code null}.
+ * @throws SettingsBuildingException If the effective settings could not be built.
+ */
+ SettingsBuildingResult build( SettingsBuildingRequest request )
+ throws SettingsBuildingException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java
new file mode 100644
index 00000000..f7d48e4b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingException.java
@@ -0,0 +1,90 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Signals one ore more errors during settings building. The settings builder tries to collect as many problems as
+ * possible before eventually failing to provide callers with rich error information. Use {@link #getProblems()} to
+ * query the details of the failure.
+ *
+ * @author Benjamin Bentmann
+ */
+public class SettingsBuildingException
+ extends Exception
+{
+
+ private final List<SettingsProblem> problems;
+
+ /**
+ * Creates a new exception with the specified problems.
+ *
+ * @param problems The problems that causes this exception, may be {@code null}.
+ */
+ public SettingsBuildingException( List<SettingsProblem> problems )
+ {
+ super( toMessage( problems ) );
+
+ this.problems = new ArrayList<SettingsProblem>();
+ if ( problems != null )
+ {
+ this.problems.addAll( problems );
+ }
+ }
+
+ /**
+ * Gets the problems that caused this exception.
+ *
+ * @return The problems that caused this exception, never {@code null}.
+ */
+ public List<SettingsProblem> getProblems()
+ {
+ return problems;
+ }
+
+ private static String toMessage( List<SettingsProblem> problems )
+ {
+ StringWriter buffer = new StringWriter( 1024 );
+
+ PrintWriter writer = new PrintWriter( buffer );
+
+ writer.print( problems.size() );
+ writer.print( ( problems.size() == 1 ) ? " problem was " : " problems were " );
+ writer.print( "encountered while building the effective settings" );
+ writer.println();
+
+ for ( SettingsProblem problem : problems )
+ {
+ writer.print( "[" );
+ writer.print( problem.getSeverity() );
+ writer.print( "] " );
+ writer.print( problem.getMessage() );
+ writer.print( " @ " );
+ writer.println( problem.getLocation() );
+ }
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java
new file mode 100644
index 00000000..92d87d80
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingRequest.java
@@ -0,0 +1,131 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.util.Properties;
+
+/**
+ * Collects settings that control the building of effective settings.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsBuildingRequest
+{
+
+ /**
+ * Gets the global settings file.
+ *
+ * @return The global settings file or {@code null} if none.
+ */
+ File getGlobalSettingsFile();
+
+ /**
+ * Sets the global settings file. A non-existent settings file is equivalent to empty settings. If both user
+ * settings and global settings are given, the user settings take precedence.
+ *
+ * @param globalSettingsFile The global settings file, may be {@code null} to disable global settings.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setGlobalSettingsFile( File globalSettingsFile );
+
+ /**
+ * Gets the global settings source.
+ *
+ * @return The global settings source or {@code null} if none.
+ */
+ SettingsSource getGlobalSettingsSource();
+
+ /**
+ * Sets the global settings source. If both user settings and a global settings are given, the user settings take
+ * precedence.
+ *
+ * @param globalSettingsSource The global settings source, may be {@code null} to disable global settings.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setGlobalSettingsSource( SettingsSource globalSettingsSource );
+
+ /**
+ * Gets the user settings file.
+ *
+ * @return The user settings file or {@code null} if none.
+ */
+ File getUserSettingsFile();
+
+ /**
+ * Sets the user settings file. A non-existent settings file is equivalent to empty settings. If both a user
+ * settings file and a global settings file are given, the user settings take precedence.
+ *
+ * @param userSettingsFile The user settings file, may be {@code null} to disable user settings.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setUserSettingsFile( File userSettingsFile );
+
+ /**
+ * Gets the user settings source.
+ *
+ * @return The user settings source or {@code null} if none.
+ */
+ SettingsSource getUserSettingsSource();
+
+ /**
+ * Sets the user settings source. If both user settings and a global settings are given, the user settings take
+ * precedence.
+ *
+ * @param userSettingsSource The user settings source, may be {@code null} to disable user settings.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setUserSettingsSource( SettingsSource userSettingsSource );
+
+ /**
+ * Gets the system properties to use for interpolation. The system properties are collected from the runtime
+ * environment like {@link System#getProperties()} and environment variables.
+ *
+ * @return The system properties, never {@code null}.
+ */
+ Properties getSystemProperties();
+
+ /**
+ * Sets the system properties to use for interpolation. The system properties are collected from the runtime
+ * environment like {@link System#getProperties()} and environment variables.
+ *
+ * @param systemProperties The system properties, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setSystemProperties( Properties systemProperties );
+
+ /**
+ * Gets the user properties to use for interpolation. The user properties have been configured directly by the user
+ * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
+ *
+ * @return The user properties, never {@code null}.
+ */
+ Properties getUserProperties();
+
+ /**
+ * Sets the user properties to use for interpolation. The user properties have been configured directly by the user
+ * on his discretion, e.g. via the {@code -Dkey=value} parameter on the command line.
+ *
+ * @param userProperties The user properties, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ SettingsBuildingRequest setUserProperties( Properties userProperties );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java
new file mode 100644
index 00000000..43b2359f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java
@@ -0,0 +1,50 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.maven.settings.Settings;
+
+/**
+ * Collects the output of the settings builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsBuildingResult
+{
+
+ /**
+ * Gets the assembled settings.
+ *
+ * @return The assembled settings, never {@code null}.
+ */
+ Settings getEffectiveSettings();
+
+ /**
+ * Gets the problems that were encountered during the settings building. Note that only problems of severity
+ * {@link SettingsProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause
+ * the settings builder to fail with a {@link SettingsBuildingException}.
+ *
+ * @return The problems that were encountered during the settings building, can be empty but never {@code null}.
+ */
+ List<SettingsProblem> getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java
new file mode 100644
index 00000000..e9e563d9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblem.java
@@ -0,0 +1,100 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Describes a problem that was encountered during settings building. A problem can either be an exception that was
+ * thrown or a simple string message. In addition, a problem carries a hint about its source, e.g. the settings file
+ * that exhibits the problem.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsProblem
+{
+
+ /**
+ * The different severity levels for a problem, in decreasing order.
+ */
+ enum Severity
+ {
+
+ FATAL, //
+ ERROR, //
+ WARNING //
+
+ }
+
+ /**
+ * Gets the hint about the source of the problem. While the syntax of this hint is unspecified and depends on the
+ * creator of the problem, the general expectation is that the hint provides sufficient information to the user to
+ * track the problem back to its origin. A concrete example for such a source hint can be the file path or URL from
+ * which the settings were read.
+ *
+ * @return The hint about the source of the problem or an empty string if unknown, never {@code null}.
+ */
+ String getSource();
+
+ /**
+ * Gets the one-based index of the line containing the problem. The line number should refer to some text file that
+ * is given by {@link #getSource()}.
+ *
+ * @return The one-based index of the line containing the problem or a non-positive value if unknown.
+ */
+ int getLineNumber();
+
+ /**
+ * Gets the one-based index of the column containing the problem. The column number should refer to some text file
+ * that is given by {@link #getSource()}.
+ *
+ * @return The one-based index of the column containing the problem or non-positive value if unknown.
+ */
+ int getColumnNumber();
+
+ /**
+ * Gets the location of the problem. The location is a user-friendly combination of the values from
+ * {@link #getSource()}, {@link #getLineNumber()} and {@link #getColumnNumber()}. The exact syntax of the returned
+ * value is undefined.
+ *
+ * @return The location of the problem, never {@code null}.
+ */
+ String getLocation();
+
+ /**
+ * Gets the exception that caused this problem (if any).
+ *
+ * @return The exception that caused this problem or {@code null} if not applicable.
+ */
+ Exception getException();
+
+ /**
+ * Gets the message that describes this problem.
+ *
+ * @return The message describing this problem, never {@code null}.
+ */
+ String getMessage();
+
+ /**
+ * Gets the severity level of this problem.
+ *
+ * @return The severity level of this problem, never {@code null}.
+ */
+ Severity getSeverity();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java
new file mode 100644
index 00000000..63869c0a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsProblemCollector.java
@@ -0,0 +1,41 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Collects problems that are encountered during settings building.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsProblemCollector
+{
+
+ /**
+ * Adds the specified problem.
+ *
+ * @param severity The severity of the problem, must not be {@code null}.
+ * @param message The detail message of the problem, may be {@code null}.
+ * @param line The one-based index of the line containing the problem or {@code -1} if unknown.
+ * @param column The one-based index of the column containing the problem or {@code -1} if unknown.
+ * @param cause The cause of the problem, may be {@code null}.
+ */
+ void add( SettingsProblem.Severity severity, String message, int line, int column, Exception cause );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
new file mode 100644
index 00000000..413a3570
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsSource.java
@@ -0,0 +1,35 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.building.Source;
+
+/**
+ * Provides access to the contents of settings independently of the backing store (e.g. file system, database, memory).
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link Source}
+ */
+@Deprecated
+public interface SettingsSource extends Source
+{
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
new file mode 100644
index 00000000..dbe97580
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/StringSettingsSource.java
@@ -0,0 +1,69 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.building.StringSource;
+
+/**
+ * Wraps an ordinary {@link CharSequence} as a settings source.
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link StringSource}
+ */
+@Deprecated
+public class StringSettingsSource extends StringSource
+ implements SettingsSource
+{
+
+ /**
+ * Creates a new settings source backed by the specified string.
+ *
+ * @param settings The settings' string representation, may be empty or {@code null}.
+ */
+ public StringSettingsSource( CharSequence settings )
+ {
+ this( settings, null );
+ }
+
+ /**
+ * Creates a new settings source backed by the specified string.
+ *
+ * @param settings The settings' string representation, may be empty or {@code null}.
+ * @param location The location to report for this use, may be {@code null}.
+ */
+ public StringSettingsSource( CharSequence settings, String location )
+ {
+ super( settings, location );
+ }
+
+ /**
+ * Gets the character sequence of this settings source.
+ *
+ * @return The underlying character stream, never {@code null}.
+ * @deprecated instead use {@link #getContent()}
+ */
+ @Deprecated
+ public String getSettings()
+ {
+ return getContent();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
new file mode 100644
index 00000000..2b40f648
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/building/UrlSettingsSource.java
@@ -0,0 +1,60 @@
+package org.apache.maven.settings.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.net.URL;
+
+import org.apache.maven.building.UrlSource;
+
+/**
+ * Wraps an ordinary {@link URL} as a settings source.
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link UrlSource}
+ */
+@Deprecated
+public class UrlSettingsSource extends UrlSource
+ implements SettingsSource
+{
+
+ /**
+ * Creates a new model source backed by the specified URL.
+ *
+ * @param settingsUrl The settings URL, must not be {@code null}.
+ */
+ public UrlSettingsSource( URL settingsUrl )
+ {
+ super( settingsUrl );
+ }
+
+ /**
+ * Gets the settings URL of this model source.
+ *
+ * @return The underlying settings URL, never {@code null}.
+ * @deprecated instead use {@link #getUrl()}
+ */
+ @Deprecated
+ public URL getSettingsUrl()
+ {
+ return getUrl();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java
new file mode 100644
index 00000000..acdb4b25
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java
@@ -0,0 +1,110 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.building.DefaultSettingsProblem;
+import org.apache.maven.settings.building.SettingsProblem;
+import org.apache.maven.settings.building.SettingsProblem.Severity;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
+import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;
+
+/**
+ * Decrypts passwords in the settings.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = SettingsDecrypter.class )
+public class DefaultSettingsDecrypter
+ implements SettingsDecrypter
+{
+
+ @Requirement( hint = "maven" )
+ private SecDispatcher securityDispatcher;
+
+ @Override
+ public SettingsDecryptionResult decrypt( SettingsDecryptionRequest request )
+ {
+ List<SettingsProblem> problems = new ArrayList<SettingsProblem>();
+
+ List<Server> servers = new ArrayList<Server>();
+
+ for ( Server server : request.getServers() )
+ {
+ server = server.clone();
+
+ servers.add( server );
+
+ try
+ {
+ server.setPassword( decrypt( server.getPassword() ) );
+ }
+ catch ( SecDispatcherException e )
+ {
+ problems.add( new DefaultSettingsProblem( "Failed to decrypt password for server " + server.getId()
+ + ": " + e.getMessage(), Severity.ERROR, "server: " + server.getId(), -1, -1, e ) );
+ }
+
+ try
+ {
+ server.setPassphrase( decrypt( server.getPassphrase() ) );
+ }
+ catch ( SecDispatcherException e )
+ {
+ problems.add( new DefaultSettingsProblem( "Failed to decrypt passphrase for server " + server.getId()
+ + ": " + e.getMessage(), Severity.ERROR, "server: " + server.getId(), -1, -1, e ) );
+ }
+ }
+
+ List<Proxy> proxies = new ArrayList<Proxy>();
+
+ for ( Proxy proxy : request.getProxies() )
+ {
+ proxy = proxy.clone();
+
+ proxies.add( proxy );
+
+ try
+ {
+ proxy.setPassword( decrypt( proxy.getPassword() ) );
+ }
+ catch ( SecDispatcherException e )
+ {
+ problems.add( new DefaultSettingsProblem( "Failed to decrypt password for proxy " + proxy.getId()
+ + ": " + e.getMessage(), Severity.ERROR, "proxy: " + proxy.getId(), -1, -1, e ) );
+ }
+ }
+
+ return new DefaultSettingsDecryptionResult( servers, proxies, problems );
+ }
+
+ private String decrypt( String str )
+ throws SecDispatcherException
+ {
+ return ( str == null ) ? null : securityDispatcher.decrypt( str );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java
new file mode 100644
index 00000000..31185f1e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java
@@ -0,0 +1,120 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+
+/**
+ * Collects parameters that control the decryption of settings.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultSettingsDecryptionRequest
+ implements SettingsDecryptionRequest
+{
+
+ private List<Server> servers;
+
+ private List<Proxy> proxies;
+
+ /**
+ * Creates an empty request.
+ */
+ public DefaultSettingsDecryptionRequest()
+ {
+ // does nothing
+ }
+
+ /**
+ * Creates a new request to decrypt the specified settings.
+ *
+ * @param settings The settings to decrypt, must not be {@code null}.
+ */
+ public DefaultSettingsDecryptionRequest( Settings settings )
+ {
+ setServers( settings.getServers() );
+ setProxies( settings.getProxies() );
+ }
+
+ /**
+ * Creates a new request to decrypt the specified server.
+ *
+ * @param server The server to decrypt, must not be {@code null}.
+ */
+ public DefaultSettingsDecryptionRequest( Server server )
+ {
+ this.servers = new ArrayList<Server>( Arrays.asList( server ) );
+ }
+
+ /**
+ * Creates a new request to decrypt the specified proxy.
+ *
+ * @param proxy The proxy to decrypt, must not be {@code null}.
+ */
+ public DefaultSettingsDecryptionRequest( Proxy proxy )
+ {
+ this.proxies = new ArrayList<Proxy>( Arrays.asList( proxy ) );
+ }
+
+ @Override
+ public List<Server> getServers()
+ {
+ if ( servers == null )
+ {
+ servers = new ArrayList<Server>();
+ }
+
+ return servers;
+ }
+
+ @Override
+ public DefaultSettingsDecryptionRequest setServers( List<Server> servers )
+ {
+ this.servers = servers;
+
+ return this;
+ }
+
+ @Override
+ public List<Proxy> getProxies()
+ {
+ if ( proxies == null )
+ {
+ proxies = new ArrayList<Proxy>();
+ }
+
+ return proxies;
+ }
+
+ @Override
+ public DefaultSettingsDecryptionRequest setProxies( List<Proxy> proxies )
+ {
+ this.proxies = proxies;
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
new file mode 100644
index 00000000..33ee5a1a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
@@ -0,0 +1,81 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.building.SettingsProblem;
+
+/**
+ * Collects the output of the settings decrypter.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultSettingsDecryptionResult
+ implements SettingsDecryptionResult
+{
+
+ private List<Server> servers;
+
+ private List<Proxy> proxies;
+
+ private List<SettingsProblem> problems;
+
+ public DefaultSettingsDecryptionResult( List<Server> servers, List<Proxy> proxies, List<SettingsProblem> problems )
+ {
+ this.servers = ( servers != null ) ? servers : new ArrayList<Server>();
+ this.proxies = ( proxies != null ) ? proxies : new ArrayList<Proxy>();
+ this.problems = ( problems != null ) ? problems : new ArrayList<SettingsProblem>();
+ }
+
+ @Override
+ public Server getServer()
+ {
+ return servers.isEmpty() ? null : servers.get( 0 );
+ }
+
+ @Override
+ public List<Server> getServers()
+ {
+ return servers;
+ }
+
+ @Override
+ public Proxy getProxy()
+ {
+ return proxies.isEmpty() ? null : proxies.get( 0 );
+ }
+
+ @Override
+ public List<Proxy> getProxies()
+ {
+ return proxies;
+ }
+
+ @Override
+ public List<SettingsProblem> getProblems()
+ {
+ return problems;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecrypter.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecrypter.java
new file mode 100644
index 00000000..b34c3944
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecrypter.java
@@ -0,0 +1,38 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Decrypts passwords in the settings.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsDecrypter
+{
+
+ /**
+ * Decrypts passwords in the settings.
+ *
+ * @param request The settings decryption request that holds the parameters, must not be {@code null}.
+ * @return The result of the settings decryption, never {@code null}.
+ */
+ SettingsDecryptionResult decrypt( SettingsDecryptionRequest request );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java
new file mode 100644
index 00000000..b344a99e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java
@@ -0,0 +1,65 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+
+/**
+ * Collects parameters that control the decryption of settings.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsDecryptionRequest
+{
+
+ /**
+ * Gets the servers whose passwords should be decrypted.
+ *
+ * @return The servers to decrypt, never {@code null}.
+ */
+ List<Server> getServers();
+
+ /**
+ * Sets the servers whose passwords should be decrypted.
+ *
+ * @param servers The servers to decrypt, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ SettingsDecryptionRequest setServers( List<Server> servers );
+
+ /**
+ * Gets the proxies whose passwords should be decrypted.
+ *
+ * @return The proxies to decrypt, never {@code null}.
+ */
+ List<Proxy> getProxies();
+
+ /**
+ * Sets the proxies whose passwords should be decrypted.
+ *
+ * @param proxies The proxies to decrypt, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ SettingsDecryptionRequest setProxies( List<Proxy> proxies );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java
new file mode 100644
index 00000000..5b7b1f4b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java
@@ -0,0 +1,71 @@
+package org.apache.maven.settings.crypto;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.List;
+
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.building.SettingsProblem;
+
+/**
+ * Collects the output of the settings decrypter.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsDecryptionResult
+{
+
+ /**
+ * Gets the decrypted server. This is a convenience method to retrieve the first element from {@link #getServers()}.
+ *
+ * @return The decrypted server or {@code null}.
+ */
+ Server getServer();
+
+ /**
+ * Gets the decrypted servers.
+ *
+ * @return The decrypted server, can be empty but never {@code null}.
+ */
+ List<Server> getServers();
+
+ /**
+ * Gets the decrypted proxy. This is a convenience method to retrieve the first element from {@link #getProxies()}.
+ *
+ * @return The decrypted proxy or {@code null}.
+ */
+ Proxy getProxy();
+
+ /**
+ * Gets the decrypted proxies.
+ *
+ * @return The decrypted proxy, can be empty but never {@code null}.
+ */
+ List<Proxy> getProxies();
+
+ /**
+ * Gets the problems that were encountered during the settings decryption.
+ *
+ * @return The problems that were encountered during the decryption, can be empty but never {@code null}.
+ */
+ List<SettingsProblem> getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
new file mode 100644
index 00000000..590423ef
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
@@ -0,0 +1,113 @@
+package org.apache.maven.settings.io;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Handles deserialization of settings from the default textual format.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = SettingsReader.class )
+public class DefaultSettingsReader
+ implements SettingsReader
+{
+
+ @Override
+ public Settings read( File input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input file missing" );
+ }
+
+ Settings settings = read( ReaderFactory.newXmlReader( input ), options );
+
+ return settings;
+ }
+
+ @Override
+ public Settings read( Reader input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input reader missing" );
+ }
+
+ try
+ {
+ SettingsXpp3Reader r = new SettingsXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ @Override
+ public Settings read( InputStream input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input stream missing" );
+ }
+
+ try
+ {
+ SettingsXpp3Reader r = new SettingsXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ private boolean isStrict( Map<String, ?> options )
+ {
+ Object value = ( options != null ) ? options.get( IS_STRICT ) : null;
+ return value == null || Boolean.parseBoolean( value.toString() );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
new file mode 100644
index 00000000..88f78a03
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
@@ -0,0 +1,118 @@
+package org.apache.maven.settings.io;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Map;
+
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.WriterFactory;
+
+/**
+ * Handles serialization of settings into the default textual format.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = SettingsWriter.class )
+public class DefaultSettingsWriter
+ implements SettingsWriter
+{
+
+ @Override
+ public void write( File output, Map<String, Object> options, Settings settings )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output file missing" );
+ }
+
+ if ( settings == null )
+ {
+ throw new IllegalArgumentException( "settings missing" );
+ }
+
+ output.getParentFile().mkdirs();
+
+ write( WriterFactory.newXmlWriter( output ), options, settings );
+ }
+
+ @Override
+ public void write( Writer output, Map<String, Object> options, Settings settings )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output writer missing" );
+ }
+
+ if ( settings == null )
+ {
+ throw new IllegalArgumentException( "settings missing" );
+ }
+
+ try
+ {
+ SettingsXpp3Writer w = new SettingsXpp3Writer();
+ w.write( output, settings );
+ }
+ finally
+ {
+ IOUtil.close( output );
+ }
+ }
+
+ @Override
+ public void write( OutputStream output, Map<String, Object> options, Settings settings )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output stream missing" );
+ }
+
+ if ( settings == null )
+ {
+ throw new IllegalArgumentException( "settings missing" );
+ }
+
+ try
+ {
+ String encoding = settings.getModelEncoding();
+ if ( encoding == null || encoding.length() <= 0 )
+ {
+ encoding = "UTF-8";
+ }
+ write( new OutputStreamWriter( output, encoding ), options, settings );
+ }
+ finally
+ {
+ IOUtil.close( output );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsParseException.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsParseException.java
new file mode 100644
index 00000000..425e6d8e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsParseException.java
@@ -0,0 +1,93 @@
+package org.apache.maven.settings.io;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+
+/**
+ * Signals a failure to parse the settings due to invalid syntax (e.g. non-wellformed XML or unknown elements).
+ *
+ * @author Benjamin Bentmann
+ */
+public class SettingsParseException
+ extends IOException
+{
+
+ /**
+ * The one-based index of the line containing the error.
+ */
+ private final int lineNumber;
+
+ /**
+ * The one-based index of the column containing the error.
+ */
+ private final int columnNumber;
+
+ /**
+ * Creates a new parser exception with the specified details.
+ *
+ * @param message The error message, may be {@code null}.
+ * @param lineNumber The one-based index of the line containing the error or {@code -1} if unknown.
+ * @param columnNumber The one-based index of the column containing the error or {@code -1} if unknown.
+ */
+ public SettingsParseException( String message, int lineNumber, int columnNumber )
+ {
+ super( message );
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ }
+
+ /**
+ * Creates a new parser exception with the specified details.
+ *
+ * @param message The error message, may be {@code null}.
+ * @param lineNumber The one-based index of the line containing the error or {@code -1} if unknown.
+ * @param columnNumber The one-based index of the column containing the error or {@code -1} if unknown.
+ * @param cause The nested cause of this error, may be {@code null}.
+ */
+ public SettingsParseException( String message, int lineNumber, int columnNumber, Throwable cause )
+ {
+ super( message );
+ initCause( cause );
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ }
+
+ /**
+ * Gets the one-based index of the line containing the error.
+ *
+ * @return The one-based index of the line containing the error or a non-positive value if unknown.
+ */
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+
+ /**
+ * Gets the one-based index of the column containing the error.
+ *
+ * @return The one-based index of the column containing the error or non-positive value if unknown.
+ */
+ public int getColumnNumber()
+ {
+ return columnNumber;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsReader.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsReader.java
new file mode 100644
index 00000000..7817df65
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsReader.java
@@ -0,0 +1,82 @@
+package org.apache.maven.settings.io;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+import org.apache.maven.settings.Settings;
+
+/**
+ * Handles deserialization of settings from some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsReader
+{
+
+ /**
+ * The key for the option to enable strict parsing. This option is of type {@link Boolean} and defaults to {@code
+ * true}. If {@code false}, unknown elements will be ignored instead of causing a failure.
+ */
+ String IS_STRICT = "org.apache.maven.settings.io.isStrict";
+
+ /**
+ * Reads the settings from the specified file.
+ *
+ * @param input The file to deserialize the settings from, must not be {@code null}.
+ * @param options The options to use for deserialization, may be {@code null} to use the default values.
+ * @return The deserialized settings, never {@code null}.
+ * @throws IOException If the settings could not be deserialized.
+ * @throws SettingsParseException If the input format could not be parsed.
+ */
+ Settings read( File input, Map<String, ?> options )
+ throws IOException, SettingsParseException;
+
+ /**
+ * Reads the settings from the specified character reader. The reader will be automatically closed before the method
+ * returns.
+ *
+ * @param input The reader to deserialize the settings from, must not be {@code null}.
+ * @param options The options to use for deserialization, may be {@code null} to use the default values.
+ * @return The deserialized settings, never {@code null}.
+ * @throws IOException If the settings could not be deserialized.
+ * @throws SettingsParseException If the input format could not be parsed.
+ */
+ Settings read( Reader input, Map<String, ?> options )
+ throws IOException, SettingsParseException;
+
+ /**
+ * Reads the settings from the specified byte stream. The stream will be automatically closed before the method
+ * returns.
+ *
+ * @param input The stream to deserialize the settings from, must not be {@code null}.
+ * @param options The options to use for deserialization, may be {@code null} to use the default values.
+ * @return The deserialized settings, never {@code null}.
+ * @throws IOException If the settings could not be deserialized.
+ * @throws SettingsParseException If the input format could not be parsed.
+ */
+ Settings read( InputStream input, Map<String, ?> options )
+ throws IOException, SettingsParseException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsWriter.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsWriter.java
new file mode 100644
index 00000000..54bfcf0c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsWriter.java
@@ -0,0 +1,74 @@
+package org.apache.maven.settings.io;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.Map;
+
+import org.apache.maven.settings.Settings;
+
+/**
+ * Handles serialization of settings into some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SettingsWriter
+{
+
+ /**
+ * Writes the supplied settings to the specified file. Any non-existing parent directories of the output file will
+ * be created automatically.
+ *
+ * @param output The file to serialize the settings to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param settings The settings to serialize, must not be {@code null}.
+ * @throws IOException If the settings could not be serialized.
+ */
+ void write( File output, Map<String, Object> options, Settings settings )
+ throws IOException;
+
+ /**
+ * Writes the supplied settings to the specified character writer. The writer will be automatically closed before
+ * the method returns.
+ *
+ * @param output The writer to serialize the settings to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param settings The settings to serialize, must not be {@code null}.
+ * @throws IOException If the settings could not be serialized.
+ */
+ void write( Writer output, Map<String, Object> options, Settings settings )
+ throws IOException;
+
+ /**
+ * Writes the supplied settings to the specified byte stream. The stream will be automatically closed before the
+ * method returns.
+ *
+ * @param output The stream to serialize the settings to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param settings The settings to serialize, must not be {@code null}.
+ * @throws IOException If the settings could not be serialized.
+ */
+ void write( OutputStream output, Map<String, Object> options, Settings settings )
+ throws IOException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/merge/MavenSettingsMerger.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/merge/MavenSettingsMerger.java
new file mode 100644
index 00000000..fd419fb2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/merge/MavenSettingsMerger.java
@@ -0,0 +1,142 @@
+package org.apache.maven.settings.merge;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.settings.IdentifiableBase;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @author Benjamin Bentmann
+ */
+public class MavenSettingsMerger
+{
+
+ /**
+ * @param dominant
+ * @param recessive
+ * @param recessiveSourceLevel
+ */
+ public void merge( Settings dominant, Settings recessive, String recessiveSourceLevel )
+ {
+ if ( dominant == null || recessive == null )
+ {
+ return;
+ }
+
+ recessive.setSourceLevel( recessiveSourceLevel );
+
+ List<String> dominantActiveProfiles = dominant.getActiveProfiles();
+ List<String> recessiveActiveProfiles = recessive.getActiveProfiles();
+
+ if ( recessiveActiveProfiles != null )
+ {
+ if ( dominantActiveProfiles == null )
+ {
+ dominantActiveProfiles = new ArrayList<String>();
+ dominant.setActiveProfiles( dominantActiveProfiles );
+ }
+
+ for ( String profileId : recessiveActiveProfiles )
+ {
+ if ( !dominantActiveProfiles.contains( profileId ) )
+ {
+ dominantActiveProfiles.add( profileId );
+ }
+ }
+ }
+
+ List<String> dominantPluginGroupIds = dominant.getPluginGroups();
+
+ List<String> recessivePluginGroupIds = recessive.getPluginGroups();
+
+ if ( recessivePluginGroupIds != null )
+ {
+ if ( dominantPluginGroupIds == null )
+ {
+ dominantPluginGroupIds = new ArrayList<String>();
+ dominant.setPluginGroups( dominantPluginGroupIds );
+ }
+
+ for ( String pluginGroupId : recessivePluginGroupIds )
+ {
+ if ( !dominantPluginGroupIds.contains( pluginGroupId ) )
+ {
+ dominantPluginGroupIds.add( pluginGroupId );
+ }
+ }
+ }
+
+ if ( StringUtils.isEmpty( dominant.getLocalRepository() ) )
+ {
+ dominant.setLocalRepository( recessive.getLocalRepository() );
+ }
+
+ shallowMergeById( dominant.getMirrors(), recessive.getMirrors(), recessiveSourceLevel );
+ shallowMergeById( dominant.getServers(), recessive.getServers(), recessiveSourceLevel );
+ shallowMergeById( dominant.getProxies(), recessive.getProxies(), recessiveSourceLevel );
+ shallowMergeById( dominant.getProfiles(), recessive.getProfiles(), recessiveSourceLevel );
+
+ }
+
+ /**
+ * @param dominant
+ * @param recessive
+ * @param recessiveSourceLevel
+ */
+ private static <T extends IdentifiableBase> void shallowMergeById( List<T> dominant, List<T> recessive,
+ String recessiveSourceLevel )
+ {
+ Map<String, T> dominantById = mapById( dominant );
+
+ for ( T identifiable : recessive )
+ {
+ if ( !dominantById.containsKey( identifiable.getId() ) )
+ {
+ identifiable.setSourceLevel( recessiveSourceLevel );
+
+ dominant.add( identifiable );
+ }
+ }
+ }
+
+ /**
+ * @param identifiables
+ * @return a map
+ */
+ private static <T extends IdentifiableBase> Map<String, T> mapById( List<T> identifiables )
+ {
+ Map<String, T> byId = new HashMap<String, T>();
+
+ for ( T identifiable : identifiables )
+ {
+ byId.put( identifiable.getId(), identifiable );
+ }
+
+ return byId;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
new file mode 100644
index 00000000..5d17456d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
@@ -0,0 +1,285 @@
+package org.apache.maven.settings.validation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Profile;
+import org.apache.maven.settings.Repository;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.building.SettingsProblem.Severity;
+import org.apache.maven.settings.building.SettingsProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author Milos Kleint
+ */
+@Component( role = SettingsValidator.class )
+public class DefaultSettingsValidator
+ implements SettingsValidator
+{
+
+ private static final String ID_REGEX = "[A-Za-z0-9_\\-.]+";
+
+ private static final String ILLEGAL_FS_CHARS = "\\/:\"<>|?*";
+
+ private static final String ILLEGAL_REPO_ID_CHARS = ILLEGAL_FS_CHARS;
+
+ @Override
+ public void validate( Settings settings, SettingsProblemCollector problems )
+ {
+ if ( settings.isUsePluginRegistry() )
+ {
+ addViolation( problems, Severity.WARNING, "usePluginRegistry", null, "is deprecated and has no effect." );
+ }
+
+ List<String> pluginGroups = settings.getPluginGroups();
+
+ if ( pluginGroups != null )
+ {
+ for ( int i = 0; i < pluginGroups.size(); i++ )
+ {
+ String pluginGroup = pluginGroups.get( i ).trim();
+
+ if ( StringUtils.isBlank( pluginGroup ) )
+ {
+ addViolation( problems, Severity.ERROR, "pluginGroups.pluginGroup[" + i + "]", null,
+ "must not be empty" );
+ }
+ else if ( !pluginGroup.matches( ID_REGEX ) )
+ {
+ addViolation( problems, Severity.ERROR, "pluginGroups.pluginGroup[" + i + "]", null,
+ "must denote a valid group id and match the pattern " + ID_REGEX );
+ }
+ }
+ }
+
+ List<Server> servers = settings.getServers();
+
+ if ( servers != null )
+ {
+ Set<String> serverIds = new HashSet<String>();
+
+ for ( int i = 0; i < servers.size(); i++ )
+ {
+ Server server = servers.get( i );
+
+ validateStringNotEmpty( problems, "servers.server[" + i + "].id", server.getId(), null );
+
+ if ( !serverIds.add( server.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, "servers.server.id", null,
+ "must be unique but found duplicate server with id " + server.getId() );
+ }
+ }
+ }
+
+ List<Mirror> mirrors = settings.getMirrors();
+
+ if ( mirrors != null )
+ {
+ for ( Mirror mirror : mirrors )
+ {
+ validateStringNotEmpty( problems, "mirrors.mirror.id", mirror.getId(), mirror.getUrl() );
+
+ validateBannedCharacters( problems, "mirrors.mirror.id", Severity.WARNING, mirror.getId(), null,
+ ILLEGAL_REPO_ID_CHARS );
+
+ if ( "local".equals( mirror.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, "mirrors.mirror.id", null, "must not be 'local'"
+ + ", this identifier is reserved for the local repository"
+ + ", using it for other repositories will corrupt your repository metadata." );
+ }
+
+ validateStringNotEmpty( problems, "mirrors.mirror.url", mirror.getUrl(), mirror.getId() );
+
+ validateStringNotEmpty( problems, "mirrors.mirror.mirrorOf", mirror.getMirrorOf(), mirror.getId() );
+ }
+ }
+
+ List<Profile> profiles = settings.getProfiles();
+
+ if ( profiles != null )
+ {
+ Set<String> profileIds = new HashSet<String>();
+
+ for ( Profile profile : profiles )
+ {
+ if ( !profileIds.add( profile.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, "profiles.profile.id", null,
+ "must be unique but found duplicate profile with id " + profile.getId() );
+ }
+
+ String prefix = "profiles.profile[" + profile.getId() + "].";
+
+ validateRepositories( problems, profile.getRepositories(), prefix + "repositories.repository" );
+ validateRepositories( problems, profile.getPluginRepositories(), prefix
+ + "pluginRepositories.pluginRepository" );
+ }
+ }
+
+ List<Proxy> proxies = settings.getProxies();
+
+ if ( proxies != null )
+ {
+ Set<String> proxyIds = new HashSet<String>();
+
+ for ( Proxy proxy : proxies )
+ {
+ if ( !proxyIds.add( proxy.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, "proxies.proxy.id", null,
+ "must be unique but found duplicate proxy with id " + proxy.getId() );
+ }
+ validateStringNotEmpty( problems, "proxies.proxy.host", proxy.getHost(), proxy.getId() );
+ }
+ }
+ }
+
+ private void validateRepositories( SettingsProblemCollector problems, List<Repository> repositories, String prefix )
+ {
+ Set<String> repoIds = new HashSet<String>();
+
+ for ( Repository repository : repositories )
+ {
+ validateStringNotEmpty( problems, prefix + ".id", repository.getId(), repository.getUrl() );
+
+ validateBannedCharacters( problems, prefix + ".id", Severity.WARNING, repository.getId(), null,
+ ILLEGAL_REPO_ID_CHARS );
+
+ if ( "local".equals( repository.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, prefix + ".id", null, "must not be 'local'"
+ + ", this identifier is reserved for the local repository"
+ + ", using it for other repositories will corrupt your repository metadata." );
+ }
+
+ if ( !repoIds.add( repository.getId() ) )
+ {
+ addViolation( problems, Severity.WARNING, prefix + ".id", null,
+ "must be unique but found duplicate repository with id " + repository.getId() );
+ }
+
+ validateStringNotEmpty( problems, prefix + ".url", repository.getUrl(), repository.getId() );
+
+ if ( "legacy".equals( repository.getLayout() ) )
+ {
+ addViolation( problems, Severity.WARNING, prefix + ".layout", repository.getId(),
+ "uses the unsupported value 'legacy', artifact resolution might fail." );
+ }
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // Field validation
+ // ----------------------------------------------------------------------
+
+ /**
+ * Asserts:
+ * <p/>
+ * <ul>
+ * <li><code>string.length != null</code>
+ * <li><code>string.length > 0</code>
+ * </ul>
+ */
+ private static boolean validateStringNotEmpty( SettingsProblemCollector problems, String fieldName, String string,
+ String sourceHint )
+ {
+ if ( !validateNotNull( problems, fieldName, string, sourceHint ) )
+ {
+ return false;
+ }
+
+ if ( string.length() > 0 )
+ {
+ return true;
+ }
+
+ addViolation( problems, Severity.ERROR, fieldName, sourceHint, "is missing" );
+
+ return false;
+ }
+
+ /**
+ * Asserts:
+ * <p/>
+ * <ul>
+ * <li><code>string != null</code>
+ * </ul>
+ */
+ private static boolean validateNotNull( SettingsProblemCollector problems, String fieldName, Object object,
+ String sourceHint )
+ {
+ if ( object != null )
+ {
+ return true;
+ }
+
+ addViolation( problems, Severity.ERROR, fieldName, sourceHint, "is missing" );
+
+ return false;
+ }
+
+ private static boolean validateBannedCharacters( SettingsProblemCollector problems, String fieldName,
+ Severity severity, String string, String sourceHint,
+ String banned )
+ {
+ if ( string != null )
+ {
+ for ( int i = string.length() - 1; i >= 0; i-- )
+ {
+ if ( banned.indexOf( string.charAt( i ) ) >= 0 )
+ {
+ addViolation( problems, severity, fieldName, sourceHint,
+ "must not contain any of these characters " + banned + " but found "
+ + string.charAt( i ) );
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private static void addViolation( SettingsProblemCollector problems, Severity severity, String fieldName,
+ String sourceHint, String message )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( '\'' ).append( fieldName ).append( '\'' );
+
+ if ( sourceHint != null )
+ {
+ buffer.append( " for " ).append( sourceHint );
+ }
+
+ buffer.append( ' ' ).append( message );
+
+ problems.add( severity, buffer.toString(), -1, -1, null );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/SettingsValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/SettingsValidator.java
new file mode 100644
index 00000000..79745eca
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-settings-builder/src/main/java/org/apache/maven/settings/validation/SettingsValidator.java
@@ -0,0 +1,41 @@
+package org.apache.maven.settings.validation;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.building.SettingsProblemCollector;
+
+/**
+ * Validate a model settings
+ *
+ * @author Milos Kleint
+ */
+public interface SettingsValidator
+{
+
+ /**
+ * Validate the specified settings.
+ *
+ * @param settings The settings to validate, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void validate( Settings settings, SettingsProblemCollector problems );
+
+}