aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/AbstractModelBuildingListener.java37
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java1309
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java243
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingRequest.java408
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingResult.java180
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java175
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java200
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java84
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FilterModelBuildingRequest.java285
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuilder.java67
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEvent.java53
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java180
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingListener.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java338
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingResult.java99
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCache.java56
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCacheTag.java132
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelData.java222
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java117
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorExt.java37
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java101
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java171
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProcessor.java32
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource2.java56
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/Result.java255
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java56
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java255
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java271
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java47
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java70
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java54
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java67
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java87
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java504
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/UrlNormalizingPostProcessor.java69
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java134
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelWriter.java118
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelReader.java89
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelWriter.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/DefaultModelLocator.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/ModelLocator.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java110
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java137
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java729
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java135
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java54
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelPathTranslator.java111
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelUrlNormalizer.java84
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java66
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultUrlNormalizer.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelPathTranslator.java45
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelUrlNormalizer.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/PathTranslator.java43
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/UrlNormalizer.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java240
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/LifecycleBindingsInjector.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java43
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java43
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportingConverter.java43
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java259
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java249
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java143
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java79
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileSelector.java49
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java192
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java224
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java168
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/ProfileActivator.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java126
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/InvalidRepositoryException.java73
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java126
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/WorkspaceModelResolver.java33
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java87
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/SuperPomProvider.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java1076
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/ModelValidator.java54
92 files changed, 12939 insertions, 0 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/AbstractModelBuildingListener.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/AbstractModelBuildingListener.java
new file mode 100644
index 00000000..5138776a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/AbstractModelBuildingListener.java
@@ -0,0 +1,37 @@
+package org.apache.maven.model.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.
+ */
+
+/**
+ * Provides a skeleton implementation for model building listeners. The methods of this class are empty.
+ *
+ * @author Benjamin Bentmann
+ */
+public class AbstractModelBuildingListener
+ implements ModelBuildingListener
+{
+
+ @Override
+ public void buildExtensionsAssembled( ModelBuildingEvent event )
+ {
+ // default does nothing
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
new file mode 100644
index 00000000..52b3c9c8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
@@ -0,0 +1,1309 @@
+package org.apache.maven.model.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 static org.apache.maven.model.building.Result.error;
+import static org.apache.maven.model.building.Result.newResult;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.InputSource;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.composition.DependencyManagementImporter;
+import org.apache.maven.model.inheritance.InheritanceAssembler;
+import org.apache.maven.model.interpolation.ModelInterpolator;
+import org.apache.maven.model.io.ModelParseException;
+import org.apache.maven.model.management.DependencyManagementInjector;
+import org.apache.maven.model.management.PluginManagementInjector;
+import org.apache.maven.model.normalization.ModelNormalizer;
+import org.apache.maven.model.path.ModelPathTranslator;
+import org.apache.maven.model.path.ModelUrlNormalizer;
+import org.apache.maven.model.plugin.LifecycleBindingsInjector;
+import org.apache.maven.model.plugin.PluginConfigurationExpander;
+import org.apache.maven.model.plugin.ReportConfigurationExpander;
+import org.apache.maven.model.plugin.ReportingConverter;
+import org.apache.maven.model.profile.DefaultProfileActivationContext;
+import org.apache.maven.model.profile.ProfileInjector;
+import org.apache.maven.model.profile.ProfileSelector;
+import org.apache.maven.model.resolution.InvalidRepositoryException;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.model.resolution.UnresolvableModelException;
+import org.apache.maven.model.resolution.WorkspaceModelResolver;
+import org.apache.maven.model.superpom.SuperPomProvider;
+import org.apache.maven.model.validation.ModelValidator;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelBuilder.class )
+public class DefaultModelBuilder
+ implements ModelBuilder
+{
+ @Requirement
+ private ModelProcessor modelProcessor;
+
+ @Requirement
+ private ModelValidator modelValidator;
+
+ @Requirement
+ private ModelNormalizer modelNormalizer;
+
+ @Requirement
+ private ModelInterpolator modelInterpolator;
+
+ @Requirement
+ private ModelPathTranslator modelPathTranslator;
+
+ @Requirement
+ private ModelUrlNormalizer modelUrlNormalizer;
+
+ @Requirement
+ private SuperPomProvider superPomProvider;
+
+ @Requirement
+ private InheritanceAssembler inheritanceAssembler;
+
+ @Requirement
+ private ProfileSelector profileSelector;
+
+ @Requirement
+ private ProfileInjector profileInjector;
+
+ @Requirement
+ private PluginManagementInjector pluginManagementInjector;
+
+ @Requirement
+ private DependencyManagementInjector dependencyManagementInjector;
+
+ @Requirement
+ private DependencyManagementImporter dependencyManagementImporter;
+
+ @Requirement( optional = true )
+ private LifecycleBindingsInjector lifecycleBindingsInjector;
+
+ @Requirement
+ private PluginConfigurationExpander pluginConfigurationExpander;
+
+ @Requirement
+ private ReportConfigurationExpander reportConfigurationExpander;
+
+ @Requirement
+ private ReportingConverter reportingConverter;
+
+ public DefaultModelBuilder setModelProcessor( ModelProcessor modelProcessor )
+ {
+ this.modelProcessor = modelProcessor;
+ return this;
+ }
+
+ public DefaultModelBuilder setModelValidator( ModelValidator modelValidator )
+ {
+ this.modelValidator = modelValidator;
+ return this;
+ }
+
+ public DefaultModelBuilder setModelNormalizer( ModelNormalizer modelNormalizer )
+ {
+ this.modelNormalizer = modelNormalizer;
+ return this;
+ }
+
+ public DefaultModelBuilder setModelInterpolator( ModelInterpolator modelInterpolator )
+ {
+ this.modelInterpolator = modelInterpolator;
+ return this;
+ }
+
+ public DefaultModelBuilder setModelPathTranslator( ModelPathTranslator modelPathTranslator )
+ {
+ this.modelPathTranslator = modelPathTranslator;
+ return this;
+ }
+
+ public DefaultModelBuilder setModelUrlNormalizer( ModelUrlNormalizer modelUrlNormalizer )
+ {
+ this.modelUrlNormalizer = modelUrlNormalizer;
+ return this;
+ }
+
+ public DefaultModelBuilder setSuperPomProvider( SuperPomProvider superPomProvider )
+ {
+ this.superPomProvider = superPomProvider;
+ return this;
+ }
+
+ public DefaultModelBuilder setProfileSelector( ProfileSelector profileSelector )
+ {
+ this.profileSelector = profileSelector;
+ return this;
+ }
+
+ public DefaultModelBuilder setProfileInjector( ProfileInjector profileInjector )
+ {
+ this.profileInjector = profileInjector;
+ return this;
+ }
+
+ public DefaultModelBuilder setInheritanceAssembler( InheritanceAssembler inheritanceAssembler )
+ {
+ this.inheritanceAssembler = inheritanceAssembler;
+ return this;
+ }
+
+ public DefaultModelBuilder setDependencyManagementImporter( DependencyManagementImporter depMngmntImporter )
+ {
+ this.dependencyManagementImporter = depMngmntImporter;
+ return this;
+ }
+
+ public DefaultModelBuilder setDependencyManagementInjector( DependencyManagementInjector depMngmntInjector )
+ {
+ this.dependencyManagementInjector = depMngmntInjector;
+ return this;
+ }
+
+ public DefaultModelBuilder setLifecycleBindingsInjector( LifecycleBindingsInjector lifecycleBindingsInjector )
+ {
+ this.lifecycleBindingsInjector = lifecycleBindingsInjector;
+ return this;
+ }
+
+ public DefaultModelBuilder setPluginConfigurationExpander( PluginConfigurationExpander pluginConfigurationExpander )
+ {
+ this.pluginConfigurationExpander = pluginConfigurationExpander;
+ return this;
+ }
+
+ public DefaultModelBuilder setPluginManagementInjector( PluginManagementInjector pluginManagementInjector )
+ {
+ this.pluginManagementInjector = pluginManagementInjector;
+ return this;
+ }
+
+ public DefaultModelBuilder setReportConfigurationExpander( ReportConfigurationExpander reportConfigurationExpander )
+ {
+ this.reportConfigurationExpander = reportConfigurationExpander;
+ return this;
+ }
+
+ public DefaultModelBuilder setReportingConverter( ReportingConverter reportingConverter )
+ {
+ this.reportingConverter = reportingConverter;
+ return this;
+ }
+
+ @Override
+ public ModelBuildingResult build( ModelBuildingRequest request )
+ throws ModelBuildingException
+ {
+ // phase 1
+ DefaultModelBuildingResult result = new DefaultModelBuildingResult();
+
+ DefaultModelProblemCollector problems = new DefaultModelProblemCollector( result );
+
+ // profile activation
+ DefaultProfileActivationContext profileActivationContext = getProfileActivationContext( request );
+
+ problems.setSource( "(external profiles)" );
+ List<Profile> activeExternalProfiles = profileSelector.getActiveProfiles( request.getProfiles(),
+ profileActivationContext, problems );
+
+ result.setActiveExternalProfiles( activeExternalProfiles );
+
+ if ( !activeExternalProfiles.isEmpty() )
+ {
+ Properties profileProps = new Properties();
+ for ( Profile profile : activeExternalProfiles )
+ {
+ profileProps.putAll( profile.getProperties() );
+ }
+ profileProps.putAll( profileActivationContext.getUserProperties() );
+ profileActivationContext.setUserProperties( profileProps );
+ }
+
+ // read and validate raw model
+ Model inputModel = request.getRawModel();
+ if ( inputModel == null )
+ {
+ inputModel = readModel( request.getModelSource(), request.getPomFile(), request, problems );
+ }
+
+ problems.setRootModel( inputModel );
+
+ ModelData resultData = new ModelData( request.getModelSource(), inputModel );
+ ModelData superData = new ModelData( null, getSuperModel() );
+
+ Collection<String> parentIds = new LinkedHashSet<String>();
+ List<ModelData> lineage = new ArrayList<ModelData>();
+
+ for ( ModelData currentData = resultData; currentData != null; )
+ {
+ lineage.add( currentData );
+
+ Model rawModel = currentData.getModel();
+ currentData.setRawModel( rawModel );
+
+ Model tmpModel = rawModel.clone();
+ currentData.setModel( tmpModel );
+
+ problems.setSource( tmpModel );
+
+ // model normalization
+ modelNormalizer.mergeDuplicates( tmpModel, request, problems );
+
+ profileActivationContext.setProjectProperties( tmpModel.getProperties() );
+
+ List<Profile> activePomProfiles = profileSelector.getActiveProfiles( rawModel.getProfiles(),
+ profileActivationContext, problems );
+ currentData.setActiveProfiles( activePomProfiles );
+
+ Map<String, Activation> interpolatedActivations = getProfileActivations( rawModel, false );
+ injectProfileActivations( tmpModel, interpolatedActivations );
+
+ // profile injection
+ for ( Profile activeProfile : activePomProfiles )
+ {
+ profileInjector.injectProfile( tmpModel, activeProfile, request, problems );
+ }
+
+ if ( currentData == resultData )
+ {
+ for ( Profile activeProfile : activeExternalProfiles )
+ {
+ profileInjector.injectProfile( tmpModel, activeProfile, request, problems );
+ }
+ }
+
+ if ( currentData == superData )
+ {
+ break;
+ }
+
+ configureResolver( request.getModelResolver(), tmpModel, problems );
+
+ ModelData parentData = readParent( tmpModel, currentData.getSource(), request, problems );
+
+ if ( parentData == null )
+ {
+ currentData = superData;
+ }
+ else if ( currentData == resultData )
+ { // First iteration - add initial parent id after version resolution.
+ currentData.setGroupId( currentData.getRawModel().getGroupId() == null ? parentData.getGroupId()
+ : currentData.getRawModel()
+ .getGroupId() );
+
+ currentData.setVersion( currentData.getRawModel().getVersion() == null ? parentData.getVersion()
+ : currentData.getRawModel()
+ .getVersion() );
+
+ currentData.setArtifactId( currentData.getRawModel().getArtifactId() );
+ parentIds.add( currentData.getId() );
+ // Reset - only needed for 'getId'.
+ currentData.setGroupId( null );
+ currentData.setArtifactId( null );
+ currentData.setVersion( null );
+ currentData = parentData;
+ }
+ else if ( !parentIds.add( parentData.getId() ) )
+ {
+ String message = "The parents form a cycle: ";
+ for ( String modelId : parentIds )
+ {
+ message += modelId + " -> ";
+ }
+ message += parentData.getId();
+
+ problems.add( new ModelProblemCollectorRequest( ModelProblem.Severity.FATAL, ModelProblem.Version.BASE )
+ .setMessage( message ) );
+
+ throw problems.newModelBuildingException();
+ }
+ else
+ {
+ currentData = parentData;
+ }
+ }
+
+ problems.setSource( inputModel );
+ checkPluginVersions( lineage, request, problems );
+
+ // inheritance assembly
+ assembleInheritance( lineage, request, problems );
+
+ Model resultModel = resultData.getModel();
+
+ problems.setSource( resultModel );
+ problems.setRootModel( resultModel );
+
+ // model interpolation
+ resultModel = interpolateModel( resultModel, request, problems );
+ resultData.setModel( resultModel );
+
+ // url normalization
+ modelUrlNormalizer.normalize( resultModel, request );
+
+ // Now the fully interpolated model is available: reconfigure the resolver
+ configureResolver( request.getModelResolver(), resultModel, problems, true );
+
+ resultData.setGroupId( resultModel.getGroupId() );
+ resultData.setArtifactId( resultModel.getArtifactId() );
+ resultData.setVersion( resultModel.getVersion() );
+
+ result.setEffectiveModel( resultModel );
+
+ for ( ModelData currentData : lineage )
+ {
+ String modelId = ( currentData != superData ) ? currentData.getId() : "";
+
+ result.addModelId( modelId );
+ result.setActivePomProfiles( modelId, currentData.getActiveProfiles() );
+ result.setRawModel( modelId, currentData.getRawModel() );
+ }
+
+ if ( !request.isTwoPhaseBuilding() )
+ {
+ build( request, result );
+ }
+
+ return result;
+ }
+
+ @Override
+ public ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result )
+ throws ModelBuildingException
+ {
+ return build( request, result, new LinkedHashSet<String>() );
+ }
+
+ private ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result,
+ Collection<String> imports )
+ throws ModelBuildingException
+ {
+ // phase 2
+ Model resultModel = result.getEffectiveModel();
+
+ DefaultModelProblemCollector problems = new DefaultModelProblemCollector( result );
+ problems.setSource( resultModel );
+ problems.setRootModel( resultModel );
+
+ // model path translation
+ modelPathTranslator.alignToBaseDirectory( resultModel, resultModel.getProjectDirectory(), request );
+
+ // plugin management injection
+ pluginManagementInjector.injectManagement( resultModel, request, problems );
+
+ fireEvent( resultModel, request, problems, ModelBuildingEventCatapult.BUILD_EXTENSIONS_ASSEMBLED );
+
+ if ( request.isProcessPlugins() )
+ {
+ if ( lifecycleBindingsInjector == null )
+ {
+ throw new IllegalStateException( "lifecycle bindings injector is missing" );
+ }
+
+ // lifecycle bindings injection
+ lifecycleBindingsInjector.injectLifecycleBindings( resultModel, request, problems );
+ }
+
+ // dependency management import
+ importDependencyManagement( resultModel, request, problems, imports );
+
+ // dependency management injection
+ dependencyManagementInjector.injectManagement( resultModel, request, problems );
+
+ modelNormalizer.injectDefaultValues( resultModel, request, problems );
+
+ if ( request.isProcessPlugins() )
+ {
+ // reports configuration
+ reportConfigurationExpander.expandPluginConfiguration( resultModel, request, problems );
+
+ // reports conversion to decoupled site plugin
+ reportingConverter.convertReporting( resultModel, request, problems );
+
+ // plugins configuration
+ pluginConfigurationExpander.expandPluginConfiguration( resultModel, request, problems );
+ }
+
+ // effective model validation
+ modelValidator.validateEffectiveModel( resultModel, request, problems );
+
+ if ( hasModelErrors( problems ) )
+ {
+ throw problems.newModelBuildingException();
+ }
+
+ return result;
+ }
+
+ @Override
+ public Result<? extends Model> buildRawModel( File pomFile, int validationLevel, boolean locationTracking )
+ {
+ final ModelBuildingRequest request = new DefaultModelBuildingRequest().setValidationLevel( validationLevel )
+ .setLocationTracking( locationTracking );
+ final DefaultModelProblemCollector collector =
+ new DefaultModelProblemCollector( new DefaultModelBuildingResult() );
+ try
+ {
+ return newResult( readModel( null, pomFile, request, collector ), collector.getProblems() );
+ }
+ catch ( ModelBuildingException e )
+ {
+ return error( collector.getProblems() );
+ }
+ }
+
+ private Model readModel( ModelSource modelSource, File pomFile, ModelBuildingRequest request,
+ DefaultModelProblemCollector problems )
+ throws ModelBuildingException
+ {
+ Model model;
+
+ if ( modelSource == null )
+ {
+ if ( pomFile != null )
+ {
+ modelSource = new FileModelSource( pomFile );
+ }
+ else
+ {
+ throw new IllegalArgumentException( "neither model source nor input file are specified" );
+ }
+ }
+
+ problems.setSource( modelSource.getLocation() );
+ try
+ {
+ boolean strict = request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
+ InputSource source = request.isLocationTracking() ? new InputSource() : null;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put( ModelProcessor.IS_STRICT, strict );
+ options.put( ModelProcessor.INPUT_SOURCE, source );
+ options.put( ModelProcessor.SOURCE, modelSource );
+
+ try
+ {
+ model = modelProcessor.read( modelSource.getInputStream(), options );
+ }
+ catch ( ModelParseException e )
+ {
+ if ( !strict )
+ {
+ throw e;
+ }
+
+ options.put( ModelProcessor.IS_STRICT, Boolean.FALSE );
+
+ try
+ {
+ model = modelProcessor.read( modelSource.getInputStream(), options );
+ }
+ catch ( ModelParseException ne )
+ {
+ // still unreadable even in non-strict mode, rethrow original error
+ throw e;
+ }
+
+ if ( pomFile != null )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.V20 )
+ .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
+ .setException( e ) );
+ }
+ else
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
+ .setMessage( "Malformed POM " + modelSource.getLocation() + ": " + e.getMessage() )
+ .setException( e ) );
+ }
+ }
+
+ if ( source != null )
+ {
+ source.setModelId( ModelProblemUtils.toId( model ) );
+ source.setLocation( modelSource.getLocation() );
+ }
+ }
+ catch ( ModelParseException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+ .setMessage( "Non-parseable POM " + modelSource.getLocation() + ": " + e.getMessage() )
+ .setException( e ) );
+ throw problems.newModelBuildingException();
+ }
+ catch ( IOException e )
+ {
+ String msg = e.getMessage();
+ if ( msg == null || msg.length() <= 0 )
+ {
+ // NOTE: There's java.nio.charset.MalformedInputException and sun.io.MalformedInputException
+ if ( e.getClass().getName().endsWith( "MalformedInputException" ) )
+ {
+ msg = "Some input bytes do not match the file encoding.";
+ }
+ else
+ {
+ msg = e.getClass().getSimpleName();
+ }
+ }
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+ .setMessage( "Non-readable POM " + modelSource.getLocation() + ": " + msg ).setException( e ) );
+ throw problems.newModelBuildingException();
+ }
+
+ model.setPomFile( pomFile );
+
+ problems.setSource( model );
+ modelValidator.validateRawModel( model, request, problems );
+
+ if ( hasFatalErrors( problems ) )
+ {
+ throw problems.newModelBuildingException();
+ }
+
+ return model;
+ }
+
+ private DefaultProfileActivationContext getProfileActivationContext( ModelBuildingRequest request )
+ {
+ DefaultProfileActivationContext context = new DefaultProfileActivationContext();
+
+ context.setActiveProfileIds( request.getActiveProfileIds() );
+ context.setInactiveProfileIds( request.getInactiveProfileIds() );
+ context.setSystemProperties( request.getSystemProperties() );
+ context.setUserProperties( request.getUserProperties() );
+ context.setProjectDirectory( ( request.getPomFile() != null ) ? request.getPomFile().getParentFile() : null );
+
+ return context;
+ }
+
+ private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems )
+ {
+ configureResolver( modelResolver, model, problems, false );
+ }
+
+ private void configureResolver( ModelResolver modelResolver, Model model, DefaultModelProblemCollector problems,
+ boolean replaceRepositories )
+ {
+ if ( modelResolver == null )
+ {
+ return;
+ }
+
+ problems.setSource( model );
+
+ List<Repository> repositories = model.getRepositories();
+
+ for ( Repository repository : repositories )
+ {
+ try
+ {
+ modelResolver.addRepository( repository, replaceRepositories );
+ }
+ catch ( InvalidRepositoryException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Invalid repository " + repository.getId() + ": " + e.getMessage() )
+ .setLocation( repository.getLocation( "" ) ).setException( e ) );
+ }
+ }
+ }
+
+ private void checkPluginVersions( List<ModelData> lineage, ModelBuildingRequest request,
+ ModelProblemCollector problems )
+ {
+ if ( request.getValidationLevel() < ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ return;
+ }
+
+ Map<String, Plugin> plugins = new HashMap<String, Plugin>();
+ Map<String, String> versions = new HashMap<String, String>();
+ Map<String, String> managedVersions = new HashMap<String, String>();
+
+ for ( int i = lineage.size() - 1; i >= 0; i-- )
+ {
+ Model model = lineage.get( i ).getModel();
+ Build build = model.getBuild();
+ if ( build != null )
+ {
+ for ( Plugin plugin : build.getPlugins() )
+ {
+ String key = plugin.getKey();
+ if ( versions.get( key ) == null )
+ {
+ versions.put( key, plugin.getVersion() );
+ plugins.put( key, plugin );
+ }
+ }
+ PluginManagement mngt = build.getPluginManagement();
+ if ( mngt != null )
+ {
+ for ( Plugin plugin : mngt.getPlugins() )
+ {
+ String key = plugin.getKey();
+ if ( managedVersions.get( key ) == null )
+ {
+ managedVersions.put( key, plugin.getVersion() );
+ }
+ }
+ }
+ }
+ }
+
+ for ( String key : versions.keySet() )
+ {
+ if ( versions.get( key ) == null && managedVersions.get( key ) == null )
+ {
+ InputLocation location = plugins.get( key ).getLocation( "" );
+ problems
+ .add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 )
+ .setMessage( "'build.plugins.plugin.version' for " + key + " is missing." )
+ .setLocation( location ) );
+ }
+ }
+ }
+
+ private void assembleInheritance( List<ModelData> lineage, ModelBuildingRequest request,
+ ModelProblemCollector problems )
+ {
+ for ( int i = lineage.size() - 2; i >= 0; i-- )
+ {
+ Model parent = lineage.get( i + 1 ).getModel();
+ Model child = lineage.get( i ).getModel();
+ inheritanceAssembler.assembleModelInheritance( child, parent, request, problems );
+ }
+ }
+
+ private Map<String, Activation> getProfileActivations( Model model, boolean clone )
+ {
+ Map<String, Activation> activations = new HashMap<String, Activation>();
+ for ( Profile profile : model.getProfiles() )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ continue;
+ }
+
+ if ( clone )
+ {
+ activation = activation.clone();
+ }
+
+ activations.put( profile.getId(), activation );
+ }
+
+ return activations;
+ }
+
+ private void injectProfileActivations( Model model, Map<String, Activation> activations )
+ {
+ for ( Profile profile : model.getProfiles() )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ continue;
+ }
+
+ // restore activation
+ profile.setActivation( activations.get( profile.getId() ) );
+ }
+ }
+
+ private Model interpolateModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ // save profile activations before interpolation, since they are evaluated with limited scope
+ Map<String, Activation> originalActivations = getProfileActivations( model, true );
+
+ Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems );
+ result.setPomFile( model.getPomFile() );
+
+ // restore profiles with file activation to their value before full interpolation
+ injectProfileActivations( model, originalActivations );
+
+ return result;
+ }
+
+ private ModelData readParent( Model childModel, ModelSource childSource, ModelBuildingRequest request,
+ DefaultModelProblemCollector problems )
+ throws ModelBuildingException
+ {
+ ModelData parentData;
+
+ Parent parent = childModel.getParent();
+
+ if ( parent != null )
+ {
+ String groupId = parent.getGroupId();
+ String artifactId = parent.getArtifactId();
+ String version = parent.getVersion();
+
+ parentData = getCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW );
+
+ if ( parentData == null )
+ {
+ parentData = readParentLocally( childModel, childSource, request, problems );
+
+ if ( parentData == null )
+ {
+ parentData = readParentExternally( childModel, request, problems );
+ }
+
+ putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.RAW, parentData );
+ }
+ else
+ {
+ /*
+ * NOTE: This is a sanity check of the cache hit. If the cached parent POM was locally resolved, the
+ * child's <relativePath> should point at that parent, too. If it doesn't, we ignore the cache and
+ * resolve externally, to mimic the behavior if the cache didn't exist in the first place. Otherwise,
+ * the cache would obscure a bad POM.
+ */
+
+ File pomFile = parentData.getModel().getPomFile();
+ if ( pomFile != null )
+ {
+ ModelSource expectedParentSource = getParentPomFile( childModel, childSource );
+
+ if ( expectedParentSource instanceof ModelSource2
+ && !pomFile.toURI().equals( ( (ModelSource2) expectedParentSource ).getLocationURI() ) )
+ {
+ parentData = readParentExternally( childModel, request, problems );
+ }
+ }
+ }
+
+ Model parentModel = parentData.getModel();
+
+ if ( !"pom".equals( parentModel.getPackaging() ) )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Invalid packaging for parent POM " + ModelProblemUtils.toSourceHint( parentModel )
+ + ", must be \"pom\" but is \"" + parentModel.getPackaging() + "\"" )
+ .setLocation( parentModel.getLocation( "packaging" ) ) );
+ }
+ }
+ else
+ {
+ parentData = null;
+ }
+
+ return parentData;
+ }
+
+ private ModelData readParentLocally( Model childModel, ModelSource childSource, ModelBuildingRequest request,
+ DefaultModelProblemCollector problems )
+ throws ModelBuildingException
+ {
+ final Parent parent = childModel.getParent();
+ final ModelSource candidateSource;
+ final Model candidateModel;
+ final WorkspaceModelResolver resolver = request.getWorkspaceModelResolver();
+ if ( resolver == null )
+ {
+ candidateSource = getParentPomFile( childModel, childSource );
+
+ if ( candidateSource == null )
+ {
+ return null;
+ }
+
+ File pomFile = null;
+ if ( candidateSource instanceof FileModelSource )
+ {
+ pomFile = ( (FileModelSource) candidateSource ).getPomFile();
+ }
+
+ candidateModel = readModel( candidateSource, pomFile, request, problems );
+ }
+ else
+ {
+ try
+ {
+ candidateModel =
+ resolver.resolveRawModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE ) //
+ .setMessage( e.getMessage().toString() ).setLocation( parent.getLocation( "" ) ).setException( e ) );
+ throw problems.newModelBuildingException();
+ }
+ if ( candidateModel == null )
+ {
+ return null;
+ }
+ candidateSource = new FileModelSource( candidateModel.getPomFile() );
+ }
+
+ //
+ // TODO:jvz Why isn't all this checking the job of the duty of the workspace resolver, we know that we
+ // have a model that is suitable, yet more checks are done here and the one for the version is problematic
+ // before because with parents as ranges it will never work in this scenario.
+ //
+
+ String groupId = candidateModel.getGroupId();
+ if ( groupId == null && candidateModel.getParent() != null )
+ {
+ groupId = candidateModel.getParent().getGroupId();
+ }
+ String artifactId = candidateModel.getArtifactId();
+ String version = candidateModel.getVersion();
+ if ( version == null && candidateModel.getParent() != null )
+ {
+ version = candidateModel.getParent().getVersion();
+ }
+
+ if ( groupId == null || !groupId.equals( parent.getGroupId() ) || artifactId == null
+ || !artifactId.equals( parent.getArtifactId() ) )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( "'parent.relativePath'" );
+ if ( childModel != problems.getRootModel() )
+ {
+ buffer.append( " of POM " ).append( ModelProblemUtils.toSourceHint( childModel ) );
+ }
+ buffer.append( " points at " ).append( groupId ).append( ":" ).append( artifactId );
+ buffer.append( " instead of " ).append( parent.getGroupId() ).append( ":" );
+ buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" );
+
+ problems.setSource( childModel );
+ problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.BASE )
+ .setMessage( buffer.toString() ).setLocation( parent.getLocation( "" ) ) );
+ return null;
+ }
+
+ //
+ // Here we just need to know that a version is fine to use but this validation we can do in our workspace
+ // resolver.
+ //
+
+ /*
+ * if ( version == null || !version.equals( parent.getVersion() ) ) { return null; }
+ */
+
+ ModelData parentData = new ModelData( candidateSource, candidateModel, groupId, artifactId, version );
+
+ return parentData;
+ }
+
+ private ModelSource getParentPomFile( Model childModel, ModelSource source )
+ {
+ if ( !( source instanceof ModelSource2 ) )
+ {
+ return null;
+ }
+
+ String parentPath = childModel.getParent().getRelativePath();
+
+ if ( parentPath == null || parentPath.length() <= 0 )
+ {
+ return null;
+ }
+
+ return ( (ModelSource2) source ).getRelatedSource( parentPath );
+ }
+
+ private ModelData readParentExternally( Model childModel, ModelBuildingRequest request,
+ DefaultModelProblemCollector problems )
+ throws ModelBuildingException
+ {
+ problems.setSource( childModel );
+
+ Parent parent = childModel.getParent().clone();
+
+ String groupId = parent.getGroupId();
+ String artifactId = parent.getArtifactId();
+ String version = parent.getVersion();
+
+ ModelResolver modelResolver = request.getModelResolver();
+
+ if ( modelResolver == null )
+ {
+ throw new IllegalArgumentException( "no model resolver provided, cannot resolve parent POM "
+ + ModelProblemUtils.toId( groupId, artifactId, version ) + " for POM "
+ + ModelProblemUtils.toSourceHint( childModel ) );
+ }
+
+ ModelSource modelSource;
+ try
+ {
+ modelSource = modelResolver.resolveModel( parent );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( "Non-resolvable parent POM" );
+ if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) )
+ {
+ buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) );
+ }
+ if ( childModel != problems.getRootModel() )
+ {
+ buffer.append( " for " ).append( ModelProblemUtils.toId( childModel ) );
+ }
+ buffer.append( ": " ).append( e.getMessage() );
+ if ( childModel.getProjectDirectory() != null )
+ {
+ if ( parent.getRelativePath() == null || parent.getRelativePath().length() <= 0 )
+ {
+ buffer.append( " and 'parent.relativePath' points at no local POM" );
+ }
+ else
+ {
+ buffer.append( " and 'parent.relativePath' points at wrong local POM" );
+ }
+ }
+
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+ .setMessage( buffer.toString() ).setLocation( parent.getLocation( "" ) ).setException( e ) );
+ throw problems.newModelBuildingException();
+ }
+
+ ModelBuildingRequest lenientRequest = request;
+ if ( request.getValidationLevel() > ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ lenientRequest = new FilterModelBuildingRequest( request )
+ {
+ @Override
+ public int getValidationLevel()
+ {
+ return ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0;
+ }
+ };
+ }
+
+ Model parentModel = readModel( modelSource, null, lenientRequest, problems );
+
+ if ( !parent.getVersion().equals( version ) )
+ {
+ if ( childModel.getVersion() == null )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+ .setMessage( "Version must be a constant" ).setLocation( childModel.getLocation( "" ) ) );
+
+ }
+ else
+ {
+ if ( childModel.getVersion().indexOf( "${" ) > -1 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.V31 )
+ .setMessage( "Version must be a constant" )
+ .setLocation( childModel.getLocation( "version" ) ) );
+
+ }
+ }
+
+ // MNG-2199: What else to check here ?
+ }
+
+ ModelData parentData = new ModelData( modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion() );
+
+ return parentData;
+ }
+
+ private Model getSuperModel()
+ {
+ return superPomProvider.getSuperModel( "4.0.0" ).clone();
+ }
+
+ private void importDependencyManagement( Model model, ModelBuildingRequest request,
+ DefaultModelProblemCollector problems, Collection<String> importIds )
+ {
+ DependencyManagement depMngt = model.getDependencyManagement();
+
+ if ( depMngt == null )
+ {
+ return;
+ }
+
+ String importing = model.getGroupId() + ':' + model.getArtifactId() + ':' + model.getVersion();
+
+ importIds.add( importing );
+
+ final WorkspaceModelResolver workspaceResolver = request.getWorkspaceModelResolver();
+ final ModelResolver modelResolver = request.getModelResolver();
+
+ ModelBuildingRequest importRequest = null;
+
+ List<DependencyManagement> importMngts = null;
+
+ for ( Iterator<Dependency> it = depMngt.getDependencies().iterator(); it.hasNext(); )
+ {
+ Dependency dependency = it.next();
+
+ if ( !"pom".equals( dependency.getType() ) || !"import".equals( dependency.getScope() ) )
+ {
+ continue;
+ }
+
+ it.remove();
+
+ String groupId = dependency.getGroupId();
+ String artifactId = dependency.getArtifactId();
+ String version = dependency.getVersion();
+
+ if ( groupId == null || groupId.length() <= 0 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "'dependencyManagement.dependencies.dependency.groupId' for "
+ + dependency.getManagementKey() + " is missing." )
+ .setLocation( dependency.getLocation( "" ) ) );
+ continue;
+ }
+ if ( artifactId == null || artifactId.length() <= 0 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "'dependencyManagement.dependencies.dependency.artifactId' for "
+ + dependency.getManagementKey() + " is missing." )
+ .setLocation( dependency.getLocation( "" ) ) );
+ continue;
+ }
+ if ( version == null || version.length() <= 0 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "'dependencyManagement.dependencies.dependency.version' for "
+ + dependency.getManagementKey() + " is missing." )
+ .setLocation( dependency.getLocation( "" ) ) );
+ continue;
+ }
+
+ String imported = groupId + ':' + artifactId + ':' + version;
+
+ if ( importIds.contains( imported ) )
+ {
+ String message = "The dependencies of type=pom and with scope=import form a cycle: ";
+ for ( String modelId : importIds )
+ {
+ message += modelId + " -> ";
+ }
+ message += imported;
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage( message ) );
+
+ continue;
+ }
+
+ DependencyManagement importMngt = getCache( request.getModelCache(), groupId, artifactId, version,
+ ModelCacheTag.IMPORT );
+
+ if ( importMngt == null )
+ {
+ if ( workspaceResolver == null && modelResolver == null )
+ {
+ throw new IllegalArgumentException( "no model resolver provided, cannot resolve import POM "
+ + ModelProblemUtils.toId( groupId, artifactId, version ) + " for POM "
+ + ModelProblemUtils.toSourceHint( model ) );
+ }
+
+ Model importModel = null;
+ if ( workspaceResolver != null )
+ {
+ try
+ {
+ importModel = workspaceResolver.resolveEffectiveModel( groupId, artifactId, version );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.FATAL, Version.BASE )
+ .setMessage( e.getMessage().toString() ).setException( e ) );
+ continue;
+ }
+ }
+
+ // no workspace resolver or workspace resolver returned null (i.e. model not in workspace)
+ if ( importModel == null )
+ {
+ final ModelSource importSource;
+ try
+ {
+ importSource = modelResolver.resolveModel( groupId, artifactId, version );
+ }
+ catch ( UnresolvableModelException e )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( "Non-resolvable import POM" );
+ if ( !containsCoordinates( e.getMessage(), groupId, artifactId, version ) )
+ {
+ buffer.append( " " ).append( ModelProblemUtils.toId( groupId, artifactId, version ) );
+ }
+ buffer.append( ": " ).append( e.getMessage() );
+
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( buffer.toString() ).setLocation( dependency.getLocation( "" ) )
+ .setException( e ) );
+ continue;
+ }
+
+ if ( importRequest == null )
+ {
+ importRequest = new DefaultModelBuildingRequest();
+ importRequest.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
+ importRequest.setModelCache( request.getModelCache() );
+ importRequest.setSystemProperties( request.getSystemProperties() );
+ importRequest.setUserProperties( request.getUserProperties() );
+ importRequest.setLocationTracking( request.isLocationTracking() );
+ }
+
+ importRequest.setModelSource( importSource );
+ importRequest.setModelResolver( modelResolver.newCopy() );
+
+ final ModelBuildingResult importResult;
+ try
+ {
+ importResult = build( importRequest );
+ }
+ catch ( ModelBuildingException e )
+ {
+ problems.addAll( e.getProblems() );
+ continue;
+ }
+
+ problems.addAll( importResult.getProblems() );
+
+ importModel = importResult.getEffectiveModel();
+ }
+
+ importMngt = importModel.getDependencyManagement();
+
+ if ( importMngt == null )
+ {
+ importMngt = new DependencyManagement();
+ }
+
+ putCache( request.getModelCache(), groupId, artifactId, version, ModelCacheTag.IMPORT, importMngt );
+ }
+
+ if ( importMngts == null )
+ {
+ importMngts = new ArrayList<DependencyManagement>();
+ }
+
+ importMngts.add( importMngt );
+ }
+
+ importIds.remove( importing );
+
+ dependencyManagementImporter.importManagement( model, importMngts, request, problems );
+ }
+
+ private <T> void putCache( ModelCache modelCache, String groupId, String artifactId, String version,
+ ModelCacheTag<T> tag, T data )
+ {
+ if ( modelCache != null )
+ {
+ modelCache.put( groupId, artifactId, version, tag.getName(), tag.intoCache( data ) );
+ }
+ }
+
+ private <T> T getCache( ModelCache modelCache, String groupId, String artifactId, String version,
+ ModelCacheTag<T> tag )
+ {
+ if ( modelCache != null )
+ {
+ Object data = modelCache.get( groupId, artifactId, version, tag.getName() );
+ if ( data != null )
+ {
+ return tag.fromCache( tag.getType().cast( data ) );
+ }
+ }
+ return null;
+ }
+
+ private void fireEvent( Model model, ModelBuildingRequest request, ModelProblemCollector problems,
+ ModelBuildingEventCatapult catapult )
+ throws ModelBuildingException
+ {
+ ModelBuildingListener listener = request.getModelBuildingListener();
+
+ if ( listener != null )
+ {
+ ModelBuildingEvent event = new DefaultModelBuildingEvent( model, request, problems );
+
+ catapult.fire( listener, event );
+ }
+ }
+
+ private boolean containsCoordinates( String message, String groupId, String artifactId, String version )
+ {
+ return message != null && ( groupId == null || message.contains( groupId ) )
+ && ( artifactId == null || message.contains( artifactId ) )
+ && ( version == null || message.contains( version ) );
+ }
+
+ protected boolean hasModelErrors( ModelProblemCollectorExt problems )
+ {
+ if ( problems instanceof DefaultModelProblemCollector )
+ {
+ return ( (DefaultModelProblemCollector) problems ).hasErrors();
+ }
+ else
+ {
+ // the default execution path only knows the DefaultModelProblemCollector,
+ // only reason it's not in signature is because it's package private
+ throw new IllegalStateException();
+ }
+ }
+
+ protected boolean hasFatalErrors( ModelProblemCollectorExt problems )
+ {
+ if ( problems instanceof DefaultModelProblemCollector )
+ {
+ return ( (DefaultModelProblemCollector) problems ).hasFatalErrors();
+ }
+ else
+ {
+ // the default execution path only knows the DefaultModelProblemCollector,
+ // only reason it's not in signature is because it's package private
+ throw new IllegalStateException();
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java
new file mode 100644
index 00000000..36a0f46a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java
@@ -0,0 +1,243 @@
+package org.apache.maven.model.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.model.Model;
+import org.apache.maven.model.composition.DefaultDependencyManagementImporter;
+import org.apache.maven.model.composition.DependencyManagementImporter;
+import org.apache.maven.model.inheritance.DefaultInheritanceAssembler;
+import org.apache.maven.model.inheritance.InheritanceAssembler;
+import org.apache.maven.model.interpolation.ModelInterpolator;
+import org.apache.maven.model.interpolation.StringSearchModelInterpolator;
+import org.apache.maven.model.io.DefaultModelReader;
+import org.apache.maven.model.io.ModelReader;
+import org.apache.maven.model.locator.DefaultModelLocator;
+import org.apache.maven.model.locator.ModelLocator;
+import org.apache.maven.model.management.DefaultDependencyManagementInjector;
+import org.apache.maven.model.management.DefaultPluginManagementInjector;
+import org.apache.maven.model.management.DependencyManagementInjector;
+import org.apache.maven.model.management.PluginManagementInjector;
+import org.apache.maven.model.normalization.DefaultModelNormalizer;
+import org.apache.maven.model.normalization.ModelNormalizer;
+import org.apache.maven.model.path.DefaultModelPathTranslator;
+import org.apache.maven.model.path.DefaultModelUrlNormalizer;
+import org.apache.maven.model.path.DefaultPathTranslator;
+import org.apache.maven.model.path.DefaultUrlNormalizer;
+import org.apache.maven.model.path.ModelPathTranslator;
+import org.apache.maven.model.path.ModelUrlNormalizer;
+import org.apache.maven.model.path.PathTranslator;
+import org.apache.maven.model.path.UrlNormalizer;
+import org.apache.maven.model.plugin.DefaultPluginConfigurationExpander;
+import org.apache.maven.model.plugin.DefaultReportConfigurationExpander;
+import org.apache.maven.model.plugin.DefaultReportingConverter;
+import org.apache.maven.model.plugin.LifecycleBindingsInjector;
+import org.apache.maven.model.plugin.PluginConfigurationExpander;
+import org.apache.maven.model.plugin.ReportConfigurationExpander;
+import org.apache.maven.model.plugin.ReportingConverter;
+import org.apache.maven.model.profile.DefaultProfileInjector;
+import org.apache.maven.model.profile.DefaultProfileSelector;
+import org.apache.maven.model.profile.ProfileInjector;
+import org.apache.maven.model.profile.ProfileSelector;
+import org.apache.maven.model.profile.activation.FileProfileActivator;
+import org.apache.maven.model.profile.activation.JdkVersionProfileActivator;
+import org.apache.maven.model.profile.activation.OperatingSystemProfileActivator;
+import org.apache.maven.model.profile.activation.ProfileActivator;
+import org.apache.maven.model.profile.activation.PropertyProfileActivator;
+import org.apache.maven.model.superpom.DefaultSuperPomProvider;
+import org.apache.maven.model.superpom.SuperPomProvider;
+import org.apache.maven.model.validation.DefaultModelValidator;
+import org.apache.maven.model.validation.ModelValidator;
+
+/**
+ * A factory to create model 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 model builder outside of the Maven build system, Maven
+ * plugins should always acquire model builder instances via dependency injection. Developers might want to subclass
+ * this factory to provide custom implementations for some of the components used by the model builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultModelBuilderFactory
+{
+
+ protected ModelProcessor newModelProcessor()
+ {
+ DefaultModelProcessor processor = new DefaultModelProcessor();
+ processor.setModelLocator( newModelLocator() );
+ processor.setModelReader( newModelReader() );
+ return processor;
+ }
+
+ protected ModelLocator newModelLocator()
+ {
+ return new DefaultModelLocator();
+ }
+
+ protected ModelReader newModelReader()
+ {
+ return new DefaultModelReader();
+ }
+
+ protected ProfileSelector newProfileSelector()
+ {
+ DefaultProfileSelector profileSelector = new DefaultProfileSelector();
+
+ for ( ProfileActivator activator : newProfileActivators() )
+ {
+ profileSelector.addProfileActivator( activator );
+ }
+
+ return profileSelector;
+ }
+
+ protected ProfileActivator[] newProfileActivators()
+ {
+ return new ProfileActivator[] { new JdkVersionProfileActivator(), new OperatingSystemProfileActivator(),
+ new PropertyProfileActivator(), new FileProfileActivator().setPathTranslator( newPathTranslator() ) };
+ }
+
+ protected UrlNormalizer newUrlNormalizer()
+ {
+ return new DefaultUrlNormalizer();
+ }
+
+ protected PathTranslator newPathTranslator()
+ {
+ return new DefaultPathTranslator();
+ }
+
+ protected ModelInterpolator newModelInterpolator()
+ {
+ UrlNormalizer normalizer = newUrlNormalizer();
+ PathTranslator pathTranslator = newPathTranslator();
+ return new StringSearchModelInterpolator().setPathTranslator( pathTranslator ).setUrlNormalizer( normalizer );
+ }
+
+ protected ModelValidator newModelValidator()
+ {
+ return new DefaultModelValidator();
+ }
+
+ protected ModelNormalizer newModelNormalizer()
+ {
+ return new DefaultModelNormalizer();
+ }
+
+ protected ModelPathTranslator newModelPathTranslator()
+ {
+ return new DefaultModelPathTranslator().setPathTranslator( newPathTranslator() );
+ }
+
+ protected ModelUrlNormalizer newModelUrlNormalizer()
+ {
+ return new DefaultModelUrlNormalizer().setUrlNormalizer( newUrlNormalizer() );
+ }
+
+ protected InheritanceAssembler newInheritanceAssembler()
+ {
+ return new DefaultInheritanceAssembler();
+ }
+
+ protected ProfileInjector newProfileInjector()
+ {
+ return new DefaultProfileInjector();
+ }
+
+ protected SuperPomProvider newSuperPomProvider()
+ {
+ return new DefaultSuperPomProvider().setModelProcessor( newModelProcessor() );
+ }
+
+ protected DependencyManagementImporter newDependencyManagementImporter()
+ {
+ return new DefaultDependencyManagementImporter();
+ }
+
+ protected DependencyManagementInjector newDependencyManagementInjector()
+ {
+ return new DefaultDependencyManagementInjector();
+ }
+
+ protected LifecycleBindingsInjector newLifecycleBindingsInjector()
+ {
+ return new StubLifecycleBindingsInjector();
+ }
+
+ protected PluginManagementInjector newPluginManagementInjector()
+ {
+ return new DefaultPluginManagementInjector();
+ }
+
+ protected PluginConfigurationExpander newPluginConfigurationExpander()
+ {
+ return new DefaultPluginConfigurationExpander();
+ }
+
+ protected ReportConfigurationExpander newReportConfigurationExpander()
+ {
+ return new DefaultReportConfigurationExpander();
+ }
+
+ protected ReportingConverter newReportingConverter()
+ {
+ return new DefaultReportingConverter();
+ }
+
+ /**
+ * Creates a new model builder instance.
+ *
+ * @return The new model builder instance, never {@code null}.
+ */
+ public DefaultModelBuilder newInstance()
+ {
+ DefaultModelBuilder modelBuilder = new DefaultModelBuilder();
+
+ modelBuilder.setModelProcessor( newModelProcessor() );
+ modelBuilder.setModelValidator( newModelValidator() );
+ modelBuilder.setModelNormalizer( newModelNormalizer() );
+ modelBuilder.setModelPathTranslator( newModelPathTranslator() );
+ modelBuilder.setModelUrlNormalizer( newModelUrlNormalizer() );
+ modelBuilder.setModelInterpolator( newModelInterpolator() );
+ modelBuilder.setInheritanceAssembler( newInheritanceAssembler() );
+ modelBuilder.setProfileInjector( newProfileInjector() );
+ modelBuilder.setProfileSelector( newProfileSelector() );
+ modelBuilder.setSuperPomProvider( newSuperPomProvider() );
+ modelBuilder.setDependencyManagementImporter( newDependencyManagementImporter() );
+ modelBuilder.setDependencyManagementInjector( newDependencyManagementInjector() );
+ modelBuilder.setLifecycleBindingsInjector( newLifecycleBindingsInjector() );
+ modelBuilder.setPluginManagementInjector( newPluginManagementInjector() );
+ modelBuilder.setPluginConfigurationExpander( newPluginConfigurationExpander() );
+ modelBuilder.setReportConfigurationExpander( newReportConfigurationExpander() );
+ modelBuilder.setReportingConverter( newReportingConverter() );
+
+ return modelBuilder;
+ }
+
+ private static class StubLifecycleBindingsInjector
+ implements LifecycleBindingsInjector
+ {
+
+ @Override
+ public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java
new file mode 100644
index 00000000..f72403b2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java
@@ -0,0 +1,64 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Holds data relevant for a model building event.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultModelBuildingEvent
+ implements ModelBuildingEvent
+{
+
+ private final Model model;
+
+ private final ModelBuildingRequest request;
+
+ private final ModelProblemCollector problems;
+
+ public DefaultModelBuildingEvent( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ this.model = model;
+ this.request = request;
+ this.problems = problems;
+ }
+
+ @Override
+ public Model getModel()
+ {
+ return model;
+ }
+
+ @Override
+ public ModelBuildingRequest getRequest()
+ {
+ return request;
+ }
+
+ @Override
+ public ModelProblemCollector getProblems()
+ {
+ return problems;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingRequest.java
new file mode 100644
index 00000000..8b4a01b3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingRequest.java
@@ -0,0 +1,408 @@
+package org.apache.maven.model.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.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.model.resolution.WorkspaceModelResolver;
+
+/**
+ * Collects settings that control building of effective models.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultModelBuildingRequest
+ implements ModelBuildingRequest
+{
+
+ private Model rawModel;
+
+ private File pomFile;
+
+ private ModelSource modelSource;
+
+ private int validationLevel = VALIDATION_LEVEL_STRICT;
+
+ private boolean processPlugins;
+
+ private boolean twoPhaseBuilding;
+
+ private boolean locationTracking;
+
+ private List<Profile> profiles;
+
+ private List<String> activeProfileIds;
+
+ private List<String> inactiveProfileIds;
+
+ private Properties systemProperties;
+
+ private Properties userProperties;
+
+ private Date buildStartTime;
+
+ private ModelResolver modelResolver;
+
+ private ModelBuildingListener modelBuildingListener;
+
+ private ModelCache modelCache;
+
+ private WorkspaceModelResolver workspaceResolver;
+
+ /**
+ * Creates an empty request.
+ */
+ public DefaultModelBuildingRequest()
+ {
+ }
+
+ /**
+ * Creates a shallow copy of the specified request.
+ *
+ * @param request The request to copy, must not be {@code null}.
+ */
+ public DefaultModelBuildingRequest( ModelBuildingRequest request )
+ {
+ setPomFile( request.getPomFile() );
+ setModelSource( request.getModelSource() );
+ setValidationLevel( request.getValidationLevel() );
+ setProcessPlugins( request.isProcessPlugins() );
+ setTwoPhaseBuilding( request.isTwoPhaseBuilding() );
+ setProfiles( request.getProfiles() );
+ setActiveProfileIds( request.getActiveProfileIds() );
+ setInactiveProfileIds( request.getInactiveProfileIds() );
+ setSystemProperties( request.getSystemProperties() );
+ setUserProperties( request.getUserProperties() );
+ setBuildStartTime( request.getBuildStartTime() );
+ setModelResolver( request.getModelResolver() );
+ setModelBuildingListener( request.getModelBuildingListener() );
+ setModelCache( request.getModelCache() );
+ }
+
+ @Override
+ public File getPomFile()
+ {
+ return pomFile;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setPomFile( File pomFile )
+ {
+ this.pomFile = ( pomFile != null ) ? pomFile.getAbsoluteFile() : null;
+
+ return this;
+ }
+
+ @Override
+ public synchronized ModelSource getModelSource()
+ {
+ if ( modelSource == null && pomFile != null )
+ {
+ modelSource = new FileModelSource( pomFile );
+ }
+ return modelSource;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setModelSource( ModelSource modelSource )
+ {
+ this.modelSource = modelSource;
+
+ return this;
+ }
+
+ @Override
+ public int getValidationLevel()
+ {
+ return validationLevel;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setValidationLevel( int validationLevel )
+ {
+ this.validationLevel = validationLevel;
+
+ return this;
+ }
+
+ @Override
+ public boolean isProcessPlugins()
+ {
+ return processPlugins;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setProcessPlugins( boolean processPlugins )
+ {
+ this.processPlugins = processPlugins;
+
+ return this;
+ }
+
+ @Override
+ public boolean isTwoPhaseBuilding()
+ {
+ return twoPhaseBuilding;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setTwoPhaseBuilding( boolean twoPhaseBuilding )
+ {
+ this.twoPhaseBuilding = twoPhaseBuilding;
+
+ return this;
+ }
+
+ @Override
+ public boolean isLocationTracking()
+ {
+ return locationTracking;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setLocationTracking( boolean locationTracking )
+ {
+ this.locationTracking = locationTracking;
+
+ return this;
+ }
+
+ @Override
+ public List<Profile> getProfiles()
+ {
+ if ( profiles == null )
+ {
+ profiles = new ArrayList<Profile>();
+ }
+
+ return profiles;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setProfiles( List<Profile> profiles )
+ {
+ if ( profiles != null )
+ {
+ this.profiles = new ArrayList<Profile>( profiles );
+ }
+ else
+ {
+ this.profiles = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<String> getActiveProfileIds()
+ {
+ if ( activeProfileIds == null )
+ {
+ activeProfileIds = new ArrayList<String>();
+ }
+
+ return activeProfileIds;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setActiveProfileIds( List<String> activeProfileIds )
+ {
+ if ( activeProfileIds != null )
+ {
+ this.activeProfileIds = new ArrayList<String>( activeProfileIds );
+ }
+ else
+ {
+ this.activeProfileIds = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<String> getInactiveProfileIds()
+ {
+ if ( inactiveProfileIds == null )
+ {
+ inactiveProfileIds = new ArrayList<String>();
+ }
+
+ return inactiveProfileIds;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setInactiveProfileIds( List<String> inactiveProfileIds )
+ {
+ if ( inactiveProfileIds != null )
+ {
+ this.inactiveProfileIds = new ArrayList<String>( inactiveProfileIds );
+ }
+ else
+ {
+ this.inactiveProfileIds = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public Properties getSystemProperties()
+ {
+ if ( systemProperties == null )
+ {
+ systemProperties = new Properties();
+ }
+
+ return systemProperties;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setSystemProperties( Properties systemProperties )
+ {
+ if ( systemProperties != null )
+ {
+ this.systemProperties = new Properties();
+ this.systemProperties.putAll( systemProperties );
+ }
+ else
+ {
+ this.systemProperties = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public Properties getUserProperties()
+ {
+ if ( userProperties == null )
+ {
+ userProperties = new Properties();
+ }
+
+ return userProperties;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setUserProperties( Properties userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = new Properties();
+ this.userProperties.putAll( userProperties );
+ }
+ else
+ {
+ this.userProperties = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public Date getBuildStartTime()
+ {
+ return buildStartTime;
+ }
+
+ @Override
+ public ModelBuildingRequest setBuildStartTime( Date buildStartTime )
+ {
+ this.buildStartTime = buildStartTime;
+
+ return this;
+ }
+
+ @Override
+ public ModelResolver getModelResolver()
+ {
+ return this.modelResolver;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setModelResolver( ModelResolver modelResolver )
+ {
+ this.modelResolver = modelResolver;
+
+ return this;
+ }
+
+ @Override
+ public ModelBuildingListener getModelBuildingListener()
+ {
+ return modelBuildingListener;
+ }
+
+ @Override
+ public ModelBuildingRequest setModelBuildingListener( ModelBuildingListener modelBuildingListener )
+ {
+ this.modelBuildingListener = modelBuildingListener;
+
+ return this;
+ }
+
+ @Override
+ public ModelCache getModelCache()
+ {
+ return this.modelCache;
+ }
+
+ @Override
+ public DefaultModelBuildingRequest setModelCache( ModelCache modelCache )
+ {
+ this.modelCache = modelCache;
+
+ return this;
+ }
+
+ @Override
+ public Model getRawModel()
+ {
+ return rawModel;
+ }
+
+ @Override
+ public ModelBuildingRequest setRawModel( Model rawModel )
+ {
+ this.rawModel = rawModel;
+ return this;
+ }
+
+ @Override
+ public WorkspaceModelResolver getWorkspaceModelResolver()
+ {
+ return workspaceResolver;
+ }
+
+ @Override
+ public ModelBuildingRequest setWorkspaceModelResolver( WorkspaceModelResolver workspaceResolver )
+ {
+ this.workspaceResolver = workspaceResolver;
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingResult.java
new file mode 100644
index 00000000..61fb434a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingResult.java
@@ -0,0 +1,180 @@
+package org.apache.maven.model.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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+
+/**
+ * Collects the output of the model builder.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultModelBuildingResult
+ implements ModelBuildingResult
+{
+
+ private Model effectiveModel;
+
+ private List<String> modelIds;
+
+ private Map<String, Model> rawModels;
+
+ private Map<String, List<Profile>> activePomProfiles;
+
+ private List<Profile> activeExternalProfiles;
+
+ private List<ModelProblem> problems;
+
+ public DefaultModelBuildingResult()
+ {
+ modelIds = new ArrayList<String>();
+ rawModels = new HashMap<String, Model>();
+ activePomProfiles = new HashMap<String, List<Profile>>();
+ activeExternalProfiles = new ArrayList<Profile>();
+ problems = new ArrayList<ModelProblem>();
+ }
+
+ @Override
+ public Model getEffectiveModel()
+ {
+ return effectiveModel;
+ }
+
+ public DefaultModelBuildingResult setEffectiveModel( Model model )
+ {
+ this.effectiveModel = model;
+
+ return this;
+ }
+
+ @Override
+ public List<String> getModelIds()
+ {
+ return modelIds;
+ }
+
+ public DefaultModelBuildingResult addModelId( String modelId )
+ {
+ if ( modelId == null )
+ {
+ throw new IllegalArgumentException( "no model identifier specified" );
+ }
+
+ modelIds.add( modelId );
+
+ return this;
+ }
+
+ @Override
+ public Model getRawModel()
+ {
+ return rawModels.get( modelIds.get( 0 ) );
+ }
+
+ @Override
+ public Model getRawModel( String modelId )
+ {
+ return rawModels.get( modelId );
+ }
+
+ public DefaultModelBuildingResult setRawModel( String modelId, Model rawModel )
+ {
+ if ( modelId == null )
+ {
+ throw new IllegalArgumentException( "no model identifier specified" );
+ }
+
+ rawModels.put( modelId, rawModel );
+
+ return this;
+ }
+
+ @Override
+ public List<Profile> getActivePomProfiles( String modelId )
+ {
+ return activePomProfiles.get( modelId );
+ }
+
+ public DefaultModelBuildingResult setActivePomProfiles( String modelId, List<Profile> activeProfiles )
+ {
+ if ( modelId == null )
+ {
+ throw new IllegalArgumentException( "no model identifier specified" );
+ }
+
+ if ( activeProfiles != null )
+ {
+ this.activePomProfiles.put( modelId, new ArrayList<Profile>( activeProfiles ) );
+ }
+ else
+ {
+ this.activePomProfiles.remove( modelId );
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<Profile> getActiveExternalProfiles()
+ {
+ return activeExternalProfiles;
+ }
+
+ public DefaultModelBuildingResult setActiveExternalProfiles( List<Profile> activeProfiles )
+ {
+ if ( activeProfiles != null )
+ {
+ this.activeExternalProfiles = new ArrayList<Profile>( activeProfiles );
+ }
+ else
+ {
+ this.activeExternalProfiles.clear();
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<ModelProblem> getProblems()
+ {
+ return problems;
+ }
+
+ public DefaultModelBuildingResult setProblems( List<ModelProblem> problems )
+ {
+ if ( problems != null )
+ {
+ this.problems = new ArrayList<ModelProblem>( problems );
+ }
+ else
+ {
+ this.problems.clear();
+ }
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java
new file mode 100644
index 00000000..0892f0a5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblem.java
@@ -0,0 +1,175 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Describes a problem that was encountered during model 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 POM file that exhibits
+ * the problem.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultModelProblem
+ implements ModelProblem
+{
+
+ private final String source;
+
+ private final int lineNumber;
+
+ private final int columnNumber;
+
+ private final String modelId;
+
+ private final String message;
+
+ private final Exception exception;
+
+ private final Severity severity;
+
+ private final Version version;
+
+
+ /**
+ * 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 ModelProblem.Severity#ERROR}.
+ * @param source The source of the problem, 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 exception The exception that caused this problem, may be {@code null}.
+ */
+ //mkleint: does this need to be public?
+ public DefaultModelProblem( String message, Severity severity, Version version, Model source, int lineNumber,
+ int columnNumber, Exception exception )
+ {
+ this( message, severity, version, ModelProblemUtils.toPath( source ), lineNumber, columnNumber,
+ ModelProblemUtils.toId( source ), exception );
+ }
+
+ /**
+ * 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 ModelProblem.Severity#ERROR}.
+ * @param version The version since the problem is relevant
+ * @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 modelId The identifier of the model that exhibits the problem, may be {@code null}.
+ * @param exception The exception that caused this problem, may be {@code null}.
+ */
+ //mkleint: does this need to be public?
+ public DefaultModelProblem( String message, Severity severity, Version version, String source, int lineNumber,
+ int columnNumber, String modelId, Exception exception )
+ {
+ this.message = message;
+ this.severity = ( severity != null ) ? severity : Severity.ERROR;
+ this.source = ( source != null ) ? source : "";
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ this.modelId = ( modelId != null ) ? modelId : "";
+ this.exception = exception;
+ this.version = version;
+ }
+
+ @Override
+ public String getSource()
+ {
+ return source;
+ }
+
+ @Override
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+
+ @Override
+ public int getColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ @Override
+ public String getModelId()
+ {
+ return modelId;
+ }
+
+ @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 Version getVersion()
+ {
+ return version;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+
+ buffer.append( "[" ).append( getSeverity() ).append( "] " );
+ buffer.append( getMessage() );
+ buffer.append( " @ " ).append( ModelProblemUtils.formatLocation( this, null ) );
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java
new file mode 100644
index 00000000..89d5cb21
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProblemCollector.java
@@ -0,0 +1,200 @@
+package org.apache.maven.model.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.EnumSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.ModelParseException;
+
+/**
+ * Collects problems that are encountered during model building. The primary purpose of this component is to account for
+ * the fact that the problem reporter has/should not have information about the calling context and hence cannot provide
+ * an expressive source hint for the model problem. Instead, the source hint is configured by the model builder before
+ * it delegates to other components that potentially encounter problems. Then, the problem reporter can focus on
+ * providing a simple error message, leaving the donkey work of creating a nice model problem to this component.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultModelProblemCollector
+ implements ModelProblemCollectorExt
+{
+
+ private final ModelBuildingResult result;
+
+ private List<ModelProblem> problems;
+
+ private String source;
+
+ private Model sourceModel;
+
+ private Model rootModel;
+
+ private Set<ModelProblem.Severity> severities = EnumSet.noneOf( ModelProblem.Severity.class );
+
+ public DefaultModelProblemCollector( ModelBuildingResult result )
+ {
+ this.result = result;
+ this.problems = result.getProblems();
+
+ for ( ModelProblem problem : this.problems )
+ {
+ severities.add( problem.getSeverity() );
+ }
+ }
+
+ public boolean hasFatalErrors()
+ {
+ return severities.contains( ModelProblem.Severity.FATAL );
+ }
+
+ public boolean hasErrors()
+ {
+ return severities.contains( ModelProblem.Severity.ERROR ) || severities.contains( ModelProblem.Severity.FATAL );
+ }
+
+ @Override
+ public List<ModelProblem> getProblems()
+ {
+ return problems;
+ }
+
+ public void setSource( String source )
+ {
+ this.source = source;
+ this.sourceModel = null;
+ }
+
+ public void setSource( Model source )
+ {
+ this.sourceModel = source;
+ this.source = null;
+
+ if ( rootModel == null )
+ {
+ rootModel = source;
+ }
+ }
+
+ private String getSource()
+ {
+ if ( source == null && sourceModel != null )
+ {
+ source = ModelProblemUtils.toPath( sourceModel );
+ }
+ return source;
+ }
+
+ private String getModelId()
+ {
+ return ModelProblemUtils.toId( sourceModel );
+ }
+
+ public void setRootModel( Model rootModel )
+ {
+ this.rootModel = rootModel;
+ }
+
+ public Model getRootModel()
+ {
+ return rootModel;
+ }
+
+ public String getRootModelId()
+ {
+ return ModelProblemUtils.toId( rootModel );
+ }
+
+ public void add( ModelProblem problem )
+ {
+ problems.add( problem );
+
+ severities.add( problem.getSeverity() );
+ }
+
+ public void addAll( List<ModelProblem> problems )
+ {
+ this.problems.addAll( problems );
+
+ for ( ModelProblem problem : problems )
+ {
+ severities.add( problem.getSeverity() );
+ }
+ }
+
+ @Override
+ public void add( ModelProblemCollectorRequest req )
+ {
+ int line = -1;
+ int column = -1;
+ String source = null;
+ String modelId = null;
+
+ if ( req.getLocation() != null )
+ {
+ line = req.getLocation().getLineNumber();
+ column = req.getLocation().getColumnNumber();
+ if ( req.getLocation().getSource() != null )
+ {
+ modelId = req.getLocation().getSource().getModelId();
+ source = req.getLocation().getSource().getLocation();
+ }
+ }
+
+ if ( modelId == null )
+ {
+ modelId = getModelId();
+ source = getSource();
+ }
+
+ if ( line <= 0 && column <= 0 && req.getException() instanceof ModelParseException )
+ {
+ ModelParseException e = (ModelParseException) req.getException();
+ line = e.getLineNumber();
+ column = e.getColumnNumber();
+ }
+
+ ModelProblem problem =
+ new DefaultModelProblem( req.getMessage(), req.getSeverity(), req.getVersion(), source, line, column,
+ modelId, req.getException() );
+
+ add( problem );
+ }
+
+ public ModelBuildingException newModelBuildingException()
+ {
+ ModelBuildingResult result = this.result;
+ if ( result.getModelIds().isEmpty() )
+ {
+ DefaultModelBuildingResult tmp = new DefaultModelBuildingResult();
+ tmp.setEffectiveModel( result.getEffectiveModel() );
+ tmp.setProblems( getProblems() );
+ tmp.setActiveExternalProfiles( result.getActiveExternalProfiles() );
+ String id = getRootModelId();
+ tmp.addModelId( id );
+ tmp.setRawModel( id, getRootModel() );
+ result = tmp;
+ }
+ return new ModelBuildingException( result );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java
new file mode 100644
index 00000000..a4d5fa93
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java
@@ -0,0 +1,84 @@
+package org.apache.maven.model.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.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.ModelReader;
+import org.apache.maven.model.locator.ModelLocator;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Component( role = ModelProcessor.class )
+public class DefaultModelProcessor
+ implements ModelProcessor
+{
+
+ @Requirement
+ private ModelLocator locator;
+
+ @Requirement
+ private ModelReader reader;
+
+ public DefaultModelProcessor setModelLocator( ModelLocator locator )
+ {
+ this.locator = locator;
+ return this;
+ }
+
+ public DefaultModelProcessor setModelReader( ModelReader reader )
+ {
+ this.reader = reader;
+ return this;
+ }
+
+ @Override
+ public File locatePom( File projectDirectory )
+ {
+ return locator.locatePom( projectDirectory );
+ }
+
+ @Override
+ public Model read( File input, Map<String, ?> options )
+ throws IOException
+ {
+ return reader.read( input, options );
+ }
+
+ @Override
+ public Model read( Reader input, Map<String, ?> options )
+ throws IOException
+ {
+ return reader.read( input, options );
+ }
+
+ @Override
+ public Model read( InputStream input, Map<String, ?> options )
+ throws IOException
+ {
+ return reader.read( input, options );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
new file mode 100644
index 00000000..a2e11417
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FileModelSource.java
@@ -0,0 +1,83 @@
+package org.apache.maven.model.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.net.URI;
+
+import org.apache.maven.building.FileSource;
+
+/**
+ * Wraps an ordinary {@link File} as a model source.
+ *
+ * @author Benjamin Bentmann
+ */
+public class FileModelSource extends FileSource implements ModelSource2
+{
+
+ /**
+ * Creates a new model source backed by the specified file.
+ *
+ * @param pomFile The POM file, must not be {@code null}.
+ */
+ public FileModelSource( File pomFile )
+ {
+ super( pomFile );
+ }
+
+ /**
+ *
+ * @return the file of this source
+ *
+ * @deprecated instead use {@link #getFile()}
+ */
+ @Deprecated
+ public File getPomFile()
+ {
+ return getFile();
+ }
+
+ @Override
+ public ModelSource2 getRelatedSource( String relPath )
+ {
+ relPath = relPath.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar );
+
+ File relatedPom = new File( getFile().getParentFile(), relPath );
+
+ if ( relatedPom.isDirectory() )
+ {
+ // TODO figure out how to reuse ModelLocator.locatePom(File) here
+ relatedPom = new File( relatedPom, "pom.xml" );
+ }
+
+ if ( relatedPom.isFile() && relatedPom.canRead() )
+ {
+ return new FileModelSource( new File( relatedPom.toURI().normalize() ) );
+ }
+
+ return null;
+ }
+
+ @Override
+ public URI getLocationURI()
+ {
+ return getFile().toURI();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FilterModelBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FilterModelBuildingRequest.java
new file mode 100644
index 00000000..c5c2cbfa
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/FilterModelBuildingRequest.java
@@ -0,0 +1,285 @@
+package org.apache.maven.model.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.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.model.resolution.WorkspaceModelResolver;
+
+/**
+ * A model building request that delegates all methods invocations to another request, meant for easy transformations by
+ * subclassing.
+ *
+ * @author Benjamin Bentmann
+ */
+class FilterModelBuildingRequest
+ implements ModelBuildingRequest
+{
+
+ protected ModelBuildingRequest request;
+
+ public FilterModelBuildingRequest( ModelBuildingRequest request )
+ {
+ this.request = request;
+ }
+
+ @Override
+ public File getPomFile()
+ {
+ return request.getPomFile();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setPomFile( File pomFile )
+ {
+ request.setPomFile( pomFile );
+
+ return this;
+ }
+
+ @Override
+ public ModelSource getModelSource()
+ {
+ return request.getModelSource();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setModelSource( ModelSource modelSource )
+ {
+ request.setModelSource( modelSource );
+
+ return this;
+ }
+
+ @Override
+ public int getValidationLevel()
+ {
+ return request.getValidationLevel();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setValidationLevel( int validationLevel )
+ {
+ request.setValidationLevel( validationLevel );
+
+ return this;
+ }
+
+ @Override
+ public boolean isProcessPlugins()
+ {
+ return request.isProcessPlugins();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setProcessPlugins( boolean processPlugins )
+ {
+ request.setProcessPlugins( processPlugins );
+
+ return this;
+ }
+
+ @Override
+ public boolean isTwoPhaseBuilding()
+ {
+ return request.isTwoPhaseBuilding();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setTwoPhaseBuilding( boolean twoPhaseBuilding )
+ {
+ request.setTwoPhaseBuilding( twoPhaseBuilding );
+
+ return this;
+ }
+
+ @Override
+ public boolean isLocationTracking()
+ {
+ return request.isLocationTracking();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setLocationTracking( boolean locationTracking )
+ {
+ request.setLocationTracking( locationTracking );
+
+ return this;
+ }
+
+ @Override
+ public List<Profile> getProfiles()
+ {
+ return request.getProfiles();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setProfiles( List<Profile> profiles )
+ {
+ request.setProfiles( profiles );
+
+ return this;
+ }
+
+ @Override
+ public List<String> getActiveProfileIds()
+ {
+ return request.getActiveProfileIds();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setActiveProfileIds( List<String> activeProfileIds )
+ {
+ request.setActiveProfileIds( activeProfileIds );
+
+ return this;
+ }
+
+ @Override
+ public List<String> getInactiveProfileIds()
+ {
+ return request.getInactiveProfileIds();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setInactiveProfileIds( List<String> inactiveProfileIds )
+ {
+ request.setInactiveProfileIds( inactiveProfileIds );
+
+ return this;
+ }
+
+ @Override
+ public Properties getSystemProperties()
+ {
+ return request.getSystemProperties();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setSystemProperties( Properties systemProperties )
+ {
+ request.setSystemProperties( systemProperties );
+
+ return this;
+ }
+
+ @Override
+ public Properties getUserProperties()
+ {
+ return request.getUserProperties();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setUserProperties( Properties userProperties )
+ {
+ request.setUserProperties( userProperties );
+
+ return this;
+ }
+
+ @Override
+ public Date getBuildStartTime()
+ {
+ return request.getBuildStartTime();
+ }
+
+ @Override
+ public ModelBuildingRequest setBuildStartTime( Date buildStartTime )
+ {
+ request.setBuildStartTime( buildStartTime );
+
+ return this;
+ }
+
+ @Override
+ public ModelResolver getModelResolver()
+ {
+ return request.getModelResolver();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setModelResolver( ModelResolver modelResolver )
+ {
+ request.setModelResolver( modelResolver );
+
+ return this;
+ }
+
+ @Override
+ public ModelBuildingListener getModelBuildingListener()
+ {
+ return request.getModelBuildingListener();
+ }
+
+ @Override
+ public ModelBuildingRequest setModelBuildingListener( ModelBuildingListener modelBuildingListener )
+ {
+ request.setModelBuildingListener( modelBuildingListener );
+
+ return this;
+ }
+
+ @Override
+ public ModelCache getModelCache()
+ {
+ return request.getModelCache();
+ }
+
+ @Override
+ public FilterModelBuildingRequest setModelCache( ModelCache modelCache )
+ {
+ request.setModelCache( modelCache );
+
+ return this;
+ }
+
+ @Override
+ public Model getRawModel()
+ {
+ return request.getRawModel();
+ }
+
+ @Override
+ public ModelBuildingRequest setRawModel( Model rawModel )
+ {
+ request.setRawModel( rawModel );
+ return this;
+ }
+
+ @Override
+ public WorkspaceModelResolver getWorkspaceModelResolver()
+ {
+ return request.getWorkspaceModelResolver();
+ }
+
+ @Override
+ public ModelBuildingRequest setWorkspaceModelResolver( WorkspaceModelResolver workspaceResolver )
+ {
+ request.setWorkspaceModelResolver( workspaceResolver );
+ return this;
+ }
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuilder.java
new file mode 100644
index 00000000..2a49a213
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuilder.java
@@ -0,0 +1,67 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Builds the effective model from a POM.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelBuilder
+{
+
+ /**
+ * Builds the effective model of the specified POM.
+ *
+ * @param request The model building request that holds the parameters, must not be {@code null}.
+ * @return The result of the model building, never {@code null}.
+ * @throws ModelBuildingException If the effective model could not be built.
+ */
+ ModelBuildingResult build( ModelBuildingRequest request )
+ throws ModelBuildingException;
+
+ /**
+ * Builds the effective model by completing the specified interim result which was produced by a previous call to
+ * {@link #build(ModelBuildingRequest)} with {@link ModelBuildingRequest#isTwoPhaseBuilding()} being {@code true}.
+ * The model building request passed to this method must be the same as the one used for the first phase of the
+ * model building.
+ *
+ * @param request The model building request that holds the parameters, must not be {@code null}.
+ * @param result The interim result of the first phase of model building, must not be {@code null}.
+ * @return The result of the model building, never {@code null}.
+ * @throws ModelBuildingException If the effective model could not be built.
+ */
+ ModelBuildingResult build( ModelBuildingRequest request, ModelBuildingResult result )
+ throws ModelBuildingException;
+
+ /**
+ * Performs only the part of {@link ModelBuilder#build(ModelBuildingRequest)} that loads the raw model
+ *
+ * @param request
+ * @return
+ * @throws ModelBuildingException
+ */
+ Result<? extends Model> buildRawModel( File pomFile, int validationLevel, boolean locationTracking );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEvent.java
new file mode 100644
index 00000000..2995b1bf
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEvent.java
@@ -0,0 +1,53 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Holds data relevant for a model building event.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelBuildingEvent
+{
+
+ /**
+ * Gets the model being built. The precise state of this model depends on the event being fired.
+ *
+ * @return The model being built, never {@code null}.
+ */
+ Model getModel();
+
+ /**
+ * Gets the model building request being processed.
+ *
+ * @return The model building request being processed, never {@code null}.
+ */
+ ModelBuildingRequest getRequest();
+
+ /**
+ * Gets the container used to collect problems that were encountered while processing the event.
+ *
+ * @return The container used to collect problems that were encountered, never {@code null}.
+ */
+ ModelProblemCollector getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java
new file mode 100644
index 00000000..092dc4e0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingEventCatapult.java
@@ -0,0 +1,48 @@
+package org.apache.maven.model.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.
+ */
+
+/**
+ * Assists in firing events from a generic method by abstracting from the actual callback method to be called on the
+ * listener.
+ *
+ * @author Benjamin Bentmann
+ */
+interface ModelBuildingEventCatapult
+{
+
+ /**
+ * Notifies the specified listener of the given event.
+ *
+ * @param listener The listener to notify, must not be {@code null}.
+ * @param event The event to fire, must not be {@code null}.
+ */
+ void fire( ModelBuildingListener listener, ModelBuildingEvent event );
+
+ ModelBuildingEventCatapult BUILD_EXTENSIONS_ASSEMBLED = new ModelBuildingEventCatapult()
+ {
+ @Override
+ public void fire( ModelBuildingListener listener, ModelBuildingEvent event )
+ {
+ listener.buildExtensionsAssembled( event );
+ }
+ };
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java
new file mode 100644
index 00000000..434cb591
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingException.java
@@ -0,0 +1,180 @@
+package org.apache.maven.model.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.Collections;
+import java.util.List;
+
+import org.apache.maven.model.Model;
+
+/**
+ * Signals one ore more errors during model building. The model 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 ModelBuildingException
+ extends Exception
+{
+
+ private final ModelBuildingResult result;
+
+ /**
+ * Creates a new exception with the specified problems.
+ *
+ * @param model The model that could not be built, may be {@code null}.
+ * @param modelId The identifier of the model that could not be built, may be {@code null}.
+ * @param problems The problems that causes this exception, may be {@code null}.
+ * @deprecated Use {@link #ModelBuildingException(ModelBuildingResult)} instead.
+ */
+ @Deprecated
+ public ModelBuildingException( Model model, String modelId, List<ModelProblem> problems )
+ {
+ super( toMessage( modelId, problems ) );
+
+ if ( model != null )
+ {
+ DefaultModelBuildingResult tmp = new DefaultModelBuildingResult();
+ if ( modelId == null )
+ {
+ modelId = "";
+ }
+ tmp.addModelId( modelId );
+ tmp.setRawModel( modelId, model );
+ tmp.setProblems( problems );
+ result = tmp;
+ }
+ else
+ {
+ result = null;
+ }
+ }
+
+ /**
+ * Creates a new exception from the specified interim result and its associated problems.
+ *
+ * @param result The interim result, may be {@code null}.
+ */
+ public ModelBuildingException( ModelBuildingResult result )
+ {
+ super( toMessage( result ) );
+ this.result = result;
+ }
+
+ /**
+ * Gets the interim result of the model building up to the point where it failed.
+ *
+ * @return The interim model building result or {@code null} if not available.
+ */
+ public ModelBuildingResult getResult()
+ {
+ return result;
+ }
+
+ /**
+ * Gets the model that could not be built properly.
+ *
+ * @return The erroneous model or {@code null} if not available.
+ */
+ public Model getModel()
+ {
+ if ( result == null )
+ {
+ return null;
+ }
+ if ( result.getEffectiveModel() != null )
+ {
+ return result.getEffectiveModel();
+ }
+ return result.getRawModel();
+ }
+
+ /**
+ * Gets the identifier of the POM whose effective model could not be built. The general format of the identifier is
+ * {@code <groupId>:<artifactId>:<version>} but some of these coordinates may still be unknown at the point the
+ * exception is thrown so this information is merely meant to assist the user.
+ *
+ * @return The identifier of the POM or an empty string if not known, never {@code null}.
+ */
+ public String getModelId()
+ {
+ if ( result == null || result.getModelIds().isEmpty() )
+ {
+ return "";
+ }
+ return result.getModelIds().get( 0 );
+ }
+
+ /**
+ * Gets the problems that caused this exception.
+ *
+ * @return The problems that caused this exception, never {@code null}.
+ */
+ public List<ModelProblem> getProblems()
+ {
+ if ( result == null )
+ {
+ return Collections.emptyList();
+ }
+ return result.getProblems();
+ }
+
+ private static String toMessage( ModelBuildingResult result )
+ {
+ if ( result != null && !result.getModelIds().isEmpty() )
+ {
+ return toMessage( result.getModelIds().get( 0 ), result.getProblems() );
+ }
+ return null;
+ }
+
+ private static String toMessage( String modelId, List<ModelProblem> 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 model" );
+ if ( modelId != null && modelId.length() > 0 )
+ {
+ writer.print( " for " );
+ writer.print( modelId );
+ }
+ writer.println();
+
+ for ( ModelProblem problem : problems )
+ {
+ writer.print( "[" );
+ writer.print( problem.getSeverity() );
+ writer.print( "] " );
+ writer.print( problem.getMessage() );
+ writer.print( " @ " );
+ writer.println( ModelProblemUtils.formatLocation( problem, modelId ) );
+ }
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingListener.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingListener.java
new file mode 100644
index 00000000..21029cc8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingListener.java
@@ -0,0 +1,40 @@
+package org.apache.maven.model.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.
+ */
+
+/**
+ * Defines events that the model builder fires during construction of the effective model. When a listener encounteres
+ * errors while processing the event, it can report these problems via {@link ModelBuildingEvent#getProblems()}.
+ * <em>Note:</em> To cope with future extensions to this interface, it is strongly recommended to extend
+ * {@link AbstractModelBuildingListener} rather than to directly implement this interface.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelBuildingListener
+{
+
+ /**
+ * Notifies the listener that the model has been constructed to the extent where build extensions can be processed.
+ *
+ * @param event The details about the event.
+ */
+ void buildExtensionsAssembled( ModelBuildingEvent event );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
new file mode 100644
index 00000000..c10274db
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingRequest.java
@@ -0,0 +1,338 @@
+package org.apache.maven.model.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.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.model.resolution.WorkspaceModelResolver;
+
+/**
+ * Collects settings that control the building of effective models.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelBuildingRequest
+{
+
+ /**
+ * Denotes minimal validation of POMs. This validation level is meant for processing of POMs from repositories
+ * during metadata retrieval.
+ */
+ int VALIDATION_LEVEL_MINIMAL = 0;
+
+ /**
+ * Denotes validation as performed by Maven 2.0. This validation level is meant as a compatibility mode to allow
+ * users to migrate their projects.
+ */
+ int VALIDATION_LEVEL_MAVEN_2_0 = 20;
+
+ /**
+ * Denotes validation as performed by Maven 3.0. This validation level is meant for existing projects.
+ */
+ int VALIDATION_LEVEL_MAVEN_3_0 = 30;
+
+ /**
+ * Denotes validation as performed by Maven 3.1. This validation level is meant for new projects.
+ */
+ int VALIDATION_LEVEL_MAVEN_3_1 = 31;
+
+ /**
+ * Denotes strict validation as recommended by the current Maven version.
+ */
+ int VALIDATION_LEVEL_STRICT = VALIDATION_LEVEL_MAVEN_3_0;
+
+ /**
+ * Gets the raw model to build. If not set, model source will be used to load raw model.
+ *
+ * @return The raw model to build or {@code null} if not set.
+ */
+ Model getRawModel();
+
+ /**
+ * Set raw model.
+ *
+ * @param model
+ */
+ ModelBuildingRequest setRawModel( Model rawModel );
+
+ /**
+ * Gets the source of the POM to process.
+ *
+ * @return The source of the POM or {@code null} if not set.
+ */
+ ModelSource getModelSource();
+
+ /**
+ * Sets the source of the POM to process. Eventually, either {@link #setModelSource(ModelSource)} or
+ * {@link #setPomFile(File)} must be set.
+ *
+ * @param modelSource The source of the POM to process, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setModelSource( ModelSource modelSource );
+
+ /**
+ * Gets the POM file of the project to build.
+ *
+ * @return The POM file of the project or {@code null} if not applicable (i.e. when processing a POM from the
+ * repository).
+ */
+ File getPomFile();
+
+ /**
+ * Sets the POM file of the project to build. Note that providing the path to a POM file via this method will make
+ * the model builder operate in project mode. This mode is meant for effective models that are employed during the
+ * build process of a local project. Hence the effective model will support the notion of a project directory. To
+ * build the model for a POM from the repository, use {@link #setModelSource(ModelSource)} in combination with a
+ * {@link FileModelSource} instead.
+ *
+ * @param pomFile The POM file of the project to build the effective model for, may be {@code null} to build the
+ * model of some POM from the repository.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setPomFile( File pomFile );
+
+ /**
+ * Gets the level of validation to perform on processed models.
+ *
+ * @return The level of validation to perform on processed models.
+ */
+ int getValidationLevel();
+
+ /**
+ * Sets the level of validation to perform on processed models. For building of projects,
+ * {@link #VALIDATION_LEVEL_STRICT} should be used to ensure proper building. For the mere retrievel of dependencies
+ * during artifact resolution, {@link #VALIDATION_LEVEL_MINIMAL} should be used to account for models of poor
+ * quality. By default, models are validated in strict mode.
+ *
+ * @param validationLevel The level of validation to perform on processed models.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setValidationLevel( int validationLevel );
+
+ /**
+ * Indicates whether plugin executions and configurations should be processed. If enabled, lifecycle-induced plugin
+ * executions will be injected into the model and common plugin configuration will be propagated to individual
+ * executions.
+ *
+ * @return {@code true} if plugins should be processed, {@code false} otherwise.
+ */
+ boolean isProcessPlugins();
+
+ /**
+ * Controls the processing of plugin executions and configurations.
+ *
+ * @param processPlugins {@code true} to enable plugin processing, {@code false} otherwise.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setProcessPlugins( boolean processPlugins );
+
+ /**
+ * Indicates whether the model building should happen in two phases. If enabled, the initial invocation of the model
+ * builder will only produce an interim result which may be used to analyze inter-model dependencies before the
+ * final invocation of the model builder is performed.
+ *
+ * @return {@code true} if two-phase building is enabled, {@code false} if the model should be build in a single
+ * step.
+ */
+ boolean isTwoPhaseBuilding();
+
+ /**
+ * Enables/disables two-phase building. If enabled, the initial invocation of the model builder will only produce an
+ * interim result which may be used to analyze inter-model dependencies before the final invocation of the model
+ * builder is performed.
+ *
+ * @param twoPhaseBuilding {@code true} to enable two-phase building, {@code false} if the model should be build in
+ * a single step.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setTwoPhaseBuilding( boolean twoPhaseBuilding );
+
+ /**
+ * Indicates whether the model should track the line/column number of the model source from which it was parsed.
+ *
+ * @return {@code true} if location tracking is enabled, {@code false} otherwise.
+ */
+ boolean isLocationTracking();
+
+ /**
+ * Enables/disables the tracking of line/column numbers for the model source being parsed. By default, input
+ * locations are not tracked.
+ *
+ * @param locationTracking {@code true} to enable location tracking, {@code false} to disable it.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setLocationTracking( boolean locationTracking );
+
+ /**
+ * Gets the external profiles that should be considered for model building.
+ *
+ * @return The external profiles that should be considered for model building, never {@code null}.
+ */
+ List<Profile> getProfiles();
+
+ /**
+ * Sets the external profiles that should be considered for model building.
+ *
+ * @param profiles The external profiles that should be considered for model building, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setProfiles( List<Profile> profiles );
+
+ /**
+ * Gets the identifiers of those profiles that should be activated by explicit demand.
+ *
+ * @return The identifiers of those profiles to activate, never {@code null}.
+ */
+ List<String> getActiveProfileIds();
+
+ /**
+ * Sets the identifiers of those profiles that should be activated by explicit demand.
+ *
+ * @param activeProfileIds The identifiers of those profiles to activate, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setActiveProfileIds( List<String> activeProfileIds );
+
+ /**
+ * Gets the identifiers of those profiles that should be deactivated by explicit demand.
+ *
+ * @return The identifiers of those profiles to deactivate, never {@code null}.
+ */
+ List<String> getInactiveProfileIds();
+
+ /**
+ * Sets the identifiers of those profiles that should be deactivated by explicit demand.
+ *
+ * @param inactiveProfileIds The identifiers of those profiles to deactivate, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setInactiveProfileIds( List<String> inactiveProfileIds );
+
+ /**
+ * Gets the system properties to use for interpolation and profile activation. 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 and profile activation. 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}.
+ */
+ ModelBuildingRequest setSystemProperties( Properties systemProperties );
+
+ /**
+ * Gets the user properties to use for interpolation and profile activation. 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 and profile activation. 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}.
+ */
+ ModelBuildingRequest setUserProperties( Properties userProperties );
+
+ /**
+ * Gets the start time of the build.
+ *
+ * @return The start time of the build or {@code null} if unknown.
+ */
+ Date getBuildStartTime();
+
+ /**
+ * Sets the start time of the build.
+ *
+ * @param buildStartTime The start time of the build, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setBuildStartTime( Date buildStartTime );
+
+ /**
+ * Gets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
+ * project directory.
+ *
+ * @return The model resolver or {@code null} if not set.
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver to use for resolution of mixins or parents that are not locally reachable from the
+ * project directory.
+ *
+ * @param modelResolver The model resolver to use, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setModelResolver( ModelResolver modelResolver );
+
+ /**
+ * Gets the model building listener to notify during the build process.
+ *
+ * @return The model building listener to notify or {@code null} if none.
+ */
+ ModelBuildingListener getModelBuildingListener();
+
+ /**
+ * Sets the model building listener to notify during the build process.
+ *
+ * @param modelBuildingListener The model building listener to notify, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setModelBuildingListener( ModelBuildingListener modelBuildingListener );
+
+ /**
+ * Gets the model cache to use for reuse of previously built models.
+ *
+ * @return The model cache or {@code null} if not set.
+ */
+ ModelCache getModelCache();
+
+ /**
+ * Sets the model cache to use for reuse of previously built models. This is an optional component that serves
+ * performance optimizations.
+ *
+ * @param modelCache The model cache to use, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ ModelBuildingRequest setModelCache( ModelCache modelCache );
+
+ WorkspaceModelResolver getWorkspaceModelResolver();
+
+ ModelBuildingRequest setWorkspaceModelResolver( WorkspaceModelResolver workspaceResolver );
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingResult.java
new file mode 100644
index 00000000..44b12958
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelBuildingResult.java
@@ -0,0 +1,99 @@
+package org.apache.maven.model.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.model.Model;
+import org.apache.maven.model.Profile;
+
+/**
+ * Collects the output of the model builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelBuildingResult
+{
+
+ /**
+ * Gets the sequence of model identifiers that denote the lineage of models from which the effective model was
+ * constructed. Model identifiers have the form {@code <groupId>:<artifactId>:<version>}. The first identifier from
+ * the list denotes the model on which the model builder was originally invoked. The last identifier will always be
+ * an empty string that by definition denotes the super POM.
+ *
+ * @return The model identifiers from the lineage of models, never {@code null}.
+ */
+ List<String> getModelIds();
+
+ /**
+ * Gets the assembled model.
+ *
+ * @return The assembled model, never {@code null}.
+ */
+ Model getEffectiveModel();
+
+ /**
+ * Gets the raw model as it was read from the input model source. Apart from basic validation, the raw model has not
+ * undergone any updates by the model builder, e.g. reflects neither inheritance nor interpolation.
+ *
+ * @return The raw model, never {@code null}.
+ */
+ Model getRawModel();
+
+ /**
+ * Gets the specified raw model as it was read from a model source. Apart from basic validation, a raw model has not
+ * undergone any updates by the model builder, e.g. reflects neither inheritance nor interpolation. The model
+ * identifier should be from the collection obtained by {@link #getModelIds()}. As a special case, an empty string
+ * can be used as the identifier for the super POM.
+ *
+ * @param modelId The identifier of the desired raw model, must not be {@code null}.
+ * @return The raw model or {@code null} if the specified model id does not refer to a known model.
+ */
+ Model getRawModel( String modelId );
+
+ /**
+ * Gets the profiles from the specified model that were active during model building. The model identifier should be
+ * from the collection obtained by {@link #getModelIds()}. As a special case, an empty string can be used as the
+ * identifier for the super POM.
+ *
+ * @param modelId The identifier of the model whose active profiles should be retrieved, must not be {@code null}.
+ * @return The active profiles of the model or an empty list if none or {@code null} if the specified model id does
+ * not refer to a known model.
+ */
+ List<Profile> getActivePomProfiles( String modelId );
+
+ /**
+ * Gets the external profiles that were active during model building. External profiles are those that were
+ * contributed by {@link ModelBuildingRequest#getProfiles()}.
+ *
+ * @return The active external profiles or an empty list if none, never {@code null}.
+ */
+ List<Profile> getActiveExternalProfiles();
+
+ /**
+ * Gets the problems that were encountered during the model building. Note that only problems of severity
+ * {@link ModelProblem.Severity#WARNING} and below are reported here. Problems with a higher severity level cause
+ * the model builder to fail with a {@link ModelBuildingException}.
+ *
+ * @return The problems that were encountered during the model building, can be empty but never {@code null}.
+ */
+ List<ModelProblem> getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCache.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCache.java
new file mode 100644
index 00000000..132a5113
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCache.java
@@ -0,0 +1,56 @@
+package org.apache.maven.model.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.
+ */
+
+/**
+ * Caches auxiliary data used during model building like already processed raw/effective models. The data in the cache
+ * is meant for exclusive consumption by the model builder and is opaque to the cache implementation. The cache key is
+ * formed by a combination of group id, artifact id, version and tag. The first three components generally refer to the
+ * identify of a model. The tag allows for further classification of the associated data on the sole discretion of the
+ * model builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelCache
+{
+
+ /**
+ * Puts the specified data into the cache.
+ *
+ * @param groupId The group id of the cache record, must not be {@code null}.
+ * @param artifactId The artifact id of the cache record, must not be {@code null}.
+ * @param version The version of the cache record, must not be {@code null}.
+ * @param tag The tag of the cache record, must not be {@code null}.
+ * @param data The data to store in the cache, must not be {@code null}.
+ */
+ void put( String groupId, String artifactId, String version, String tag, Object data );
+
+ /**
+ * Gets the specified data from the cache.
+ *
+ * @param groupId The group id of the cache record, must not be {@code null}.
+ * @param artifactId The artifact id of the cache record, must not be {@code null}.
+ * @param version The version of the cache record, must not be {@code null}.
+ * @param tag The tag of the cache record, must not be {@code null}.
+ * @return The requested data or {@code null} if none was present in the cache.
+ */
+ Object get( String groupId, String artifactId, String version, String tag );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCacheTag.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCacheTag.java
new file mode 100644
index 00000000..8452f967
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCacheTag.java
@@ -0,0 +1,132 @@
+package org.apache.maven.model.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.model.DependencyManagement;
+import org.apache.maven.model.Model;
+
+/**
+ * Describes a tag used by the model builder to access a {@link ModelCache}. This interface basically aggregates a name
+ * and a class to provide some type safety when working with the otherwise untyped cache.
+ *
+ * @author Benjamin Bentmann
+ * @param <T> The type of data associated with the tag.
+ */
+interface ModelCacheTag<T>
+{
+
+ /**
+ * Gets the name of the tag.
+ *
+ * @return The name of the tag, must not be {@code null}.
+ */
+ String getName();
+
+ /**
+ * Gets the type of data associated with this tag.
+ *
+ * @return The type of data, must not be {@code null}.
+ */
+ Class<T> getType();
+
+ /**
+ * Creates a copy of the data suitable for storage in the cache. The original data to store can be mutated after the
+ * cache is populated but the state of the cache must not change so we need to make a copy.
+ *
+ * @param data The data to store in the cache, must not be {@code null}.
+ * @return The data being stored in the cache, never {@code null}.
+ */
+ T intoCache( T data );
+
+ /**
+ * Creates a copy of the data suitable for retrieval from the cache. The retrieved data can be mutated after the
+ * cache is queried but the state of the cache must not change so we need to make a copy.
+ *
+ * @param data The data to retrieve from the cache, must not be {@code null}.
+ * @return The data being retrieved from the cache, never {@code null}.
+ */
+ T fromCache( T data );
+
+ /**
+ * The tag used to denote raw model data.
+ */
+ ModelCacheTag<ModelData> RAW = new ModelCacheTag<ModelData>()
+ {
+
+ @Override
+ public String getName()
+ {
+ return "raw";
+ }
+
+ @Override
+ public Class<ModelData> getType()
+ {
+ return ModelData.class;
+ }
+
+ @Override
+ public ModelData intoCache( ModelData data )
+ {
+ Model model = ( data.getModel() != null ) ? data.getModel().clone() : null;
+ return new ModelData( data.getSource(), model, data.getGroupId(), data.getArtifactId(), data.getVersion() );
+ }
+
+ @Override
+ public ModelData fromCache( ModelData data )
+ {
+ return intoCache( data );
+ }
+
+ };
+
+ /**
+ * The tag used to denote an effective dependency management section from an imported model.
+ */
+ ModelCacheTag<DependencyManagement> IMPORT = new ModelCacheTag<DependencyManagement>()
+ {
+
+ @Override
+ public String getName()
+ {
+ return "import";
+ }
+
+ @Override
+ public Class<DependencyManagement> getType()
+ {
+ return DependencyManagement.class;
+ }
+
+ @Override
+ public DependencyManagement intoCache( DependencyManagement data )
+ {
+ return ( data != null ) ? data.clone() : null;
+ }
+
+ @Override
+ public DependencyManagement fromCache( DependencyManagement data )
+ {
+ return intoCache( data );
+ }
+
+ };
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelData.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelData.java
new file mode 100644
index 00000000..4fefe0df
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelData.java
@@ -0,0 +1,222 @@
+package org.apache.maven.model.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.model.Model;
+import org.apache.maven.model.Profile;
+
+/**
+ * Holds a model along with some auxiliary information. This internal utility class assists the model builder during POM
+ * processing by providing a means to transport information that cannot be (easily) extracted from the model itself.
+ *
+ * @author Benjamin Bentmann
+ */
+class ModelData
+{
+ private final ModelSource source;
+
+ private Model model;
+
+ private Model rawModel;
+
+ private List<Profile> activeProfiles;
+
+ private String groupId;
+
+ private String artifactId;
+
+ private String version;
+
+ /**
+ * Creates a new container for the specified model.
+ *
+ * @param model The model to wrap, may be {@code null}.
+ */
+ public ModelData( ModelSource source, Model model )
+ {
+ this.source = source;
+ this.model = model;
+ }
+
+ /**
+ * Creates a new container for the specified model.
+ *
+ * @param model The model to wrap, may be {@code null}.
+ * @param groupId The effective group identifier of the model, may be {@code null}.
+ * @param artifactId The effective artifact identifier of the model, may be {@code null}.
+ * @param version The effective version of the model, may be {@code null}.
+ */
+ public ModelData( ModelSource source, Model model, String groupId, String artifactId, String version )
+ {
+ this.source = source;
+ this.model = model;
+ setGroupId( groupId );
+ setArtifactId( artifactId );
+ setVersion( version );
+ }
+
+ public ModelSource getSource()
+ {
+ return source;
+ }
+
+ /**
+ * Gets the model being wrapped.
+ *
+ * @return The model or {@code null} if not set.
+ */
+ public Model getModel()
+ {
+ return model;
+ }
+
+ /**
+ * Sets the model being wrapped.
+ *
+ * @param model The model, may be {@code null}.
+ */
+ public void setModel( Model model )
+ {
+ this.model = model;
+ }
+
+ /**
+ * Gets the raw model being wrapped.
+ *
+ * @return The raw model or {@code null} if not set.
+ */
+ public Model getRawModel()
+ {
+ return rawModel;
+ }
+
+ /**
+ * Sets the raw model being wrapped.
+ *
+ * @param rawModel The raw model, may be {@code null}.
+ */
+ public void setRawModel( Model rawModel )
+ {
+ this.rawModel = rawModel;
+ }
+
+ /**
+ * Gets the active profiles from the model.
+ *
+ * @return The active profiles or {@code null} if not set.
+ */
+ public List<Profile> getActiveProfiles()
+ {
+ return activeProfiles;
+ }
+
+ /**
+ * Sets the active profiles from the model.
+ *
+ * @param activeProfiles The active profiles, may be {@code null}.
+ */
+ public void setActiveProfiles( List<Profile> activeProfiles )
+ {
+ this.activeProfiles = activeProfiles;
+ }
+
+ /**
+ * Gets the effective group identifier of the model.
+ *
+ * @return The effective group identifier of the model or an empty string if unknown, never {@code null}.
+ */
+ public String getGroupId()
+ {
+ return ( groupId != null ) ? groupId : "";
+ }
+
+ /**
+ * Sets the effective group identifier of the model.
+ *
+ * @param groupId The effective group identifier of the model, may be {@code null}.
+ */
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ /**
+ * Gets the effective artifact identifier of the model.
+ *
+ * @return The effective artifact identifier of the model or an empty string if unknown, never {@code null}.
+ */
+ public String getArtifactId()
+ {
+ return ( artifactId != null ) ? artifactId : "";
+ }
+
+ /**
+ * Sets the effective artifact identifier of the model.
+ *
+ * @param artifactId The effective artifact identifier of the model, may be {@code null}.
+ */
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ /**
+ * Gets the effective version of the model.
+ *
+ * @return The effective version of the model or an empty string if unknown, never {@code null}.
+ */
+ public String getVersion()
+ {
+ return ( version != null ) ? version : "";
+ }
+
+ /**
+ * Sets the effective version of the model.
+ *
+ * @param version The effective version of the model, may be {@code null}.
+ */
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ /**
+ * Gets the effective identifier of the model in the form {@code <groupId>:<artifactId>:<version>}.
+ *
+ * @return The effective identifier of the model, never {@code null}.
+ */
+ public String getId()
+ {
+ StringBuilder buffer = new StringBuilder( 96 );
+
+ buffer.append( getGroupId() ).append( ':' ).append( getArtifactId() ).append( ':' ).append( getVersion() );
+
+ return buffer.toString();
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.valueOf( model );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java
new file mode 100644
index 00000000..43272bac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblem.java
@@ -0,0 +1,117 @@
+package org.apache.maven.model.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 model 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 POM file that exhibits
+ * the problem.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelProblem
+{
+
+ /**
+ * The different severity levels for a problem, in decreasing order.
+ */
+ enum Severity
+ {
+
+ FATAL, //
+ ERROR, //
+ WARNING //
+
+ }
+
+ enum Version
+ {
+ //based on ModeBuildingResult.validationLevel
+ BASE,
+ V20,
+ V30,
+ V31
+ }
+
+ /**
+ * 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 a POM was 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 identifier of the model from which the problem originated. While the general form of this identifier is
+ * <code>groupId:artifactId:version</code> the returned identifier need not be complete. The identifier is derived
+ * from the information that is available at the point the problem occurs and as such merely serves as a best effort
+ * to provide information to the user to track the problem back to its origin.
+ *
+ * @return The identifier of the model from which the problem originated or an empty string if unknown, never
+ * {@code null}.
+ */
+ String getModelId();
+
+ /**
+ * 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();
+
+ /**
+ * Gets the applicable maven version/validation level of this problem
+ * @return The version, never {@code null}.
+ */
+ Version getVersion();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java
new file mode 100644
index 00000000..e9561e54
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollector.java
@@ -0,0 +1,41 @@
+package org.apache.maven.model.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 model building. The primary purpose of this component is to account for
+ * the fact that the problem reporter has/should not have information about the calling context and hence cannot provide
+ * an expressive source hint for the model problem. Instead, the source hint is configured by the model builder before
+ * it delegates to other components that potentially encounter problems. Then, the problem reporter can focus on
+ * providing a simple error message, leaving the donkey work of creating a nice model problem to this component.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelProblemCollector
+{
+
+ /**
+ * Adds the specified problem.
+ *
+ * @param req must not be null
+ */
+ void add( ModelProblemCollectorRequest req );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorExt.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorExt.java
new file mode 100644
index 00000000..7977d3a6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorExt.java
@@ -0,0 +1,37 @@
+package org.apache.maven.model.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;
+
+/**
+ * Extends the ModelproblemCollector by the capacity of returning the collected problems.
+ * @author Milos Kleint
+ */
+public interface ModelProblemCollectorExt extends ModelProblemCollector
+{
+
+ /**
+ * The collected problems.
+ * @return a list of model problems encountered, never {@code null}
+ */
+ List<ModelProblem> getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java
new file mode 100644
index 00000000..d213cc48
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemCollectorRequest.java
@@ -0,0 +1,101 @@
+package org.apache.maven.model.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.model.InputLocation;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+
+/**
+ * Class to wrap request parameters to ModelProblemCollector.addProblem
+ *
+ * @author mkleint
+ */
+public final class ModelProblemCollectorRequest
+{
+
+ private final ModelProblem.Severity severity;
+ private final ModelProblem.Version version;
+ private Exception exception;
+ private String message;
+ private InputLocation location;
+
+ /**
+ * Create a new request with mandatory parameters.
+ * @param severity
+ * @param version
+ */
+ public ModelProblemCollectorRequest( Severity severity, Version version )
+ {
+ this.severity = severity;
+ this.version = version;
+ if ( severity == null )
+ {
+ throw new IllegalStateException( "No severity declared" );
+ }
+ if ( version == null )
+ {
+ throw new IllegalStateException( "No version declared." );
+ }
+ }
+
+ public Severity getSeverity()
+ {
+ return severity;
+ }
+
+ public Version getVersion()
+ {
+ return version;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ public ModelProblemCollectorRequest setException( Exception exception )
+ {
+ this.exception = exception;
+ return this;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public ModelProblemCollectorRequest setMessage( String message )
+ {
+ this.message = message;
+ return this;
+ }
+
+ public InputLocation getLocation()
+ {
+ return location;
+ }
+
+ public ModelProblemCollectorRequest setLocation( InputLocation location )
+ {
+ this.location = location;
+ return this;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
new file mode 100644
index 00000000..806c28d4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
@@ -0,0 +1,171 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Assists in the handling of model problems.
+ *
+ * @author Benjamin Bentmann
+ */
+public class ModelProblemUtils
+{
+
+ /**
+ * Creates a user-friendly source hint for the specified model.
+ *
+ * @param model The model to create a source hint for, may be {@code null}.
+ * @return The user-friendly source hint, never {@code null}.
+ */
+ static String toSourceHint( Model model )
+ {
+ if ( model == null )
+ {
+ return "";
+ }
+
+ StringBuilder buffer = new StringBuilder( 192 );
+
+ buffer.append( toId( model ) );
+
+ File pomFile = model.getPomFile();
+ if ( pomFile != null )
+ {
+ buffer.append( " (" ).append( pomFile ).append( ")" );
+ }
+
+ return buffer.toString();
+ }
+
+ static String toPath( Model model )
+ {
+ String path = "";
+
+ if ( model != null )
+ {
+ File pomFile = model.getPomFile();
+
+ if ( pomFile != null )
+ {
+ path = pomFile.getAbsolutePath();
+ }
+ }
+
+ return path;
+ }
+
+ static String toId( Model model )
+ {
+ if ( model == null )
+ {
+ return "";
+ }
+
+ String groupId = model.getGroupId();
+ if ( groupId == null && model.getParent() != null )
+ {
+ groupId = model.getParent().getGroupId();
+ }
+
+ String artifactId = model.getArtifactId();
+
+ String version = model.getVersion();
+ if ( version == null )
+ {
+ version = "[unknown-version]";
+ }
+
+ return toId( groupId, artifactId, version );
+ }
+
+ /**
+ * Creates a user-friendly artifact id from the specified coordinates.
+ *
+ * @param groupId The group id, may be {@code null}.
+ * @param artifactId The artifact id, may be {@code null}.
+ * @param version The version, may be {@code null}.
+ * @return The user-friendly artifact id, never {@code null}.
+ */
+ static String toId( String groupId, String artifactId, String version )
+ {
+ StringBuilder buffer = new StringBuilder( 96 );
+
+ buffer.append( ( groupId != null && groupId.length() > 0 ) ? groupId : "[unknown-group-id]" );
+ buffer.append( ':' );
+ buffer.append( ( artifactId != null && artifactId.length() > 0 ) ? artifactId : "[unknown-artifact-id]" );
+ buffer.append( ':' );
+ buffer.append( ( version != null && version.length() > 0 ) ? version : "[unknown-version]" );
+
+ return buffer.toString();
+ }
+
+ /**
+ * Creates a string with all location details for the specified model problem. If the project identifier is
+ * provided, the generated location will omit the model id and source information and only give line/column
+ * information for problems originating directly from this POM.
+ *
+ * @param problem The problem whose location should be formatted, must not be {@code null}.
+ * @param projectId The {@code <groupId>:<artifactId>:<version>} of the corresponding project, may be {@code null}
+ * to force output of model id and source.
+ * @return The formatted problem location or an empty string if unknown, never {@code null}.
+ */
+ public static String formatLocation( ModelProblem problem, String projectId )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+
+ if ( !problem.getModelId().equals( projectId ) )
+ {
+ buffer.append( problem.getModelId() );
+
+ if ( problem.getSource().length() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( problem.getSource() );
+ }
+ }
+
+ if ( problem.getLineNumber() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( "line " ).append( problem.getLineNumber() );
+ }
+
+ if ( problem.getColumnNumber() > 0 )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( "column " ).append( problem.getColumnNumber() );
+ }
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProcessor.java
new file mode 100644
index 00000000..ca34845c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProcessor.java
@@ -0,0 +1,32 @@
+package org.apache.maven.model.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.model.io.ModelReader;
+import org.apache.maven.model.locator.ModelLocator;
+
+@SuppressWarnings( "checkstyle:interfaceistype" )
+public interface ModelProcessor
+ extends ModelLocator, ModelReader
+{
+
+ String SOURCE = "org.apache.maven.model.building.source";
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
new file mode 100644
index 00000000..5db8edba
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource.java
@@ -0,0 +1,38 @@
+package org.apache.maven.model.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 a POM independently of the backing store (e.g. file system, database, memory).
+ * <p>
+ * This interface does not support loading of parent POM(s) from the same backing store, integrators are strongly
+ * encouraged to implement {@link ModelSource2} instead of implementing this interface directly.
+ *
+ * @author Benjamin Bentmann
+ * @see ModelSource2
+ * @deprecated instead use {@link Source}
+ */
+@Deprecated
+public interface ModelSource extends Source
+{
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource2.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource2.java
new file mode 100644
index 00000000..3e123d08
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/ModelSource2.java
@@ -0,0 +1,56 @@
+package org.apache.maven.model.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.URI;
+
+/**
+ * Provides access to the contents of a POM independently of the backing store (e.g. file system, database, memory).
+ * <p>
+ * Unlike {@link ModelSource}, this interface supports loading of parent POM(s) from the same backing store and allows
+ * construction of MavenProject instances without the need to have parent POM(s) available from local or remote
+ * repositories.
+ * <p>
+ * ModelSource2 instances are cached in {@link ModelBuildingRequest#getModelCache()}. Implementations must guarantee
+ * that the connection to the backing store remains active until request's {@link ModelCache} is discarded or flushed.
+ */
+public interface ModelSource2
+ extends ModelSource
+{
+ /**
+ * Returns model source identified by a path relative to this model source POM. Implementation <strong>MUST</strong>
+ * be able to accept <code>relPath</code> parameter values that
+ * <ul>
+ * <li>use either / or \ file path separator</li>
+ * <li>have .. parent directory references</li>
+ * <li>point either at file or directory, in the latter case POM file name 'pom.xml' needs to be used by the
+ * requested model source.</li>
+ * </ul>
+ *
+ * @param relPath is the path of the requested model source relative to this model source POM.
+ * @return related model source or <code>null</code> if no such model source.
+ */
+ ModelSource2 getRelatedSource( String relPath );
+
+ /**
+ * Returns location of the POM, never <code>null</code>.
+ */
+ URI getLocationURI();
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/Result.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/Result.java
new file mode 100644
index 00000000..a9628977
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/Result.java
@@ -0,0 +1,255 @@
+package org.apache.maven.model.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 static com.google.common.base.Predicates.in;
+import static com.google.common.collect.Iterables.any;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.transform;
+import static java.util.Collections.singleton;
+import static java.util.EnumSet.of;
+import static org.apache.maven.model.building.ModelProblem.Severity.ERROR;
+import static org.apache.maven.model.building.ModelProblem.Severity.FATAL;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.apache.maven.model.building.ModelProblem.Severity;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
+/**
+ * There are various forms of results that are represented by this class:
+ * <ol>
+ * <li>success - in which case only the model field is set
+ * <li>success with warnings - model field + non-error model problems
+ * <li>error - no model, but diagnostics
+ * <li>error - (partial) model and diagnostics
+ * </ol>
+ * Could encode these variants as subclasses, but kept in one for now
+ *
+ * @author bbusjaeger
+ * @param <T>
+ */
+public class Result<T>
+{
+
+ /**
+ * Success without warnings
+ *
+ * @param model
+ * @return
+ */
+ public static <T> Result<T> success( T model )
+ {
+ return success( model, Collections.<ModelProblem>emptyList() );
+ }
+
+ /**
+ * Success with warnings
+ *
+ * @param model
+ * @param problems
+ * @return
+ */
+ public static <T> Result<T> success( T model, Iterable<? extends ModelProblem> problems )
+ {
+ assert !hasErrors( problems );
+ return new Result<T>( false, model, problems );
+ }
+
+ /**
+ * Success with warnings
+ *
+ * @param model
+ * @param results
+ * @return
+ */
+ public static <T> Result<T> success( T model, Result<?>... results )
+ {
+ return success( model, Iterables.concat( Iterables.transform( Arrays.asList( results ), GET_PROBLEMS ) ) );
+ }
+
+ /**
+ * Error with problems describing the cause
+ *
+ * @param problems
+ * @return
+ */
+ public static <T> Result<T> error( Iterable<? extends ModelProblem> problems )
+ {
+ return error( null, problems );
+ }
+
+ public static <T> Result<T> error( T model )
+ {
+ return error( model, Collections.<ModelProblem>emptyList() );
+ }
+
+ public static <T> Result<T> error( Result<?> result )
+ {
+ return error( result.getProblems() );
+ }
+
+ public static <T> Result<T> error( Result<?>... results )
+ {
+ return error( Iterables.concat( Iterables.transform( Arrays.asList( results ), GET_PROBLEMS ) ) );
+ }
+
+ /**
+ * Error with partial result and problems describing the cause
+ *
+ * @param model
+ * @param problems
+ * @return
+ */
+ public static <T> Result<T> error( T model, Iterable<? extends ModelProblem> problems )
+ {
+ return new Result<T>( true, model, problems );
+ }
+
+ /**
+ * New result - determine whether error or success by checking problems for errors
+ *
+ * @param model
+ * @param problems
+ * @return
+ */
+ public static <T> Result<T> newResult( T model, Iterable<? extends ModelProblem> problems )
+ {
+ return new Result<T>( hasErrors( problems ), model, problems );
+ }
+
+ /**
+ * New result consisting of given result and new problem. Convenience for newResult(result.get(),
+ * concat(result.getProblems(),problems)).
+ *
+ * @param result
+ * @param problem
+ * @return
+ */
+ public static <T> Result<T> addProblem( Result<T> result, ModelProblem problem )
+ {
+ return addProblems( result, singleton( problem ) );
+ }
+
+ /**
+ * New result that includes the given
+ *
+ * @param result
+ * @param problems
+ * @return
+ */
+ public static <T> Result<T> addProblems( Result<T> result, Iterable<? extends ModelProblem> problems )
+ {
+ return new Result<T>( result.hasErrors() || hasErrors( problems ), result.get(), concat( result.getProblems(),
+ problems ) );
+ }
+
+ public static <T> Result<T> addProblems( Result<T> result, Result<?>... results )
+ {
+ return addProblems( result, Iterables.concat( Iterables.transform( Arrays.asList( results ), GET_PROBLEMS ) ) );
+ }
+
+ /**
+ * Turns the given results into a single result by combining problems and models into single collection.
+ *
+ * @param results
+ * @return
+ */
+ public static <T> Result<Iterable<T>> newResultSet( Iterable<? extends Result<? extends T>> results )
+ {
+ final boolean hasErrors = any( transform( results, new Function<Result<?>, Boolean>()
+ {
+ @Override
+ public Boolean apply( Result<?> input )
+ {
+ return input.hasErrors();
+ }
+ } ), Predicates.equalTo( true ) );
+ final Iterable<T> models = transform( results, new Function<Result<? extends T>, T>()
+ {
+ @Override
+ public T apply( Result<? extends T> input )
+ {
+ return input.get();
+ }
+ } );
+ final Iterable<ModelProblem> problems = concat( transform( results, GET_PROBLEMS ) );
+ return new Result<Iterable<T>>( hasErrors, models, problems );
+ }
+
+ // helper to determine if problems contain error
+ private static boolean hasErrors( Iterable<? extends ModelProblem> problems )
+ {
+ return any( transform( problems, new Function<ModelProblem, Severity>()
+ {
+ @Override
+ public Severity apply( ModelProblem input )
+ {
+ return input.getSeverity();
+ }
+ } ), in( of( ERROR, FATAL ) ) );
+ }
+
+ /**
+ * Class definition
+ */
+
+ private final boolean errors;
+
+ private final T value;
+
+ private final Iterable<? extends ModelProblem> problems;
+
+ private Result( boolean errors, T model, Iterable<? extends ModelProblem> problems )
+ {
+ this.errors = errors;
+ this.value = model;
+ this.problems = problems;
+ }
+
+ public Iterable<? extends ModelProblem> getProblems()
+ {
+ return problems;
+ }
+
+ public T get()
+ {
+ return value;
+ }
+
+ public boolean hasErrors()
+ {
+ return errors;
+ }
+
+ private static final Function<Result<?>, Iterable<? extends ModelProblem>> GET_PROBLEMS =
+ new Function<Result<?>, Iterable<? extends ModelProblem>>()
+ {
+ @Override
+ public Iterable<? extends ModelProblem> apply( Result<?> input )
+ {
+ return input.getProblems();
+ }
+ };
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
new file mode 100644
index 00000000..cf9c4ce1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/StringModelSource.java
@@ -0,0 +1,56 @@
+package org.apache.maven.model.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 model source.
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link StringSource}
+ */
+@Deprecated
+public class StringModelSource extends StringSource
+ implements ModelSource
+{
+
+ /**
+ * Creates a new model source backed by the specified string.
+ *
+ * @param pom The POM's string representation, may be empty or {@code null}.
+ */
+ public StringModelSource( CharSequence pom )
+ {
+ this( pom, null );
+ }
+
+ /**
+ * Creates a new model source backed by the specified string.
+ *
+ * @param pom The POM's string representation, may be empty or {@code null}.
+ * @param location The location to report for this use, may be {@code null}.
+ */
+ public StringModelSource( CharSequence pom, String location )
+ {
+ super( pom, location );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
new file mode 100644
index 00000000..e41d74b3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/building/UrlModelSource.java
@@ -0,0 +1,46 @@
+package org.apache.maven.model.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 model source.
+ *
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link UrlSource}
+ */
+@Deprecated
+public class UrlModelSource extends UrlSource
+ implements ModelSource
+{
+ /**
+ * Creates a new model source backed by the specified URL.
+ *
+ * @param pomUrl The POM file, must not be {@code null}.
+ */
+ public UrlModelSource( URL pomUrl )
+ {
+ super( pomUrl );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java
new file mode 100644
index 00000000..5860af65
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java
@@ -0,0 +1,83 @@
+package org.apache.maven.model.composition;
+
+/*
+ * 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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Handles the import of dependency management from other models into the target model.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = DependencyManagementImporter.class )
+public class DefaultDependencyManagementImporter
+ implements DependencyManagementImporter
+{
+
+ @Override
+ public void importManagement( Model target, List<? extends DependencyManagement> sources,
+ ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ if ( sources != null && !sources.isEmpty() )
+ {
+ Map<String, Dependency> dependencies = new LinkedHashMap<String, Dependency>();
+
+ DependencyManagement depMngt = target.getDependencyManagement();
+
+ if ( depMngt != null )
+ {
+ for ( Dependency dependency : depMngt.getDependencies() )
+ {
+ dependencies.put( dependency.getManagementKey(), dependency );
+ }
+ }
+ else
+ {
+ depMngt = new DependencyManagement();
+ target.setDependencyManagement( depMngt );
+ }
+
+ for ( DependencyManagement source : sources )
+ {
+ for ( Dependency dependency : source.getDependencies() )
+ {
+ String key = dependency.getManagementKey();
+ if ( !dependencies.containsKey( key ) )
+ {
+ dependencies.put( key, dependency );
+ }
+ }
+ }
+
+ depMngt.setDependencies( new ArrayList<Dependency>( dependencies.values() ) );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java
new file mode 100644
index 00000000..06496429
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java
@@ -0,0 +1,48 @@
+package org.apache.maven.model.composition;
+
+/*
+ * 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.model.DependencyManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles the import of dependency management from other models into the target model.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface DependencyManagementImporter
+{
+
+ /**
+ * Imports the specified dependency management sections into the given target model.
+ *
+ * @param target The model into which to import the dependency management section, must not be <code>null</code>.
+ * @param sources The dependency management sections to import, may be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void importManagement( Model target, List<? extends DependencyManagement> sources, ModelBuildingRequest request,
+ ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
new file mode 100644
index 00000000..609f441e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
@@ -0,0 +1,255 @@
+package org.apache.maven.model.inheritance;
+
+/*
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Handles inheritance of model values.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = InheritanceAssembler.class )
+public class DefaultInheritanceAssembler
+ implements InheritanceAssembler
+{
+
+ private InheritanceModelMerger merger = new InheritanceModelMerger();
+
+ @Override
+ public void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request,
+ ModelProblemCollector problems )
+ {
+ Map<Object, Object> hints = new HashMap<Object, Object>();
+ hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent ) );
+ merger.merge( child, parent, false, hints );
+ }
+
+ /**
+ * Calculates the relative path from the base directory of the parent to the parent directory of the base directory
+ * of the child. The general idea is to adjust inherited URLs to match the project layout (in SCM).
+ *
+ * <p>This calculation is only a heuristic based on our conventions.
+ * In detail, the algo relies on the following assumptions: <ul>
+ * <li>The parent uses aggregation and refers to the child via the modules section</li>
+ * <li>The module path to the child is considered to
+ * point at the POM rather than its base directory if the path ends with ".xml" (ignoring case)</li>
+ * <li>The name of the child's base directory matches the artifact id of the child.</li>
+ * </ul>
+ * Note that for the sake of independence from the user
+ * environment, the filesystem is intentionally not used for the calculation.</p>
+ *
+ * @param child The child model, must not be <code>null</code>.
+ * @param parent The parent model, may be <code>null</code>.
+ * @return The path adjustment, can be empty but never <code>null</code>.
+ */
+ private String getChildPathAdjustment( Model child, Model parent )
+ {
+ String adjustment = "";
+
+ if ( parent != null )
+ {
+ String childName = child.getArtifactId();
+
+ /*
+ * This logic exists only for the sake of backward-compat with 2.x (MNG-5000). In generally, it is wrong to
+ * base URL inheritance on the project directory names as this information is unavailable for POMs in the
+ * repository. In other words, projects where artifactId != projectDirName will see different effective URLs
+ * depending on how the POM was constructed.
+ */
+ File childDirectory = child.getProjectDirectory();
+ if ( childDirectory != null )
+ {
+ childName = childDirectory.getName();
+ }
+
+ for ( String module : parent.getModules() )
+ {
+ module = module.replace( '\\', '/' );
+
+ if ( module.regionMatches( true, module.length() - 4, ".xml", 0, 4 ) )
+ {
+ module = module.substring( 0, module.lastIndexOf( '/' ) + 1 );
+ }
+
+ String moduleName = module;
+ if ( moduleName.endsWith( "/" ) )
+ {
+ moduleName = moduleName.substring( 0, moduleName.length() - 1 );
+ }
+
+ int lastSlash = moduleName.lastIndexOf( '/' );
+
+ moduleName = moduleName.substring( lastSlash + 1 );
+
+ if ( moduleName.equals( childName ) && lastSlash >= 0 )
+ {
+ adjustment = module.substring( 0, lastSlash );
+ break;
+ }
+ }
+ }
+
+ return adjustment;
+ }
+
+ protected static class InheritanceModelMerger
+ extends MavenModelMerger
+ {
+
+ @Override
+ protected void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source,
+ boolean sourceDominant, Map<Object, Object> context )
+ {
+ List<Plugin> src = source.getPlugins();
+ if ( !src.isEmpty() )
+ {
+ List<Plugin> tgt = target.getPlugins();
+ Map<Object, Plugin> master = new LinkedHashMap<Object, Plugin>( src.size() * 2 );
+
+ for ( Plugin element : src )
+ {
+ if ( element.isInherited() || !element.getExecutions().isEmpty() )
+ {
+ // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions
+ Plugin plugin = new Plugin();
+ plugin.setLocation( "", element.getLocation( "" ) );
+ plugin.setGroupId( null );
+ mergePlugin( plugin, element, sourceDominant, context );
+
+ Object key = getPluginKey( element );
+
+ master.put( key, plugin );
+ }
+ }
+
+ Map<Object, List<Plugin>> predecessors = new LinkedHashMap<Object, List<Plugin>>();
+ List<Plugin> pending = new ArrayList<Plugin>();
+ for ( Plugin element : tgt )
+ {
+ Object key = getPluginKey( element );
+ Plugin existing = master.get( key );
+ if ( existing != null )
+ {
+ mergePlugin( element, existing, sourceDominant, context );
+
+ master.put( key, element );
+
+ if ( !pending.isEmpty() )
+ {
+ predecessors.put( key, pending );
+ pending = new ArrayList<Plugin>();
+ }
+ }
+ else
+ {
+ pending.add( element );
+ }
+ }
+
+ List<Plugin> result = new ArrayList<Plugin>( src.size() + tgt.size() );
+ for ( Map.Entry<Object, Plugin> entry : master.entrySet() )
+ {
+ List<Plugin> pre = predecessors.get( entry.getKey() );
+ if ( pre != null )
+ {
+ result.addAll( pre );
+ }
+ result.add( entry.getValue() );
+ }
+ result.addAll( pending );
+
+ target.setPlugins( result );
+ }
+ }
+
+ @Override
+ protected void mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ if ( source.isInherited() )
+ {
+ mergeConfigurationContainer( target, source, sourceDominant, context );
+ }
+ mergePlugin_GroupId( target, source, sourceDominant, context );
+ mergePlugin_ArtifactId( target, source, sourceDominant, context );
+ mergePlugin_Version( target, source, sourceDominant, context );
+ mergePlugin_Extensions( target, source, sourceDominant, context );
+ mergePlugin_Dependencies( target, source, sourceDominant, context );
+ mergePlugin_Executions( target, source, sourceDominant, context );
+ }
+
+ @Override
+ protected void mergeReporting_Plugins( Reporting target, Reporting source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<ReportPlugin> src = source.getPlugins();
+ if ( !src.isEmpty() )
+ {
+ List<ReportPlugin> tgt = target.getPlugins();
+ Map<Object, ReportPlugin> merged =
+ new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( ReportPlugin element : src )
+ {
+ Object key = getReportPluginKey( element );
+ if ( element.isInherited() )
+ {
+ // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions as well
+ ReportPlugin plugin = new ReportPlugin();
+ plugin.setLocation( "", element.getLocation( "" ) );
+ plugin.setGroupId( null );
+ mergeReportPlugin( plugin, element, sourceDominant, context );
+
+ merged.put( key, plugin );
+ }
+ }
+
+ for ( ReportPlugin element : tgt )
+ {
+ Object key = getReportPluginKey( element );
+ ReportPlugin existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergeReportPlugin( element, existing, sourceDominant, context );
+ }
+ merged.put( key, element );
+ }
+
+ target.setPlugins( new ArrayList<ReportPlugin>( merged.values() ) );
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java
new file mode 100644
index 00000000..a191e52d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java
@@ -0,0 +1,48 @@
+package org.apache.maven.model.inheritance;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles inheritance of model values.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface InheritanceAssembler
+{
+
+ /**
+ * Merges values from the specified parent model into the given child model. Implementations are expected to keep
+ * parent and child completely decoupled by injecting deep copies of objects into the child rather than the original
+ * objects from the parent.
+ *
+ * @param child The child model into which to merge the values inherited from the parent, must not be
+ * <code>null</code>.
+ * @param parent The (read-only) parent model from which to inherit the values, may be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request,
+ ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
new file mode 100644
index 00000000..1390a4ed
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
@@ -0,0 +1,271 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.path.PathTranslator;
+import org.apache.maven.model.path.UrlNormalizer;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.AbstractValueSource;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.ObjectBasedValueSource;
+import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor;
+import org.codehaus.plexus.interpolation.PrefixedObjectValueSource;
+import org.codehaus.plexus.interpolation.PrefixedValueSourceWrapper;
+import org.codehaus.plexus.interpolation.RecursionInterceptor;
+import org.codehaus.plexus.interpolation.ValueSource;
+
+/**
+ * Use a regular expression search to find and resolve expressions within the POM.
+ *
+ * @author jdcasey Created on Feb 3, 2005
+ */
+public abstract class AbstractStringBasedModelInterpolator
+ implements ModelInterpolator
+{
+ private static final List<String> PROJECT_PREFIXES = Arrays.asList( "pom.", "project." );
+
+ private static final Collection<String> TRANSLATED_PATH_EXPRESSIONS;
+
+ static
+ {
+ Collection<String> translatedPrefixes = new HashSet<String>();
+
+ // MNG-1927, MNG-2124, MNG-3355:
+ // If the build section is present and the project directory is non-null, we should make
+ // sure interpolation of the directories below uses translated paths.
+ // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
+ // code below...
+ translatedPrefixes.add( "build.directory" );
+ translatedPrefixes.add( "build.outputDirectory" );
+ translatedPrefixes.add( "build.testOutputDirectory" );
+ translatedPrefixes.add( "build.sourceDirectory" );
+ translatedPrefixes.add( "build.testSourceDirectory" );
+ translatedPrefixes.add( "build.scriptSourceDirectory" );
+ translatedPrefixes.add( "reporting.outputDirectory" );
+
+ TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
+ }
+
+ @Requirement
+ private PathTranslator pathTranslator;
+
+ @Requirement
+ private UrlNormalizer urlNormalizer;
+
+ private Interpolator interpolator;
+
+ private RecursionInterceptor recursionInterceptor;
+
+ public AbstractStringBasedModelInterpolator()
+ {
+ interpolator = createInterpolator();
+ recursionInterceptor = new PrefixAwareRecursionInterceptor( PROJECT_PREFIXES );
+ }
+
+ public AbstractStringBasedModelInterpolator setPathTranslator( PathTranslator pathTranslator )
+ {
+ this.pathTranslator = pathTranslator;
+ return this;
+ }
+
+ public AbstractStringBasedModelInterpolator setUrlNormalizer( UrlNormalizer urlNormalizer )
+ {
+ this.urlNormalizer = urlNormalizer;
+ return this;
+ }
+
+ protected List<ValueSource> createValueSources( final Model model, final File projectDir,
+ final ModelBuildingRequest config,
+ final ModelProblemCollector problems )
+ {
+ Properties modelProperties = model.getProperties();
+
+ ValueSource modelValueSource1 = new PrefixedObjectValueSource( PROJECT_PREFIXES, model, false );
+ if ( config.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ modelValueSource1 = new ProblemDetectingValueSource( modelValueSource1, "pom.", "project.", problems );
+ }
+
+ ValueSource modelValueSource2 = new ObjectBasedValueSource( model );
+ if ( config.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ modelValueSource2 = new ProblemDetectingValueSource( modelValueSource2, "", "project.", problems );
+ }
+
+ // NOTE: Order counts here!
+ List<ValueSource> valueSources = new ArrayList<ValueSource>( 9 );
+
+ if ( projectDir != null )
+ {
+ ValueSource basedirValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
+ {
+ @Override
+ public Object getValue( String expression )
+ {
+ if ( "basedir".equals( expression ) )
+ {
+ return projectDir.getAbsolutePath();
+ }
+ return null;
+ }
+ }, PROJECT_PREFIXES, true );
+ valueSources.add( basedirValueSource );
+
+ ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( new AbstractValueSource( false )
+ {
+ @Override
+ public Object getValue( String expression )
+ {
+ if ( "baseUri".equals( expression ) )
+ {
+ return projectDir.getAbsoluteFile().toURI().toString();
+ }
+ return null;
+ }
+ }, PROJECT_PREFIXES, false );
+ valueSources.add( baseUriValueSource );
+ valueSources.add( new BuildTimestampValueSource( config.getBuildStartTime(), modelProperties ) );
+ }
+
+ valueSources.add( modelValueSource1 );
+
+ valueSources.add( new MapBasedValueSource( config.getUserProperties() ) );
+
+ valueSources.add( new MapBasedValueSource( modelProperties ) );
+
+ valueSources.add( new MapBasedValueSource( config.getSystemProperties() ) );
+
+ valueSources.add( new AbstractValueSource( false )
+ {
+ @Override
+ public Object getValue( String expression )
+ {
+ return config.getSystemProperties().getProperty( "env." + expression );
+ }
+ } );
+
+ valueSources.add( modelValueSource2 );
+
+ return valueSources;
+ }
+
+ protected List<? extends InterpolationPostProcessor> createPostProcessors( final Model model,
+ final File projectDir,
+ final ModelBuildingRequest config )
+ {
+ List<InterpolationPostProcessor> processors = new ArrayList<InterpolationPostProcessor>( 2 );
+ if ( projectDir != null )
+ {
+ processors.add( new PathTranslatingPostProcessor( PROJECT_PREFIXES, TRANSLATED_PATH_EXPRESSIONS,
+ projectDir, pathTranslator ) );
+ }
+ processors.add( new UrlNormalizingPostProcessor( urlNormalizer ) );
+ return processors;
+ }
+
+ protected String interpolateInternal( String src, List<? extends ValueSource> valueSources,
+ List<? extends InterpolationPostProcessor> postProcessors,
+ ModelProblemCollector problems )
+ {
+ if ( !src.contains( "${" ) )
+ {
+ return src;
+ }
+
+ String result = src;
+ synchronized ( this )
+ {
+
+ for ( ValueSource vs : valueSources )
+ {
+ interpolator.addValueSource( vs );
+ }
+
+ for ( InterpolationPostProcessor postProcessor : postProcessors )
+ {
+ interpolator.addPostProcessor( postProcessor );
+ }
+
+ try
+ {
+ try
+ {
+ result = interpolator.interpolate( result, recursionInterceptor );
+ }
+ catch ( InterpolationException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( e.getMessage() ).setException( e ) );
+ }
+
+ interpolator.clearFeedback();
+ }
+ finally
+ {
+ for ( ValueSource vs : valueSources )
+ {
+ interpolator.removeValuesSource( vs );
+ }
+
+ for ( InterpolationPostProcessor postProcessor : postProcessors )
+ {
+ interpolator.removePostProcessor( postProcessor );
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected RecursionInterceptor getRecursionInterceptor()
+ {
+ return recursionInterceptor;
+ }
+
+ protected void setRecursionInterceptor( RecursionInterceptor recursionInterceptor )
+ {
+ this.recursionInterceptor = recursionInterceptor;
+ }
+
+ protected abstract Interpolator createInterpolator();
+
+ protected final Interpolator getInterpolator()
+ {
+ return interpolator;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java
new file mode 100644
index 00000000..30809b85
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/BuildTimestampValueSource.java
@@ -0,0 +1,47 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.Date;
+import java.util.Properties;
+
+import org.codehaus.plexus.interpolation.AbstractValueSource;
+
+class BuildTimestampValueSource
+ extends AbstractValueSource
+{
+ private final MavenBuildTimestamp mavenBuildTimestamp;
+
+ public BuildTimestampValueSource( Date startTime, Properties properties )
+ {
+ super( false );
+ this.mavenBuildTimestamp = new MavenBuildTimestamp( startTime, properties );
+ }
+
+ @Override
+ public Object getValue( String expression )
+ {
+ if ( "build.timestamp".equals( expression ) || "maven.build.timestamp".equals( expression ) )
+ {
+ return mavenBuildTimestamp.formattedTimestamp();
+ }
+ return null;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
new file mode 100644
index 00000000..447f0efe
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/MavenBuildTimestamp.java
@@ -0,0 +1,70 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.TimeZone;
+
+public class MavenBuildTimestamp
+{
+ // ISO 8601-compliant timestamp for machine readability
+ public static final String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+
+ public static final String BUILD_TIMESTAMP_FORMAT_PROPERTY = "maven.build.timestamp.format";
+
+ private String formattedTimestamp;
+
+ public MavenBuildTimestamp()
+ {
+ this( new Date() );
+ }
+
+ public MavenBuildTimestamp( Date time )
+ {
+ this( time, DEFAULT_BUILD_TIMESTAMP_FORMAT );
+ }
+
+ public MavenBuildTimestamp( Date time, Properties properties )
+ {
+ this( time, properties != null ? properties.getProperty( BUILD_TIMESTAMP_FORMAT_PROPERTY ) : null );
+ }
+
+ public MavenBuildTimestamp( Date time, String timestampFormat )
+ {
+ if ( timestampFormat == null )
+ {
+ timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT;
+ }
+ if ( time == null )
+ {
+ time = new Date();
+ }
+ SimpleDateFormat dateFormat = new SimpleDateFormat( timestampFormat );
+ dateFormat.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
+ formattedTimestamp = dateFormat.format( time );
+ }
+
+ public String formattedTimestamp()
+ {
+ return formattedTimestamp;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java
new file mode 100644
index 00000000..d2b01c1d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java
@@ -0,0 +1,54 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+import java.io.File;
+
+/**
+ * Replaces expressions of the form <tt>${token}</tt> with their effective values. Effective values are basically
+ * calculated from the elements of the model itself and the execution properties from the building request.
+ *
+ * @author jdcasey
+ * <p/>
+ * Created on Feb 2, 2005
+ */
+public interface ModelInterpolator
+{
+
+ /**
+ * Interpolates expressions in the specified model. Note that implementations are free to either interpolate the
+ * provided model directly or to create a clone of the model and interpolate the clone. Callers should always use
+ * the returned model and must not rely on the input model being updated.
+ *
+ * @param model The model to interpolate, must not be {@code null}.
+ * @param projectDir The project directory, may be {@code null} if the model does not belong to a local project but
+ * to some artifact's metadata.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ * @return The interpolated model, never {@code null}.
+ */
+ Model interpolateModel( Model model, File projectDir, ModelBuildingRequest request,
+ ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java
new file mode 100644
index 00000000..1aeafddc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/PathTranslatingPostProcessor.java
@@ -0,0 +1,67 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.model.path.PathTranslator;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
+import org.codehaus.plexus.interpolation.util.ValueSourceUtils;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ *
+ */
+class PathTranslatingPostProcessor
+ implements InterpolationPostProcessor
+{
+
+ private final Collection<String> unprefixedPathKeys;
+ private final File projectDir;
+ private final PathTranslator pathTranslator;
+ private final List<String> expressionPrefixes;
+
+ public PathTranslatingPostProcessor( List<String> expressionPrefixes, Collection<String> unprefixedPathKeys,
+ File projectDir, PathTranslator pathTranslator )
+ {
+ this.expressionPrefixes = expressionPrefixes;
+ this.unprefixedPathKeys = unprefixedPathKeys;
+ this.projectDir = projectDir;
+ this.pathTranslator = pathTranslator;
+ }
+
+ @Override
+ public Object execute( String expression, Object value )
+ {
+ if ( value != null )
+ {
+ expression = ValueSourceUtils.trimPrefix( expression, expressionPrefixes, true );
+
+ if ( unprefixedPathKeys.contains( expression ) )
+ {
+ return pathTranslator.alignToBaseDirectory( String.valueOf( value ), projectDir );
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java
new file mode 100644
index 00000000..be5b227e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ProblemDetectingValueSource.java
@@ -0,0 +1,87 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.codehaus.plexus.interpolation.ValueSource;
+
+/**
+ * Wraps another value source and intercepts interpolated expressions, checking for problems.
+ *
+ * @author Benjamin Bentmann
+ */
+class ProblemDetectingValueSource
+ implements ValueSource
+{
+
+ private final ValueSource valueSource;
+
+ private final String bannedPrefix;
+
+ private final String newPrefix;
+
+ private final ModelProblemCollector problems;
+
+ public ProblemDetectingValueSource( ValueSource valueSource, String bannedPrefix, String newPrefix,
+ ModelProblemCollector problems )
+ {
+ this.valueSource = valueSource;
+ this.bannedPrefix = bannedPrefix;
+ this.newPrefix = newPrefix;
+ this.problems = problems;
+ }
+
+ @Override
+ public Object getValue( String expression )
+ {
+ Object value = valueSource.getValue( expression );
+
+ if ( value != null && expression.startsWith( bannedPrefix ) )
+ {
+ String msg = "The expression ${" + expression + "} is deprecated.";
+ if ( newPrefix != null && newPrefix.length() > 0 )
+ {
+ msg += " Please use ${" + newPrefix + expression.substring( bannedPrefix.length() ) + "} instead.";
+ }
+ problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V20 ).setMessage( msg ) );
+ }
+
+ return value;
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public List getFeedback()
+ {
+ return valueSource.getFeedback();
+ }
+
+ @Override
+ public void clearFeedback()
+ {
+ valueSource.clearFeedback();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
new file mode 100644
index 00000000..c40f9bd5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
@@ -0,0 +1,504 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.StringSearchInterpolator;
+import org.codehaus.plexus.interpolation.ValueSource;
+
+import java.io.File;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+@Component( role = ModelInterpolator.class )
+public class StringSearchModelInterpolator
+ extends AbstractStringBasedModelInterpolator
+{
+
+ private static final Map<Class<?>, InterpolateObjectAction.CacheItem> CACHED_ENTRIES =
+ new ConcurrentHashMap<Class<?>, InterpolateObjectAction.CacheItem>( 80, 0.75f, 2 );
+ // Empirical data from 3.x, actual =40
+
+
+ @Override
+ public Model interpolateModel( Model model, File projectDir, ModelBuildingRequest config,
+ ModelProblemCollector problems )
+ {
+ interpolateObject( model, model, projectDir, config, problems );
+
+ return model;
+ }
+
+ protected void interpolateObject( Object obj, Model model, File projectDir, ModelBuildingRequest config,
+ ModelProblemCollector problems )
+ {
+ try
+ {
+ List<? extends ValueSource> valueSources = createValueSources( model, projectDir, config, problems );
+ List<? extends InterpolationPostProcessor> postProcessors =
+ createPostProcessors( model, projectDir, config );
+
+ InterpolateObjectAction action =
+ new InterpolateObjectAction( obj, valueSources, postProcessors, this, problems );
+
+ AccessController.doPrivileged( action );
+ }
+ finally
+ {
+ getInterpolator().clearAnswers();
+ }
+ }
+
+ @Override
+ protected Interpolator createInterpolator()
+ {
+ StringSearchInterpolator interpolator = new StringSearchInterpolator();
+ interpolator.setCacheAnswers( true );
+
+ return interpolator;
+ }
+
+ private static final class InterpolateObjectAction
+ implements PrivilegedAction<Object>
+ {
+
+ private final LinkedList<Object> interpolationTargets;
+
+ private final StringSearchModelInterpolator modelInterpolator;
+
+ private final List<? extends ValueSource> valueSources;
+
+ private final List<? extends InterpolationPostProcessor> postProcessors;
+
+ private final ModelProblemCollector problems;
+
+ public InterpolateObjectAction( Object target, List<? extends ValueSource> valueSources,
+ List<? extends InterpolationPostProcessor> postProcessors,
+ StringSearchModelInterpolator modelInterpolator,
+ ModelProblemCollector problems )
+ {
+ this.valueSources = valueSources;
+ this.postProcessors = postProcessors;
+
+ this.interpolationTargets = new LinkedList<Object>();
+ interpolationTargets.add( target );
+
+ this.modelInterpolator = modelInterpolator;
+
+ this.problems = problems;
+ }
+
+ @Override
+ public Object run()
+ {
+ while ( !interpolationTargets.isEmpty() )
+ {
+ Object obj = interpolationTargets.removeFirst();
+
+ traverseObjectWithParents( obj.getClass(), obj );
+ }
+
+ return null;
+ }
+
+
+ private String interpolate( String value )
+ {
+ return modelInterpolator.interpolateInternal( value, valueSources, postProcessors, problems );
+ }
+
+ private void traverseObjectWithParents( Class<?> cls, Object target )
+ {
+ if ( cls == null )
+ {
+ return;
+ }
+
+ CacheItem cacheEntry = getCacheEntry( cls );
+ if ( cacheEntry.isArray() )
+ {
+ evaluateArray( target, this );
+ }
+ else if ( cacheEntry.isQualifiedForInterpolation )
+ {
+ cacheEntry.interpolate( target, this );
+
+ traverseObjectWithParents( cls.getSuperclass(), target );
+ }
+ }
+
+
+ private CacheItem getCacheEntry( Class<?> cls )
+ {
+ CacheItem cacheItem = CACHED_ENTRIES.get( cls );
+ if ( cacheItem == null )
+ {
+ cacheItem = new CacheItem( cls );
+ CACHED_ENTRIES.put( cls, cacheItem );
+ }
+ return cacheItem;
+ }
+
+ private static void evaluateArray( Object target, InterpolateObjectAction ctx )
+ {
+ int len = Array.getLength( target );
+ for ( int i = 0; i < len; i++ )
+ {
+ Object value = Array.get( target, i );
+ if ( value != null )
+ {
+ if ( String.class == value.getClass() )
+ {
+ String interpolated = ctx.interpolate( (String) value );
+
+ if ( !interpolated.equals( value ) )
+ {
+ Array.set( target, i, interpolated );
+ }
+ }
+ else
+ {
+ ctx.interpolationTargets.add( value );
+ }
+ }
+ }
+ }
+
+ private static class CacheItem
+ {
+ private final boolean isArray;
+
+ private final boolean isQualifiedForInterpolation;
+
+ private final CacheField[] fields;
+
+ private boolean isQualifiedForInterpolation( Class<?> cls )
+ {
+ return !cls.getName().startsWith( "java" );
+ }
+
+ private boolean isQualifiedForInterpolation( Field field, Class<?> fieldType )
+ {
+ if ( Map.class.equals( fieldType ) && "locations".equals( field.getName() ) )
+ {
+ return false;
+ }
+
+ //noinspection SimplifiableIfStatement
+ if ( fieldType.isPrimitive() )
+ {
+ return false;
+ }
+
+ return !"parent".equals( field.getName() );
+ }
+
+ CacheItem( Class clazz )
+ {
+ this.isQualifiedForInterpolation = isQualifiedForInterpolation( clazz );
+ this.isArray = clazz.isArray();
+ List<CacheField> fields = new ArrayList<CacheField>();
+ for ( Field currentField : clazz.getDeclaredFields() )
+ {
+ Class<?> type = currentField.getType();
+ if ( isQualifiedForInterpolation( currentField, type ) )
+ {
+ if ( String.class == type )
+ {
+ if ( !Modifier.isFinal( currentField.getModifiers() ) )
+ {
+ fields.add( new StringField( currentField ) );
+ }
+ }
+ else if ( List.class.isAssignableFrom( type ) )
+ {
+ fields.add( new ListField( currentField ) );
+ }
+ else if ( Collection.class.isAssignableFrom( type ) )
+ {
+ throw new RuntimeException( "We dont interpolate into collections, use a list instead" );
+ }
+ else if ( Map.class.isAssignableFrom( type ) )
+ {
+ fields.add( new MapField( currentField ) );
+ }
+ else
+ {
+ fields.add( new ObjectField( currentField ) );
+ }
+ }
+
+ }
+ this.fields = fields.toArray( new CacheField[fields.size()] );
+
+ }
+
+ public void interpolate( Object target, InterpolateObjectAction interpolateObjectAction )
+ {
+ for ( CacheField field : fields )
+ {
+ field.interpolate( target, interpolateObjectAction );
+ }
+ }
+
+ public boolean isArray()
+ {
+ return isArray;
+ }
+ }
+
+ abstract static class CacheField
+ {
+ protected final Field field;
+
+ CacheField( Field field )
+ {
+ this.field = field;
+ }
+
+ void interpolate( Object target, InterpolateObjectAction interpolateObjectAction )
+ {
+ synchronized ( field )
+ {
+ boolean isAccessible = field.isAccessible();
+ field.setAccessible( true );
+ try
+ {
+ doInterpolate( target, interpolateObjectAction );
+ }
+ catch ( IllegalArgumentException e )
+ {
+ interpolateObjectAction.problems.add(
+ new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage(
+ "Failed to interpolate field3: " + field + " on class: "
+ + field.getType().getName() ).setException(
+ e ) ); // todo: Not entirely the same message
+ }
+ catch ( IllegalAccessException e )
+ {
+ interpolateObjectAction.problems.add(
+ new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ).setMessage(
+ "Failed to interpolate field4: " + field + " on class: "
+ + field.getType().getName() ).setException( e ) );
+ }
+ finally
+ {
+ field.setAccessible( isAccessible );
+ }
+ }
+
+
+ }
+
+ abstract void doInterpolate( Object target, InterpolateObjectAction ctx )
+ throws IllegalAccessException;
+ }
+
+ static final class StringField
+ extends CacheField
+ {
+ StringField( Field field )
+ {
+ super( field );
+ }
+
+ @Override
+ void doInterpolate( Object target, InterpolateObjectAction ctx )
+ throws IllegalAccessException
+ {
+ String value = (String) field.get( target );
+ if ( value == null )
+ {
+ return;
+ }
+
+ String interpolated = ctx.interpolate( value );
+
+ if ( !interpolated.equals( value ) )
+ {
+ field.set( target, interpolated );
+ }
+ }
+ }
+
+ static final class ListField
+ extends CacheField
+ {
+ ListField( Field field )
+ {
+ super( field );
+ }
+
+ @Override
+ void doInterpolate( Object target, InterpolateObjectAction ctx )
+ throws IllegalAccessException
+ {
+ @SuppressWarnings( "unchecked" ) List<Object> c = (List<Object>) field.get( target );
+ if ( c == null )
+ {
+ return;
+ }
+
+ int size = c.size();
+ Object value;
+ for ( int i = 0; i < size; i++ )
+ {
+
+ value = c.get( i );
+
+ if ( value != null )
+ {
+ if ( String.class == value.getClass() )
+ {
+ String interpolated = ctx.interpolate( (String) value );
+
+ if ( !interpolated.equals( value ) )
+ {
+ try
+ {
+ c.set( i, interpolated );
+ }
+ catch ( UnsupportedOperationException e )
+ {
+ return;
+ }
+ }
+ }
+ else
+ {
+ if ( value.getClass().isArray() )
+ {
+ evaluateArray( value, ctx );
+ }
+ else
+ {
+ ctx.interpolationTargets.add( value );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ static final class MapField
+ extends CacheField
+ {
+ MapField( Field field )
+ {
+ super( field );
+ }
+
+ @Override
+ void doInterpolate( Object target, InterpolateObjectAction ctx )
+ throws IllegalAccessException
+ {
+ @SuppressWarnings( "unchecked" ) Map<Object, Object> m = (Map<Object, Object>) field.get( target );
+ if ( m == null || m.isEmpty() )
+ {
+ return;
+ }
+
+ for ( Map.Entry<Object, Object> entry : m.entrySet() )
+ {
+ Object value = entry.getValue();
+
+ if ( value == null )
+ {
+ continue;
+ }
+
+ if ( String.class == value.getClass() )
+ {
+ String interpolated = ctx.interpolate( (String) value );
+
+ if ( !interpolated.equals( value ) )
+ {
+ try
+ {
+ entry.setValue( interpolated );
+ }
+ catch ( UnsupportedOperationException ignore )
+ {
+ // nop
+ }
+ }
+ }
+ else if ( value.getClass().isArray() )
+ {
+ evaluateArray( value, ctx );
+ }
+ else
+ {
+ ctx.interpolationTargets.add( value );
+ }
+ }
+ }
+ }
+
+ static final class ObjectField
+ extends CacheField
+ {
+ private final boolean isArray;
+
+ ObjectField( Field field )
+ {
+ super( field );
+ this.isArray = field.getType().isArray();
+ }
+
+ @Override
+ void doInterpolate( Object target, InterpolateObjectAction ctx )
+ throws IllegalAccessException
+ {
+ Object value = field.get( target );
+ if ( value != null )
+ {
+ if ( isArray )
+ {
+ evaluateArray( value, ctx );
+ }
+ else
+ {
+ ctx.interpolationTargets.add( value );
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/UrlNormalizingPostProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/UrlNormalizingPostProcessor.java
new file mode 100644
index 00000000..63fb82d6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/UrlNormalizingPostProcessor.java
@@ -0,0 +1,69 @@
+package org.apache.maven.model.interpolation;
+
+/*
+ * 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.Set;
+
+import org.apache.maven.model.path.UrlNormalizer;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
+
+/**
+ * Ensures that expressions referring to URLs evaluate to normalized URLs.
+ *
+ * @author Benjamin Bentmann
+ */
+class UrlNormalizingPostProcessor
+ implements InterpolationPostProcessor
+{
+
+ private static final Set<String> URL_EXPRESSIONS;
+
+ static
+ {
+ Set<String> expressions = new HashSet<String>();
+ expressions.add( "project.url" );
+ expressions.add( "project.scm.url" );
+ expressions.add( "project.scm.connection" );
+ expressions.add( "project.scm.developerConnection" );
+ expressions.add( "project.distributionManagement.site.url" );
+
+ URL_EXPRESSIONS = expressions;
+ }
+
+ private UrlNormalizer normalizer;
+
+ public UrlNormalizingPostProcessor( UrlNormalizer normalizer )
+ {
+ this.normalizer = normalizer;
+ }
+
+ @Override
+ public Object execute( String expression, Object value )
+ {
+ if ( value != null && URL_EXPRESSIONS.contains( expression ) )
+ {
+ return normalizer.normalize( value.toString() );
+ }
+
+ return null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
new file mode 100644
index 00000000..c927b60f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
@@ -0,0 +1,134 @@
+package org.apache.maven.model.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.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+import org.apache.maven.model.InputSource;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx;
+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 a model from some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelReader.class )
+public class DefaultModelReader
+ implements ModelReader
+{
+
+ @Override
+ public Model read( File input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input file missing" );
+ }
+
+ Model model = read( new FileInputStream( input ), options );
+
+ model.setPomFile( input );
+
+ return model;
+ }
+
+ @Override
+ public Model read( Reader input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input reader missing" );
+ }
+
+ try
+ {
+ return read( input, isStrict( options ), getSource( options ) );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ @Override
+ public Model read( InputStream input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input stream missing" );
+ }
+
+ try
+ {
+ return read( ReaderFactory.newXmlReader( input ), isStrict( options ), getSource( options ) );
+ }
+ 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() );
+ }
+
+ private InputSource getSource( Map<String, ?> options )
+ {
+ Object value = ( options != null ) ? options.get( INPUT_SOURCE ) : null;
+ return (InputSource) value;
+ }
+
+ private Model read( Reader reader, boolean strict, InputSource source )
+ throws IOException
+ {
+ try
+ {
+ if ( source != null )
+ {
+ return new MavenXpp3ReaderEx().read( reader, strict, source );
+ }
+ else
+ {
+ return new MavenXpp3Reader().read( reader, strict );
+ }
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelWriter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelWriter.java
new file mode 100644
index 00000000..7294de3c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelWriter.java
@@ -0,0 +1,118 @@
+package org.apache.maven.model.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.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.WriterFactory;
+
+/**
+ * Handles serialization of a model into some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelWriter.class )
+public class DefaultModelWriter
+ implements ModelWriter
+{
+
+ @Override
+ public void write( File output, Map<String, Object> options, Model model )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output file missing" );
+ }
+
+ if ( model == null )
+ {
+ throw new IllegalArgumentException( "model missing" );
+ }
+
+ output.getParentFile().mkdirs();
+
+ write( WriterFactory.newXmlWriter( output ), options, model );
+ }
+
+ @Override
+ public void write( Writer output, Map<String, Object> options, Model model )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output writer missing" );
+ }
+
+ if ( model == null )
+ {
+ throw new IllegalArgumentException( "model missing" );
+ }
+
+ try
+ {
+ MavenXpp3Writer w = new MavenXpp3Writer();
+ w.write( output, model );
+ }
+ finally
+ {
+ IOUtil.close( output );
+ }
+ }
+
+ @Override
+ public void write( OutputStream output, Map<String, Object> options, Model model )
+ throws IOException
+ {
+ if ( output == null )
+ {
+ throw new IllegalArgumentException( "output stream missing" );
+ }
+
+ if ( model == null )
+ {
+ throw new IllegalArgumentException( "model missing" );
+ }
+
+ try
+ {
+ String encoding = model.getModelEncoding();
+ if ( encoding == null || encoding.length() <= 0 )
+ {
+ encoding = "UTF-8";
+ }
+ write( new OutputStreamWriter( output, encoding ), options, model );
+ }
+ finally
+ {
+ IOUtil.close( output );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java
new file mode 100644
index 00000000..1b2cbc34
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelParseException.java
@@ -0,0 +1,93 @@
+package org.apache.maven.model.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 POM due to invalid syntax (e.g. non-wellformed XML or unknown elements).
+ *
+ * @author Benjamin Bentmann
+ */
+public class ModelParseException
+ 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 ModelParseException( 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 ModelParseException( 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-model-builder/src/main/java/org/apache/maven/model/io/ModelReader.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelReader.java
new file mode 100644
index 00000000..75a5ebee
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelReader.java
@@ -0,0 +1,89 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Handles deserialization of a model from some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelReader
+{
+
+ /**
+ * 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.model.io.isStrict";
+
+ /**
+ * The key for the option to enable tracking of line/column numbers. This option is of type
+ * {@link org.apache.maven.model.InputSource} and defaults to {@code null}. Providing an input source enables
+ * location tracking.
+ */
+ String INPUT_SOURCE = "org.apache.maven.model.io.inputSource";
+
+ /**
+ * Reads the model from the specified file.
+ *
+ * @param input The file to deserialize the model 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 model, never {@code null}.
+ * @throws IOException If the model could not be deserialized.
+ * @throws ModelParseException If the input format could not be parsed.
+ */
+ Model read( File input, Map<String, ?> options )
+ throws IOException, ModelParseException;
+
+ /**
+ * Reads the model from the specified character reader. The reader will be automatically closed before the method
+ * returns.
+ *
+ * @param input The reader to deserialize the model 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 model, never {@code null}.
+ * @throws IOException If the model could not be deserialized.
+ * @throws ModelParseException If the input format could not be parsed.
+ */
+ Model read( Reader input, Map<String, ?> options )
+ throws IOException, ModelParseException;
+
+ /**
+ * Reads the model from the specified byte stream. The stream will be automatically closed before the method
+ * returns.
+ *
+ * @param input The stream to deserialize the model 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 model, never {@code null}.
+ * @throws IOException If the model could not be deserialized.
+ * @throws ModelParseException If the input format could not be parsed.
+ */
+ Model read( InputStream input, Map<String, ?> options )
+ throws IOException, ModelParseException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelWriter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelWriter.java
new file mode 100644
index 00000000..af7e0cab
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/io/ModelWriter.java
@@ -0,0 +1,74 @@
+package org.apache.maven.model.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.model.Model;
+
+/**
+ * Handles serialization of a model into some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelWriter
+{
+
+ /**
+ * Writes the supplied model to the specified file. Any non-existing parent directories of the output file will be
+ * created automatically.
+ *
+ * @param output The file to serialize the model to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param model The model to serialize, must not be {@code null}.
+ * @throws IOException If the model could not be serialized.
+ */
+ void write( File output, Map<String, Object> options, Model model )
+ throws IOException;
+
+ /**
+ * Writes the supplied model to the specified character writer. The writer will be automatically closed before the
+ * method returns.
+ *
+ * @param output The writer to serialize the model to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param model The model to serialize, must not be {@code null}.
+ * @throws IOException If the model could not be serialized.
+ */
+ void write( Writer output, Map<String, Object> options, Model model )
+ throws IOException;
+
+ /**
+ * Writes the supplied model to the specified byte stream. The stream will be automatically closed before the method
+ * returns.
+ *
+ * @param output The stream to serialize the model to, must not be {@code null}.
+ * @param options The options to use for serialization, may be {@code null} to use the default values.
+ * @param model The model to serialize, must not be {@code null}.
+ * @throws IOException If the model could not be serialized.
+ */
+ void write( OutputStream output, Map<String, Object> options, Model model )
+ throws IOException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/DefaultModelLocator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/DefaultModelLocator.java
new file mode 100644
index 00000000..299da65f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/DefaultModelLocator.java
@@ -0,0 +1,42 @@
+package org.apache.maven.model.locator;
+
+/*
+ * 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.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Locates a POM file within a project base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelLocator.class )
+public class DefaultModelLocator
+ implements ModelLocator
+{
+
+ @Override
+ public File locatePom( File projectDirectory )
+ {
+ return new File( projectDirectory, "pom.xml" );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/ModelLocator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/ModelLocator.java
new file mode 100644
index 00000000..3aa0045c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/locator/ModelLocator.java
@@ -0,0 +1,44 @@
+package org.apache.maven.model.locator;
+
+/*
+ * 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;
+
+/**
+ * Locates a POM file within a project base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelLocator
+{
+
+ /**
+ * Locates the POM file within the specified project directory. In case the given project directory does not exist
+ * or does not contain a POM file, the return value indicates the expected path to the POM file. Sub directories of
+ * the project directory will not be considered when locating the POM file. The return value will be an absolute
+ * path if the project directory is given as an absolute path.
+ *
+ * @param projectDirectory The (possibly non-existent) base directory to locate the POM file in, must not be {@code
+ * null}.
+ * @return The path to the (possibly non-existent) POM file, never {@code null}.
+ */
+ File locatePom( File projectDirectory );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java
new file mode 100644
index 00000000..bfeafcb7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java
@@ -0,0 +1,110 @@
+package org.apache.maven.model.management;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Handles injection of dependency management into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = DependencyManagementInjector.class )
+public class DefaultDependencyManagementInjector
+ implements DependencyManagementInjector
+{
+
+ private ManagementModelMerger merger = new ManagementModelMerger();
+
+ @Override
+ public void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ merger.mergeManagedDependencies( model );
+ }
+
+ protected static class ManagementModelMerger
+ extends MavenModelMerger
+ {
+
+ public void mergeManagedDependencies( Model model )
+ {
+ DependencyManagement dependencyManagement = model.getDependencyManagement();
+ if ( dependencyManagement != null )
+ {
+ Map<Object, Dependency> dependencies = new HashMap<Object, Dependency>();
+ Map<Object, Object> context = Collections.emptyMap();
+
+ for ( Dependency dependency : model.getDependencies() )
+ {
+ Object key = getDependencyKey( dependency );
+ dependencies.put( key, dependency );
+ }
+
+ for ( Dependency managedDependency : dependencyManagement.getDependencies() )
+ {
+ Object key = getDependencyKey( managedDependency );
+ Dependency dependency = dependencies.get( key );
+ if ( dependency != null )
+ {
+ mergeDependency( dependency, managedDependency, false, context );
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void mergeDependency_Optional( Dependency target, Dependency source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ // optional flag is not managed
+ }
+
+ @Override
+ protected void mergeDependency_Exclusions( Dependency target, Dependency source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<Exclusion> tgt = target.getExclusions();
+ if ( tgt.isEmpty() )
+ {
+ List<Exclusion> src = source.getExclusions();
+
+ for ( Exclusion element : src )
+ {
+ Exclusion clone = element.clone();
+ target.addExclusion( clone );
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java
new file mode 100644
index 00000000..75d7d878
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java
@@ -0,0 +1,137 @@
+package org.apache.maven.model.management;
+
+/*
+ * 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.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Handles injection of plugin management into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginManagementInjector.class )
+public class DefaultPluginManagementInjector
+ implements PluginManagementInjector
+{
+
+ private ManagementModelMerger merger = new ManagementModelMerger();
+
+ @Override
+ public void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ merger.mergeManagedBuildPlugins( model );
+ }
+
+ protected static class ManagementModelMerger
+ extends MavenModelMerger
+ {
+
+ public void mergeManagedBuildPlugins( Model model )
+ {
+ Build build = model.getBuild();
+ if ( build != null )
+ {
+ PluginManagement pluginManagement = build.getPluginManagement();
+ if ( pluginManagement != null )
+ {
+ mergePluginContainer_Plugins( build, pluginManagement );
+ }
+ }
+ }
+
+ private void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source )
+ {
+ List<Plugin> src = source.getPlugins();
+ if ( !src.isEmpty() )
+ {
+ List<Plugin> tgt = target.getPlugins();
+
+ Map<Object, Plugin> managedPlugins = new LinkedHashMap<Object, Plugin>( src.size() * 2 );
+
+ Map<Object, Object> context = Collections.emptyMap();
+
+ for ( Plugin element : src )
+ {
+ Object key = getPluginKey( element );
+ managedPlugins.put( key, element );
+ }
+
+ for ( Plugin element : tgt )
+ {
+ Object key = getPluginKey( element );
+ Plugin managedPlugin = managedPlugins.get( key );
+ if ( managedPlugin != null )
+ {
+ mergePlugin( element, managedPlugin, false, context );
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<PluginExecution> src = source.getExecutions();
+ if ( !src.isEmpty() )
+ {
+ List<PluginExecution> tgt = target.getExecutions();
+
+ Map<Object, PluginExecution> merged =
+ new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( PluginExecution element : src )
+ {
+ Object key = getPluginExecutionKey( element );
+ merged.put( key, element.clone() );
+ }
+
+ for ( PluginExecution element : tgt )
+ {
+ Object key = getPluginExecutionKey( element );
+ PluginExecution existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergePluginExecution( element, existing, sourceDominant, context );
+ }
+ merged.put( key, element );
+ }
+
+ target.setExecutions( new ArrayList<PluginExecution>( merged.values() ) );
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java
new file mode 100644
index 00000000..3b70a09c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/DependencyManagementInjector.java
@@ -0,0 +1,44 @@
+package org.apache.maven.model.management;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles injection of dependency management into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface DependencyManagementInjector
+{
+
+ /**
+ * Merges default values from the dependency management section of the given model into itself.
+ *
+ * @param model The model into which to merge the values specified by its dependency management sections, must not
+ * be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java
new file mode 100644
index 00000000..7384fdf0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/management/PluginManagementInjector.java
@@ -0,0 +1,44 @@
+package org.apache.maven.model.management;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles injection of plugin management into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface PluginManagementInjector
+{
+
+ /**
+ * Merges default values from the plugin management section of the given model into itself.
+ *
+ * @param model The model into which to merge the values specified by its plugin management section, must not be
+ * <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void injectManagement( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java
new file mode 100644
index 00000000..2727a111
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java
@@ -0,0 +1,729 @@
+package org.apache.maven.model.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.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.ModelBase;
+import org.apache.maven.model.Organization;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.RepositoryBase;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Site;
+
+/**
+ * The domain-specific model merger for the Maven POM, overriding generic code from parent class when necessary with
+ * more adapted algorithms.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MavenModelMerger
+ extends ModelMerger
+{
+
+ /**
+ * The hint key for the child path adjustment used during inheritance for URL calculations.
+ */
+ public static final String CHILD_PATH_ADJUSTMENT = "child-path-adjustment";
+
+ /**
+ * The context key for the artifact id of the target model.
+ */
+ private static final String ARTIFACT_ID = "artifact-id";
+
+ @Override
+ protected void mergeModel( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ context.put( ARTIFACT_ID, target.getArtifactId() );
+
+ super.mergeModel( target, source, sourceDominant, context );
+ }
+
+ @Override
+ protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ String src = source.getName();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setName( src );
+ target.setLocation( "name", source.getLocation( "name" ) );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeModel_Url( Model target, Model source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ String src = source.getUrl();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setUrl( src );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ else if ( target.getUrl() == null )
+ {
+ target.setUrl( appendPath( src, context ) );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ }
+ }
+
+ /*
+ * TODO: Whether the merge continues recursively into an existing node or not could be an option for the generated
+ * merger
+ */
+ @Override
+ protected void mergeModel_Organization( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ Organization src = source.getOrganization();
+ if ( src != null )
+ {
+ Organization tgt = target.getOrganization();
+ if ( tgt == null )
+ {
+ tgt = new Organization();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setOrganization( tgt );
+ mergeOrganization( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeModel_IssueManagement( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ IssueManagement src = source.getIssueManagement();
+ if ( src != null )
+ {
+ IssueManagement tgt = target.getIssueManagement();
+ if ( tgt == null )
+ {
+ tgt = new IssueManagement();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setIssueManagement( tgt );
+ mergeIssueManagement( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeModel_CiManagement( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ CiManagement src = source.getCiManagement();
+ if ( src != null )
+ {
+ CiManagement tgt = target.getCiManagement();
+ if ( tgt == null )
+ {
+ tgt = new CiManagement();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setCiManagement( tgt );
+ mergeCiManagement( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeModel_ModelVersion( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ // neither inherited nor injected
+ }
+
+ @Override
+ protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ // neither inherited nor injected
+ }
+
+ @Override
+ protected void mergeModel_Profiles( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ // neither inherited nor injected
+ }
+
+ @Override
+ protected void mergeModel_Prerequisites( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ // neither inherited nor injected
+ }
+
+ @Override
+ protected void mergeModel_Licenses( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( target.getLicenses().isEmpty() )
+ {
+ target.setLicenses( new ArrayList<License>( source.getLicenses() ) );
+ }
+ }
+
+ @Override
+ protected void mergeModel_Developers( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( target.getDevelopers().isEmpty() )
+ {
+ target.setDevelopers( new ArrayList<Developer>( source.getDevelopers() ) );
+ }
+ }
+
+ @Override
+ protected void mergeModel_Contributors( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( target.getContributors().isEmpty() )
+ {
+ target.setContributors( new ArrayList<Contributor>( source.getContributors() ) );
+ }
+ }
+
+ @Override
+ protected void mergeModel_MailingLists( Model target, Model source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( target.getMailingLists().isEmpty() )
+ {
+ target.setMailingLists( new ArrayList<MailingList>( source.getMailingLists() ) );
+ }
+ }
+
+ @Override
+ protected void mergeModelBase_Modules( ModelBase target, ModelBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<String> src = source.getModules();
+ if ( !src.isEmpty() && sourceDominant )
+ {
+ List<Integer> indices = new ArrayList<Integer>();
+ List<String> tgt = target.getModules();
+ Set<String> excludes = new LinkedHashSet<String>( tgt );
+ List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
+ merged.addAll( tgt );
+ for ( int i = 0, n = tgt.size(); i < n; i++ )
+ {
+ indices.add( i );
+ }
+ for ( int i = 0, n = src.size(); i < n; i++ )
+ {
+ String s = src.get( i );
+ if ( !excludes.contains( s ) )
+ {
+ merged.add( s );
+ indices.add( ~i );
+ }
+ }
+ target.setModules( merged );
+ target.setLocation( "modules", InputLocation.merge( target.getLocation( "modules" ),
+ source.getLocation( "modules" ), indices ) );
+ }
+ }
+
+ /*
+ * TODO: The order of the merged list could be controlled by an attribute in the model association: target-first,
+ * source-first, dominant-first, recessive-first
+ */
+ @Override
+ protected void mergeModelBase_Repositories( ModelBase target, ModelBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<Repository> src = source.getRepositories();
+ if ( !src.isEmpty() )
+ {
+ List<Repository> tgt = target.getRepositories();
+ Map<Object, Repository> merged = new LinkedHashMap<Object, Repository>( ( src.size() + tgt.size() ) * 2 );
+
+ List<Repository> dominant, recessive;
+ if ( sourceDominant )
+ {
+ dominant = src;
+ recessive = tgt;
+ }
+ else
+ {
+ dominant = tgt;
+ recessive = src;
+ }
+
+ for ( Repository element : dominant )
+ {
+ Object key = getRepositoryKey( element );
+ merged.put( key, element );
+ }
+
+ for ( Repository element : recessive )
+ {
+ Object key = getRepositoryKey( element );
+ if ( !merged.containsKey( key ) )
+ {
+ merged.put( key, element );
+ }
+ }
+
+ target.setRepositories( new ArrayList<Repository>( merged.values() ) );
+ }
+ }
+
+ @Override
+ protected void mergeModelBase_PluginRepositories( ModelBase target, ModelBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<Repository> src = source.getPluginRepositories();
+ if ( !src.isEmpty() )
+ {
+ List<Repository> tgt = target.getPluginRepositories();
+ Map<Object, Repository> merged = new LinkedHashMap<Object, Repository>( ( src.size() + tgt.size() ) * 2 );
+
+ List<Repository> dominant, recessive;
+ if ( sourceDominant )
+ {
+ dominant = src;
+ recessive = tgt;
+ }
+ else
+ {
+ dominant = tgt;
+ recessive = src;
+ }
+
+ for ( Repository element : dominant )
+ {
+ Object key = getRepositoryKey( element );
+ merged.put( key, element );
+ }
+
+ for ( Repository element : recessive )
+ {
+ Object key = getRepositoryKey( element );
+ if ( !merged.containsKey( key ) )
+ {
+ merged.put( key, element );
+ }
+ }
+
+ target.setPluginRepositories( new ArrayList<Repository>( merged.values() ) );
+ }
+ }
+
+ /*
+ * TODO: Whether duplicates should be removed looks like an option for the generated merger.
+ */
+ @Override
+ protected void mergeBuildBase_Filters( BuildBase target, BuildBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<String> src = source.getFilters();
+ if ( !src.isEmpty() )
+ {
+ List<String> tgt = target.getFilters();
+ Set<String> excludes = new LinkedHashSet<String>( tgt );
+ List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
+ merged.addAll( tgt );
+ for ( String s : src )
+ {
+ if ( !excludes.contains( s ) )
+ {
+ merged.add( s );
+ }
+ }
+ target.setFilters( merged );
+ }
+ }
+
+ @Override
+ protected void mergeBuildBase_Resources( BuildBase target, BuildBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( sourceDominant || target.getResources().isEmpty() )
+ {
+ super.mergeBuildBase_Resources( target, source, sourceDominant, context );
+ }
+ }
+
+ @Override
+ protected void mergeBuildBase_TestResources( BuildBase target, BuildBase source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ if ( sourceDominant || target.getTestResources().isEmpty() )
+ {
+ super.mergeBuildBase_TestResources( target, source, sourceDominant, context );
+ }
+ }
+
+ @Override
+ protected void mergeDistributionManagement_Repository( DistributionManagement target,
+ DistributionManagement source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ DeploymentRepository src = source.getRepository();
+ if ( src != null )
+ {
+ DeploymentRepository tgt = target.getRepository();
+ if ( sourceDominant || tgt == null )
+ {
+ tgt = new DeploymentRepository();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setRepository( tgt );
+ mergeDeploymentRepository( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeDistributionManagement_SnapshotRepository( DistributionManagement target,
+ DistributionManagement source,
+ boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ DeploymentRepository src = source.getSnapshotRepository();
+ if ( src != null )
+ {
+ DeploymentRepository tgt = target.getSnapshotRepository();
+ if ( sourceDominant || tgt == null )
+ {
+ tgt = new DeploymentRepository();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setSnapshotRepository( tgt );
+ mergeDeploymentRepository( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeDistributionManagement_Site( DistributionManagement target, DistributionManagement source,
+ boolean sourceDominant, Map<Object, Object> context )
+ {
+ Site src = source.getSite();
+ if ( src != null )
+ {
+ Site tgt = target.getSite();
+ if ( sourceDominant || tgt == null )
+ {
+ tgt = new Site();
+ tgt.setLocation( "", src.getLocation( "" ) );
+ target.setSite( tgt );
+ mergeSite( tgt, src, sourceDominant, context );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ String src = source.getUrl();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setUrl( src );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ else if ( target.getUrl() == null )
+ {
+ target.setUrl( appendPath( src, context ) );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ String src = source.getUrl();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setUrl( src );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ else if ( target.getUrl() == null )
+ {
+ target.setUrl( appendPath( src, context ) );
+ target.setLocation( "url", source.getLocation( "url" ) );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
+ {
+ String src = source.getConnection();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setConnection( src );
+ target.setLocation( "connection", source.getLocation( "connection" ) );
+ }
+ else if ( target.getConnection() == null )
+ {
+ target.setConnection( appendPath( src, context ) );
+ target.setLocation( "connection", source.getLocation( "connection" ) );
+ }
+ }
+ }
+
+ @Override
+ protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ String src = source.getDeveloperConnection();
+ if ( src != null )
+ {
+ if ( sourceDominant )
+ {
+ target.setDeveloperConnection( src );
+ target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
+ }
+ else if ( target.getDeveloperConnection() == null )
+ {
+ target.setDeveloperConnection( appendPath( src, context ) );
+ target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) );
+ }
+ }
+ }
+
+ @Override
+ protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<PluginExecution> src = source.getExecutions();
+ if ( !src.isEmpty() )
+ {
+ List<PluginExecution> tgt = target.getExecutions();
+ Map<Object, PluginExecution> merged =
+ new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( PluginExecution element : src )
+ {
+ if ( sourceDominant
+ || ( element.getInherited() != null ? element.isInherited() : source.isInherited() ) )
+ {
+ Object key = getPluginExecutionKey( element );
+ merged.put( key, element );
+ }
+ }
+
+ for ( PluginExecution element : tgt )
+ {
+ Object key = getPluginExecutionKey( element );
+ PluginExecution existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergePluginExecution( element, existing, sourceDominant, context );
+ }
+ merged.put( key, element );
+ }
+
+ target.setExecutions( new ArrayList<PluginExecution>( merged.values() ) );
+ }
+ }
+
+ @Override
+ protected void mergePluginExecution_Goals( PluginExecution target, PluginExecution source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<String> src = source.getGoals();
+ if ( !src.isEmpty() )
+ {
+ List<String> tgt = target.getGoals();
+ Set<String> excludes = new LinkedHashSet<String>( tgt );
+ List<String> merged = new ArrayList<String>( tgt.size() + src.size() );
+ merged.addAll( tgt );
+ for ( String s : src )
+ {
+ if ( !excludes.contains( s ) )
+ {
+ merged.add( s );
+ }
+ }
+ target.setGoals( merged );
+ }
+ }
+
+ @Override
+ protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<ReportSet> src = source.getReportSets();
+ if ( !src.isEmpty() )
+ {
+ List<ReportSet> tgt = target.getReportSets();
+ Map<Object, ReportSet> merged = new LinkedHashMap<Object, ReportSet>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( ReportSet rset : src )
+ {
+ if ( sourceDominant || ( rset.getInherited() != null ? rset.isInherited() : source.isInherited() ) )
+ {
+ Object key = getReportSetKey( rset );
+ merged.put( key, rset );
+ }
+ }
+
+ for ( ReportSet element : tgt )
+ {
+ Object key = getReportSetKey( element );
+ ReportSet existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergeReportSet( element, existing, sourceDominant, context );
+ }
+ merged.put( key, element );
+ }
+
+ target.setReportSets( new ArrayList<ReportSet>( merged.values() ) );
+ }
+ }
+
+ @Override
+ protected Object getDependencyKey( Dependency dependency )
+ {
+ return dependency.getManagementKey();
+ }
+
+ @Override
+ protected Object getPluginKey( Plugin plugin )
+ {
+ return plugin.getKey();
+ }
+
+ @Override
+ protected Object getPluginExecutionKey( PluginExecution pluginExecution )
+ {
+ return pluginExecution.getId();
+ }
+
+ @Override
+ protected Object getReportPluginKey( ReportPlugin reportPlugin )
+ {
+ return reportPlugin.getKey();
+ }
+
+ @Override
+ protected Object getReportSetKey( ReportSet reportSet )
+ {
+ return reportSet.getId();
+ }
+
+ @Override
+ protected Object getRepositoryBaseKey( RepositoryBase repositoryBase )
+ {
+ return repositoryBase.getId();
+ }
+
+ @Override
+ protected Object getExtensionKey( Extension extension )
+ {
+ return extension.getGroupId() + ':' + extension.getArtifactId();
+ }
+
+ @Override
+ protected Object getExclusionKey( Exclusion exclusion )
+ {
+ return exclusion.getGroupId() + ':' + exclusion.getArtifactId();
+ }
+
+ private String appendPath( String parentPath, Map<Object, Object> context )
+ {
+ Object artifactId = context.get( ARTIFACT_ID );
+ Object childPathAdjustment = context.get( CHILD_PATH_ADJUSTMENT );
+
+ if ( artifactId != null && childPathAdjustment != null )
+ {
+ return appendPath( parentPath, artifactId.toString(), childPathAdjustment.toString() );
+ }
+ else
+ {
+ return parentPath;
+ }
+ }
+
+ private String appendPath( String parentPath, String childPath, String pathAdjustment )
+ {
+ String path = parentPath;
+ path = concatPath( path, pathAdjustment );
+ path = concatPath( path, childPath );
+ return path;
+ }
+
+ private String concatPath( String base, String path )
+ {
+ String result = base;
+
+ if ( path != null && path.length() > 0 )
+ {
+ if ( ( result.endsWith( "/" ) && !path.startsWith( "/" ) )
+ || ( !result.endsWith( "/" ) && path.startsWith( "/" ) ) )
+ {
+ result += path;
+ }
+ else if ( result.endsWith( "/" ) && path.startsWith( "/" ) )
+ {
+ result += path.substring( 1 );
+ }
+ else
+ {
+ result += '/';
+ result += path;
+ }
+ if ( base.endsWith( "/" ) && !result.endsWith( "/" ) )
+ {
+ result += '/';
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java
new file mode 100644
index 00000000..262dd3f5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java
@@ -0,0 +1,135 @@
+package org.apache.maven.model.normalization;
+
+/*
+ * 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.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Handles normalization of a model.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelNormalizer.class )
+public class DefaultModelNormalizer
+ implements ModelNormalizer
+{
+
+ private DuplicateMerger merger = new DuplicateMerger();
+
+ @Override
+ public void mergeDuplicates( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ Build build = model.getBuild();
+ if ( build != null )
+ {
+ List<Plugin> plugins = build.getPlugins();
+ Map<Object, Plugin> normalized = new LinkedHashMap<Object, Plugin>( plugins.size() * 2 );
+
+ for ( Plugin plugin : plugins )
+ {
+ Object key = plugin.getKey();
+ Plugin first = normalized.get( key );
+ if ( first != null )
+ {
+ merger.mergePlugin( plugin, first );
+ }
+ normalized.put( key, plugin );
+ }
+
+ if ( plugins.size() != normalized.size() )
+ {
+ build.setPlugins( new ArrayList<Plugin>( normalized.values() ) );
+ }
+ }
+
+ /*
+ * NOTE: This is primarily to keep backward-compat with Maven 2.x which did not validate that dependencies are
+ * unique within a single POM. Upon multiple declarations, 2.x just kept the last one but retained the order of
+ * the first occurrence. So when we're in lenient/compat mode, we have to deal with such broken POMs and mimic
+ * the way 2.x works. When we're in strict mode, the removal of duplicates just saves other merging steps from
+ * aftereffects and bogus error messages.
+ */
+ List<Dependency> dependencies = model.getDependencies();
+ Map<String, Dependency> normalized = new LinkedHashMap<String, Dependency>( dependencies.size() * 2 );
+
+ for ( Dependency dependency : dependencies )
+ {
+ normalized.put( dependency.getManagementKey(), dependency );
+ }
+
+ if ( dependencies.size() != normalized.size() )
+ {
+ model.setDependencies( new ArrayList<Dependency>( normalized.values() ) );
+ }
+ }
+
+ protected static class DuplicateMerger
+ extends MavenModelMerger
+ {
+
+ public void mergePlugin( Plugin target, Plugin source )
+ {
+ super.mergePlugin( target, source, false, Collections.emptyMap() );
+ }
+
+ }
+
+ @Override
+ public void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ injectDependencyDefaults( model.getDependencies() );
+
+ Build build = model.getBuild();
+ if ( build != null )
+ {
+ for ( Plugin plugin : build.getPlugins() )
+ {
+ injectDependencyDefaults( plugin.getDependencies() );
+ }
+ }
+ }
+
+ private void injectDependencyDefaults( List<Dependency> dependencies )
+ {
+ for ( Dependency dependency : dependencies )
+ {
+ if ( StringUtils.isEmpty( dependency.getScope() ) )
+ {
+ // we cannot set this directly in the MDO due to the interactions with dependency management
+ dependency.setScope( "compile" );
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java
new file mode 100644
index 00000000..7cab86b6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java
@@ -0,0 +1,54 @@
+package org.apache.maven.model.normalization;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles normalization of a model. In this context, normalization is the process of producing a canonical
+ * representation for models that physically look different but are semantically equivalent.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelNormalizer
+{
+
+ /**
+ * Merges duplicate elements like multiple declarations of the same build plugin in the specified model.
+ *
+ * @param model The model whose duplicate elements should be merged, must not be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void mergeDuplicates( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+ /**
+ * Sets default values in the specified model that for technical reasons cannot be set directly in the Modello
+ * definition.
+ *
+ * @param model The model in which to set the default values, must not be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void injectDefaultValues( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelPathTranslator.java
new file mode 100644
index 00000000..51fa60e6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelPathTranslator.java
@@ -0,0 +1,111 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Resolves relative paths within a model against a specific base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelPathTranslator.class )
+public class DefaultModelPathTranslator
+ implements ModelPathTranslator
+{
+
+ @Requirement
+ private PathTranslator pathTranslator;
+
+ public DefaultModelPathTranslator setPathTranslator( PathTranslator pathTranslator )
+ {
+ this.pathTranslator = pathTranslator;
+ return this;
+ }
+
+ @Override
+ public void alignToBaseDirectory( Model model, File basedir, ModelBuildingRequest request )
+ {
+ if ( model == null || basedir == null )
+ {
+ return;
+ }
+
+ Build build = model.getBuild();
+
+ if ( build != null )
+ {
+ build.setDirectory( alignToBaseDirectory( build.getDirectory(), basedir ) );
+
+ build.setSourceDirectory( alignToBaseDirectory( build.getSourceDirectory(), basedir ) );
+
+ build.setTestSourceDirectory( alignToBaseDirectory( build.getTestSourceDirectory(), basedir ) );
+
+ build.setScriptSourceDirectory( alignToBaseDirectory( build.getScriptSourceDirectory(), basedir ) );
+
+ for ( Resource resource : build.getResources() )
+ {
+ resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) );
+ }
+
+ for ( Resource resource : build.getTestResources() )
+ {
+ resource.setDirectory( alignToBaseDirectory( resource.getDirectory(), basedir ) );
+ }
+
+ if ( build.getFilters() != null )
+ {
+ List<String> filters = new ArrayList<String>( build.getFilters().size() );
+ for ( String filter : build.getFilters() )
+ {
+ filters.add( alignToBaseDirectory( filter, basedir ) );
+ }
+ build.setFilters( filters );
+ }
+
+ build.setOutputDirectory( alignToBaseDirectory( build.getOutputDirectory(), basedir ) );
+
+ build.setTestOutputDirectory( alignToBaseDirectory( build.getTestOutputDirectory(), basedir ) );
+ }
+
+ Reporting reporting = model.getReporting();
+
+ if ( reporting != null )
+ {
+ reporting.setOutputDirectory( alignToBaseDirectory( reporting.getOutputDirectory(), basedir ) );
+ }
+ }
+
+ private String alignToBaseDirectory( String path, File basedir )
+ {
+ return pathTranslator.alignToBaseDirectory( path, basedir );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelUrlNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelUrlNormalizer.java
new file mode 100644
index 00000000..2093f8fb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelUrlNormalizer.java
@@ -0,0 +1,84 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.model.DistributionManagement;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Site;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Normalizes URLs to remove the ugly parent references "../" that got potentially inserted by URL adjustment during
+ * model inheritance.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ModelUrlNormalizer.class )
+public class DefaultModelUrlNormalizer
+ implements ModelUrlNormalizer
+{
+
+ @Requirement
+ private UrlNormalizer urlNormalizer;
+
+ public DefaultModelUrlNormalizer setUrlNormalizer( UrlNormalizer urlNormalizer )
+ {
+ this.urlNormalizer = urlNormalizer;
+ return this;
+ }
+
+ @Override
+ public void normalize( Model model, ModelBuildingRequest request )
+ {
+ if ( model == null )
+ {
+ return;
+ }
+
+ model.setUrl( normalize( model.getUrl() ) );
+
+ Scm scm = model.getScm();
+ if ( scm != null )
+ {
+ scm.setUrl( normalize( scm.getUrl() ) );
+ scm.setConnection( normalize( scm.getConnection() ) );
+ scm.setDeveloperConnection( normalize( scm.getDeveloperConnection() ) );
+ }
+
+ DistributionManagement dist = model.getDistributionManagement();
+ if ( dist != null )
+ {
+ Site site = dist.getSite();
+ if ( site != null )
+ {
+ site.setUrl( normalize( site.getUrl() ) );
+ }
+ }
+ }
+
+ private String normalize( String url )
+ {
+ return urlNormalizer.normalize( url );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java
new file mode 100644
index 00000000..1ad9d034
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultPathTranslator.java
@@ -0,0 +1,66 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Resolves relative paths against a specific base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = PathTranslator.class )
+public class DefaultPathTranslator
+ implements PathTranslator
+{
+
+ @Override
+ public String alignToBaseDirectory( String path, File basedir )
+ {
+ String result = path;
+
+ if ( path != null && basedir != null )
+ {
+ path = path.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar );
+
+ File file = new File( path );
+ if ( file.isAbsolute() )
+ {
+ // path was already absolute, just normalize file separator and we're done
+ result = file.getPath();
+ }
+ else if ( file.getPath().startsWith( File.separator ) )
+ {
+ // drive-relative Windows path, don't align with project directory but with drive root
+ result = file.getAbsolutePath();
+ }
+ else
+ {
+ // an ordinary relative path, align with project directory
+ result = new File( new File( basedir, path ).toURI().normalize() ).getAbsolutePath();
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultUrlNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultUrlNormalizer.java
new file mode 100644
index 00000000..120b02f1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultUrlNormalizer.java
@@ -0,0 +1,65 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Normalizes a URL.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = UrlNormalizer.class )
+public class DefaultUrlNormalizer
+ implements UrlNormalizer
+{
+
+ @Override
+ public String normalize( String url )
+ {
+ String result = url;
+
+ if ( result != null )
+ {
+ while ( true )
+ {
+ int idx = result.indexOf( "/../" );
+ if ( idx <= 0 )
+ {
+ break;
+ }
+ int parent = idx - 1;
+ while ( parent >= 0 && result.charAt( parent ) == '/' )
+ {
+ parent--;
+ }
+ parent = result.lastIndexOf( '/', parent );
+ if ( parent < 0 )
+ {
+ break;
+ }
+ result = result.substring( 0, parent ) + result.substring( idx + 3 );
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelPathTranslator.java
new file mode 100644
index 00000000..2bd39c55
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelPathTranslator.java
@@ -0,0 +1,45 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+
+/**
+ * Resolves relative paths of a model against a specific base directory.
+ *
+ * @author Jason van Zyl
+ */
+public interface ModelPathTranslator
+{
+
+ /**
+ * Resolves the well-known paths of the specified model against the given base directory. Paths within plugin
+ * configuration are not processed.
+ *
+ * @param model The model whose paths should be resolved, may be {@code null}.
+ * @param basedir The base directory to resolve relative paths against, may be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ */
+ void alignToBaseDirectory( Model model, File basedir, ModelBuildingRequest request );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelUrlNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelUrlNormalizer.java
new file mode 100644
index 00000000..8325b05d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/ModelUrlNormalizer.java
@@ -0,0 +1,42 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+
+/**
+ * Normalizes URLs to remove the ugly parent references "../" that got potentially inserted by URL adjustment during
+ * model inheritance.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelUrlNormalizer
+{
+
+ /**
+ * Normalizes the well-known URLs of the specified model.
+ *
+ * @param model The model whose URLs should be normalized, may be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ */
+ void normalize( Model model, ModelBuildingRequest request );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/PathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/PathTranslator.java
new file mode 100644
index 00000000..c416e6ab
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/PathTranslator.java
@@ -0,0 +1,43 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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;
+
+/**
+ * Resolves relative paths against a specific base directory.
+ *
+ * @author Jason van Zyl
+ */
+public interface PathTranslator
+{
+
+ /**
+ * Resolves the specified path against the given base directory. The resolved path will be absolute and uses the
+ * platform-specific file separator if a base directory is given. Otherwise, the input path will be returned
+ * unaltered.
+ *
+ * @param path The path to resolve, may be {@code null}.
+ * @param basedir The base directory to resolve relative paths against, may be {@code null}.
+ * @return The resolved path or {@code null} if the input path was {@code null}.
+ */
+ String alignToBaseDirectory( String path, File basedir );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/UrlNormalizer.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/UrlNormalizer.java
new file mode 100644
index 00000000..b2e4a7b1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/path/UrlNormalizer.java
@@ -0,0 +1,39 @@
+package org.apache.maven.model.path;
+
+/*
+ * 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.
+ */
+
+/**
+ * Normalizes a URL to remove the ugly parent references "../" that got potentially inserted by URL adjustment during
+ * model inheritance.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface UrlNormalizer
+{
+
+ /**
+ * Normalizes the specified URL.
+ *
+ * @param url The URL to normalize, may be {@code null}.
+ * @return The normalized URL or {@code null} if the input was {@code null}.
+ */
+ String normalize( String url );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
new file mode 100644
index 00000000..dc7cf13b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
@@ -0,0 +1,83 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Handles expansion of general build plugin configuration into individual executions.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginConfigurationExpander.class )
+public class DefaultPluginConfigurationExpander
+ implements PluginConfigurationExpander
+{
+
+ @Override
+ public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ Build build = model.getBuild();
+
+ if ( build != null )
+ {
+ expand( build.getPlugins() );
+
+ PluginManagement pluginManagement = build.getPluginManagement();
+
+ if ( pluginManagement != null )
+ {
+ expand( pluginManagement.getPlugins() );
+ }
+ }
+ }
+
+ private void expand( List<Plugin> plugins )
+ {
+ for ( Plugin plugin : plugins )
+ {
+ Xpp3Dom pluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
+
+ if ( pluginConfiguration != null )
+ {
+ for ( PluginExecution execution : plugin.getExecutions() )
+ {
+ Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration();
+
+ executionConfiguration =
+ Xpp3Dom.mergeXpp3Dom( executionConfiguration, new Xpp3Dom( pluginConfiguration ) );
+
+ execution.setConfiguration( executionConfiguration );
+ }
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
new file mode 100644
index 00000000..9c842994
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
@@ -0,0 +1,65 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Handles expansion of general report plugin configuration into individual report sets.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ReportConfigurationExpander.class )
+public class DefaultReportConfigurationExpander
+ implements ReportConfigurationExpander
+{
+
+ @Override
+ public void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ Reporting reporting = model.getReporting();
+
+ if ( reporting != null )
+ {
+ for ( ReportPlugin reportPlugin : reporting.getPlugins() )
+ {
+ Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();
+
+ if ( parentDom != null )
+ {
+ for ( ReportSet execution : reportPlugin.getReportSets() )
+ {
+ Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
+ childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
+ execution.setConfiguration( childDom );
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
new file mode 100644
index 00000000..d918d9e8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
@@ -0,0 +1,240 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Handles conversion of the legacy reporting section into the configuration of the new Maven Site Plugin.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ReportingConverter.class )
+public class DefaultReportingConverter
+ implements ReportingConverter
+{
+
+ @Override
+ public void convertReporting( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ Reporting reporting = model.getReporting();
+
+ if ( reporting == null )
+ {
+ return;
+ }
+
+ Build build = model.getBuild();
+
+ if ( build == null )
+ {
+ build = new Build();
+ model.setBuild( build );
+ }
+
+ Plugin sitePlugin = findSitePlugin( build );
+
+ if ( sitePlugin == null )
+ {
+ sitePlugin = new Plugin();
+ sitePlugin.setArtifactId( "maven-site-plugin" );
+ PluginManagement pluginManagement = build.getPluginManagement();
+ if ( pluginManagement == null )
+ {
+ pluginManagement = new PluginManagement();
+ build.setPluginManagement( pluginManagement );
+ }
+ pluginManagement.addPlugin( sitePlugin );
+ }
+
+ Xpp3Dom configuration = (Xpp3Dom) sitePlugin.getConfiguration();
+
+ if ( configuration == null )
+ {
+ configuration = new Xpp3Dom( "configuration" );
+ sitePlugin.setConfiguration( configuration );
+ }
+
+ Xpp3Dom reportPlugins = configuration.getChild( "reportPlugins" );
+
+ if ( reportPlugins != null )
+ {
+ // new-style report configuration already present, assume user handled entire conversion
+ return;
+ }
+
+ if ( configuration.getChild( "outputDirectory" ) == null )
+ {
+ addDom( configuration, "outputDirectory", reporting.getOutputDirectory() );
+ }
+
+ reportPlugins = new Xpp3Dom( "reportPlugins" );
+ configuration.addChild( reportPlugins );
+
+ boolean hasMavenProjectInfoReportsPlugin = false;
+
+ /* waiting for MSITE-484 before deprecating <reporting> section
+ if ( !reporting.getPlugins().isEmpty()
+ && request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 )
+ {
+
+ problems.add( new ModelProblemCollectorRequest( Severity.WARNING, Version.V31 )
+ .setMessage( "The <reporting> section is deprecated, please move the reports to the <configuration>"
+ + " section of the new Maven Site Plugin." )
+ .setLocation( reporting.getLocation( "" ) ) );
+ }*/
+
+ for ( ReportPlugin plugin : reporting.getPlugins() )
+ {
+ Xpp3Dom reportPlugin = convert( plugin );
+ reportPlugins.addChild( reportPlugin );
+
+ if ( !reporting.isExcludeDefaults() && !hasMavenProjectInfoReportsPlugin
+ && "org.apache.maven.plugins".equals( plugin.getGroupId() )
+ && "maven-project-info-reports-plugin".equals( plugin.getArtifactId() ) )
+ {
+ hasMavenProjectInfoReportsPlugin = true;
+ }
+ }
+
+ if ( !reporting.isExcludeDefaults() && !hasMavenProjectInfoReportsPlugin )
+ {
+ Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
+
+ addDom( dom, "groupId", "org.apache.maven.plugins" );
+ addDom( dom, "artifactId", "maven-project-info-reports-plugin" );
+
+ reportPlugins.addChild( dom );
+ }
+ }
+
+ private Plugin findSitePlugin( Build build )
+ {
+ for ( Plugin plugin : build.getPlugins() )
+ {
+ if ( isSitePlugin( plugin ) )
+ {
+ return plugin;
+ }
+ }
+
+ PluginManagement pluginManagement = build.getPluginManagement();
+ if ( pluginManagement != null )
+ {
+ for ( Plugin plugin : pluginManagement.getPlugins() )
+ {
+ if ( isSitePlugin( plugin ) )
+ {
+ return plugin;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private boolean isSitePlugin( Plugin plugin )
+ {
+ return "maven-site-plugin".equals( plugin.getArtifactId() )
+ && "org.apache.maven.plugins".equals( plugin.getGroupId() );
+ }
+
+ private Xpp3Dom convert( ReportPlugin plugin )
+ {
+ Xpp3Dom dom = new Xpp3Dom( "reportPlugin" );
+
+ addDom( dom, "groupId", plugin.getGroupId() );
+ addDom( dom, "artifactId", plugin.getArtifactId() );
+ addDom( dom, "version", plugin.getVersion() );
+
+ Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
+ if ( configuration != null )
+ {
+ configuration = new Xpp3Dom( configuration );
+ dom.addChild( configuration );
+ }
+
+ if ( !plugin.getReportSets().isEmpty() )
+ {
+ Xpp3Dom reportSets = new Xpp3Dom( "reportSets" );
+ for ( ReportSet reportSet : plugin.getReportSets() )
+ {
+ Xpp3Dom rs = convert( reportSet );
+ reportSets.addChild( rs );
+ }
+ dom.addChild( reportSets );
+ }
+
+ return dom;
+ }
+
+ private Xpp3Dom convert( ReportSet reportSet )
+ {
+ Xpp3Dom dom = new Xpp3Dom( "reportSet" );
+
+ addDom( dom, "id", reportSet.getId() );
+
+ Xpp3Dom configuration = (Xpp3Dom) reportSet.getConfiguration();
+ if ( configuration != null )
+ {
+ configuration = new Xpp3Dom( configuration );
+ dom.addChild( configuration );
+ }
+
+ if ( !reportSet.getReports().isEmpty() )
+ {
+ Xpp3Dom reports = new Xpp3Dom( "reports" );
+ for ( String report : reportSet.getReports() )
+ {
+ addDom( reports, "report", report );
+ }
+ dom.addChild( reports );
+ }
+
+ return dom;
+ }
+
+ private void addDom( Xpp3Dom parent, String childName, String childValue )
+ {
+ if ( StringUtils.isNotEmpty( childValue ) )
+ {
+ parent.addChild( newDom( childName, childValue ) );
+ }
+ }
+
+ private Xpp3Dom newDom( String name, String value )
+ {
+ Xpp3Dom dom = new Xpp3Dom( name );
+ dom.setValue( value );
+ return dom;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/LifecycleBindingsInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/LifecycleBindingsInjector.java
new file mode 100644
index 00000000..9c0f06de
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/LifecycleBindingsInjector.java
@@ -0,0 +1,46 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles injection of plugin executions induced by the lifecycle bindings for a packaging.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface LifecycleBindingsInjector
+{
+
+ /**
+ * Injects plugin executions induced by lifecycle bindings into the specified model. The model has already undergone
+ * injection of plugin management so any plugins that are injected by lifecycle bindings and are not already present
+ * in the model's plugin section need to be subjected to the model's plugin management.
+ *
+ * @param model The model into which to inject the default plugin executions for its packaging, must not be
+ * <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
new file mode 100644
index 00000000..23994aa6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
@@ -0,0 +1,43 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles expansion of general build plugin configuration into individual executions.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface PluginConfigurationExpander
+{
+
+ /**
+ * Merges values from general build plugin configuration into the individual plugin executions of the given model.
+ *
+ * @param model The model whose build plugin configuration should be expanded, must not be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
new file mode 100644
index 00000000..28ad5962
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportConfigurationExpander.java
@@ -0,0 +1,43 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles expansion of general report plugin configuration into individual report sets.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ReportConfigurationExpander
+{
+
+ /**
+ * Merges values from general report plugin configuration into the individual reports sets of the given model.
+ *
+ * @param model The model whose report plugin configuration should be expanded, must not be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportingConverter.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportingConverter.java
new file mode 100644
index 00000000..c5ea338c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ReportingConverter.java
@@ -0,0 +1,43 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles conversion of the legacy reporting section into the configuration of the new Maven Site Plugin.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ReportingConverter
+{
+
+ /**
+ * Converts values from model's reporting section into the configuration for the new Maven Site Plugin.
+ *
+ * @param model The model whose reporting section should be converted, must not be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void convertReporting( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java
new file mode 100644
index 00000000..bb38a2e0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileActivationContext.java
@@ -0,0 +1,259 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Describes the environmental context used to determine the activation status of profiles.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultProfileActivationContext
+ implements ProfileActivationContext
+{
+
+ private List<String> activeProfileIds = Collections.emptyList();
+
+ private List<String> inactiveProfileIds = Collections.emptyList();
+
+ private Map<String, String> systemProperties = Collections.emptyMap();
+
+ private Map<String, String> userProperties = Collections.emptyMap();
+
+ private Map<String, String> projectProperties = Collections.emptyMap();
+
+ private File projectDirectory;
+
+ @Override
+ public List<String> getActiveProfileIds()
+ {
+ return activeProfileIds;
+ }
+
+ /**
+ * Sets the identifiers of those profiles that should be activated by explicit demand.
+ *
+ * @param activeProfileIds The identifiers of those profiles to activate, may be {@code null}.
+ * @return This context, never {@code null}.
+ */
+ public DefaultProfileActivationContext setActiveProfileIds( List<String> activeProfileIds )
+ {
+ if ( activeProfileIds != null )
+ {
+ this.activeProfileIds = Collections.unmodifiableList( activeProfileIds );
+ }
+ else
+ {
+ this.activeProfileIds = Collections.emptyList();
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<String> getInactiveProfileIds()
+ {
+ return inactiveProfileIds;
+ }
+
+ /**
+ * Sets the identifiers of those profiles that should be deactivated by explicit demand.
+ *
+ * @param inactiveProfileIds The identifiers of those profiles to deactivate, may be {@code null}.
+ * @return This context, never {@code null}.
+ */
+ public DefaultProfileActivationContext setInactiveProfileIds( List<String> inactiveProfileIds )
+ {
+ if ( inactiveProfileIds != null )
+ {
+ this.inactiveProfileIds = Collections.unmodifiableList( inactiveProfileIds );
+ }
+ else
+ {
+ this.inactiveProfileIds = Collections.emptyList();
+ }
+
+ return this;
+ }
+
+ @Override
+ public Map<String, String> getSystemProperties()
+ {
+ return systemProperties;
+ }
+
+ /**
+ * Sets the system properties to use for interpolation and profile activation. 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 context, never {@code null}.
+ */
+ @SuppressWarnings( "unchecked" )
+ public DefaultProfileActivationContext setSystemProperties( Properties systemProperties )
+ {
+ if ( systemProperties != null )
+ {
+ this.systemProperties = Collections.unmodifiableMap( (Map) systemProperties );
+ }
+ else
+ {
+ this.systemProperties = Collections.emptyMap();
+ }
+
+ return this;
+ }
+
+ /**
+ * Sets the system properties to use for interpolation and profile activation. 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 context, never {@code null}.
+ */
+ public DefaultProfileActivationContext setSystemProperties( Map<String, String> systemProperties )
+ {
+ if ( systemProperties != null )
+ {
+ this.systemProperties = Collections.unmodifiableMap( systemProperties );
+ }
+ else
+ {
+ this.systemProperties = Collections.emptyMap();
+ }
+
+ return this;
+ }
+
+ @Override
+ public Map<String, String> getUserProperties()
+ {
+ return userProperties;
+ }
+
+ /**
+ * Sets the user properties to use for interpolation and profile activation. 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 context, never {@code null}.
+ */
+ @SuppressWarnings( "unchecked" )
+ public DefaultProfileActivationContext setUserProperties( Properties userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = Collections.unmodifiableMap( (Map) userProperties );
+ }
+ else
+ {
+ this.userProperties = Collections.emptyMap();
+ }
+
+ return this;
+ }
+
+ /**
+ * Sets the user properties to use for interpolation and profile activation. 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 context, never {@code null}.
+ */
+ public DefaultProfileActivationContext setUserProperties( Map<String, String> userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = Collections.unmodifiableMap( userProperties );
+ }
+ else
+ {
+ this.userProperties = Collections.emptyMap();
+ }
+
+ return this;
+ }
+
+ @Override
+ public File getProjectDirectory()
+ {
+ return projectDirectory;
+ }
+
+ /**
+ * Sets the base directory of the current project.
+ *
+ * @param projectDirectory The base directory of the current project, may be {@code null} if profile activation
+ * happens in the context of metadata retrieval rather than project building.
+ * @return This context, never {@code null}.
+ */
+ public DefaultProfileActivationContext setProjectDirectory( File projectDirectory )
+ {
+ this.projectDirectory = projectDirectory;
+
+ return this;
+ }
+
+ @Override
+ public Map<String, String> getProjectProperties()
+ {
+ return projectProperties;
+ }
+
+ public DefaultProfileActivationContext setProjectProperties( Properties projectProperties )
+ {
+ if ( projectProperties != null )
+ {
+
+ this.projectProperties = Collections.unmodifiableMap( toMap( projectProperties ) );
+ }
+ else
+ {
+ this.projectProperties = Collections.emptyMap();
+ }
+
+ return this;
+ }
+
+ private Map<String, String> toMap( Properties properties )
+ {
+ if ( properties == null )
+ {
+ return Collections.emptyMap();
+ }
+ Map<String, String> map = new HashMap<String, String>();
+ Enumeration keys = properties.keys();
+ while ( keys.hasMoreElements() )
+ {
+ String key = (String) keys.nextElement();
+ map.put( key, properties.getProperty( key ) );
+ }
+ return map;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java
new file mode 100644
index 00000000..aeed0235
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java
@@ -0,0 +1,249 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.ModelBase;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Handles profile injection into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ProfileInjector.class )
+public class DefaultProfileInjector
+ implements ProfileInjector
+{
+
+ private ProfileModelMerger merger = new ProfileModelMerger();
+
+ @Override
+ public void injectProfile( Model model, Profile profile, ModelBuildingRequest request,
+ ModelProblemCollector problems )
+ {
+ if ( profile != null )
+ {
+ merger.mergeModelBase( model, profile );
+
+ if ( profile.getBuild() != null )
+ {
+ if ( model.getBuild() == null )
+ {
+ model.setBuild( new Build() );
+ }
+ merger.mergeBuildBase( model.getBuild(), profile.getBuild() );
+ }
+ }
+ }
+
+ protected static class ProfileModelMerger
+ extends MavenModelMerger
+ {
+
+ public void mergeModelBase( ModelBase target, ModelBase source )
+ {
+ mergeModelBase( target, source, true, Collections.emptyMap() );
+ }
+
+ public void mergeBuildBase( BuildBase target, BuildBase source )
+ {
+ mergeBuildBase( target, source, true, Collections.emptyMap() );
+ }
+
+ @Override
+ protected void mergePluginContainer_Plugins( PluginContainer target, PluginContainer source,
+ boolean sourceDominant, Map<Object, Object> context )
+ {
+ List<Plugin> src = source.getPlugins();
+ if ( !src.isEmpty() )
+ {
+ List<Plugin> tgt = target.getPlugins();
+ Map<Object, Plugin> master = new LinkedHashMap<Object, Plugin>( tgt.size() * 2 );
+
+ for ( Plugin element : tgt )
+ {
+ Object key = getPluginKey( element );
+ master.put( key, element );
+ }
+
+ Map<Object, List<Plugin>> predecessors = new LinkedHashMap<Object, List<Plugin>>();
+ List<Plugin> pending = new ArrayList<Plugin>();
+ for ( Plugin element : src )
+ {
+ Object key = getPluginKey( element );
+ Plugin existing = master.get( key );
+ if ( existing != null )
+ {
+ mergePlugin( existing, element, sourceDominant, context );
+
+ if ( !pending.isEmpty() )
+ {
+ predecessors.put( key, pending );
+ pending = new ArrayList<Plugin>();
+ }
+ }
+ else
+ {
+ pending.add( element );
+ }
+ }
+
+ List<Plugin> result = new ArrayList<Plugin>( src.size() + tgt.size() );
+ for ( Map.Entry<Object, Plugin> entry : master.entrySet() )
+ {
+ List<Plugin> pre = predecessors.get( entry.getKey() );
+ if ( pre != null )
+ {
+ result.addAll( pre );
+ }
+ result.add( entry.getValue() );
+ }
+ result.addAll( pending );
+
+ target.setPlugins( result );
+ }
+ }
+
+ @Override
+ protected void mergePlugin_Executions( Plugin target, Plugin source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<PluginExecution> src = source.getExecutions();
+ if ( !src.isEmpty() )
+ {
+ List<PluginExecution> tgt = target.getExecutions();
+ Map<Object, PluginExecution> merged =
+ new LinkedHashMap<Object, PluginExecution>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( PluginExecution element : tgt )
+ {
+ Object key = getPluginExecutionKey( element );
+ merged.put( key, element );
+ }
+
+ for ( PluginExecution element : src )
+ {
+ Object key = getPluginExecutionKey( element );
+ PluginExecution existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergePluginExecution( existing, element, sourceDominant, context );
+ }
+ else
+ {
+ merged.put( key, element );
+ }
+ }
+
+ target.setExecutions( new ArrayList<PluginExecution>( merged.values() ) );
+ }
+ }
+
+ @Override
+ protected void mergeReporting_Plugins( Reporting target, Reporting source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<ReportPlugin> src = source.getPlugins();
+ if ( !src.isEmpty() )
+ {
+ List<ReportPlugin> tgt = target.getPlugins();
+ Map<Object, ReportPlugin> merged =
+ new LinkedHashMap<Object, ReportPlugin>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( ReportPlugin element : tgt )
+ {
+ Object key = getReportPluginKey( element );
+ merged.put( key, element );
+ }
+
+ for ( ReportPlugin element : src )
+ {
+ Object key = getReportPluginKey( element );
+ ReportPlugin existing = merged.get( key );
+ if ( existing == null )
+ {
+ merged.put( key, element );
+ }
+ else
+ {
+ mergeReportPlugin( existing, element, sourceDominant, context );
+ }
+ }
+
+ target.setPlugins( new ArrayList<ReportPlugin>( merged.values() ) );
+ }
+ }
+
+ @Override
+ protected void mergeReportPlugin_ReportSets( ReportPlugin target, ReportPlugin source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ List<ReportSet> src = source.getReportSets();
+ if ( !src.isEmpty() )
+ {
+ List<ReportSet> tgt = target.getReportSets();
+ Map<Object, ReportSet> merged = new LinkedHashMap<Object, ReportSet>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( ReportSet element : tgt )
+ {
+ Object key = getReportSetKey( element );
+ merged.put( key, element );
+ }
+
+ for ( ReportSet element : src )
+ {
+ Object key = getReportSetKey( element );
+ ReportSet existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergeReportSet( existing, element, sourceDominant, context );
+ }
+ else
+ {
+ merged.put( key, element );
+ }
+ }
+
+ target.setReportSets( new ArrayList<ReportSet>( merged.values() ) );
+ }
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java
new file mode 100644
index 00000000..512476a1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileSelector.java
@@ -0,0 +1,143 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.profile.activation.ProfileActivator;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Calculates the active profiles among a given collection of profiles.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ProfileSelector.class )
+public class DefaultProfileSelector
+ implements ProfileSelector
+{
+
+ @Requirement( role = ProfileActivator.class )
+ private List<ProfileActivator> activators = new ArrayList<ProfileActivator>();
+
+ public DefaultProfileSelector addProfileActivator( ProfileActivator profileActivator )
+ {
+ if ( profileActivator != null )
+ {
+ activators.add( profileActivator );
+ }
+ return this;
+ }
+
+ @Override
+ public List<Profile> getActiveProfiles( Collection<Profile> profiles, ProfileActivationContext context,
+ ModelProblemCollector problems )
+ {
+ Collection<String> activatedIds = new HashSet<String>( context.getActiveProfileIds() );
+ Collection<String> deactivatedIds = new HashSet<String>( context.getInactiveProfileIds() );
+
+ List<Profile> activeProfiles = new ArrayList<Profile>( profiles.size() );
+ List<Profile> activePomProfilesByDefault = new ArrayList<Profile>();
+ boolean activatedPomProfileNotByDefault = false;
+
+ for ( Profile profile : profiles )
+ {
+ if ( !deactivatedIds.contains( profile.getId() ) )
+ {
+ if ( activatedIds.contains( profile.getId() ) || isActive( profile, context, problems ) )
+ {
+ activeProfiles.add( profile );
+
+ if ( Profile.SOURCE_POM.equals( profile.getSource() ) )
+ {
+ activatedPomProfileNotByDefault = true;
+ }
+ }
+ else if ( isActiveByDefault( profile ) )
+ {
+ if ( Profile.SOURCE_POM.equals( profile.getSource() ) )
+ {
+ activePomProfilesByDefault.add( profile );
+ }
+ else
+ {
+ activeProfiles.add( profile );
+ }
+ }
+
+ }
+ }
+
+ if ( !activatedPomProfileNotByDefault )
+ {
+ activeProfiles.addAll( activePomProfilesByDefault );
+ }
+
+ return activeProfiles;
+ }
+
+ private boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ boolean isActive = false;
+ for ( ProfileActivator activator : activators )
+ {
+ if ( activator.presentInConfig( profile, context, problems ) )
+ {
+ isActive = true;
+ }
+ }
+ for ( ProfileActivator activator : activators )
+ {
+ try
+ {
+ if ( activator.presentInConfig( profile, context, problems ) )
+ {
+ isActive &= activator.isActive( profile, context, problems );
+ }
+ }
+ catch ( RuntimeException e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Failed to determine activation for profile " + profile.getId() )
+ .setLocation( profile.getLocation( "" ) )
+ .setException( e ) );
+ return false;
+ }
+ }
+ return isActive;
+ }
+
+ private boolean isActiveByDefault( Profile profile )
+ {
+ Activation activation = profile.getActivation();
+ return activation != null && activation.isActiveByDefault();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java
new file mode 100644
index 00000000..d501e660
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileActivationContext.java
@@ -0,0 +1,79 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.List;
+import java.util.Map;
+
+/**
+ * Describes the environmental context used to determine the activation status of profiles.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProfileActivationContext
+{
+
+ /**
+ * Gets the identifiers of those profiles that should be activated by explicit demand.
+ *
+ * @return The identifiers of those profiles to activate, never {@code null}.
+ */
+ List<String> getActiveProfileIds();
+
+ /**
+ * Gets the identifiers of those profiles that should be deactivated by explicit demand.
+ *
+ * @return The identifiers of those profiles to deactivate, never {@code null}.
+ */
+ List<String> getInactiveProfileIds();
+
+ /**
+ * Gets the system properties to use for interpolation and profile activation. The system properties are collected
+ * from the runtime environment like {@link System#getProperties()} and environment variables.
+ *
+ * @return The execution properties, never {@code null}.
+ */
+ Map<String, String> getSystemProperties();
+
+ /**
+ * Gets the user properties to use for interpolation and profile activation. 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}.
+ */
+ Map<String, String> getUserProperties();
+
+ /**
+ * Gets the base directory of the current project (if any).
+ *
+ * @return The base directory of the current project or {@code null} if none.
+ */
+ File getProjectDirectory();
+
+ /**
+ * Gets current calculated project properties
+ *
+ * @return The project properties, never {@code null}.
+ */
+ Map<String, String> getProjectProperties();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java
new file mode 100644
index 00000000..fbd7ddf0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileInjector.java
@@ -0,0 +1,46 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.model.Model;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Handles profile injection into the model.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProfileInjector
+{
+
+ /**
+ * Merges values from the specified profile into the given model. Implementations are expected to keep the profile
+ * and model completely decoupled by injecting deep copies rather than the original objects from the profile.
+ *
+ * @param model The model into which to merge the values defined by the profile, must not be <code>null</code>.
+ * @param profile The (read-only) profile whose values should be injected, may be <code>null</code>.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void injectProfile( Model model, Profile profile, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileSelector.java
new file mode 100644
index 00000000..53ea8d9c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/ProfileSelector.java
@@ -0,0 +1,49 @@
+package org.apache.maven.model.profile;
+
+/*
+ * 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.Collection;
+import java.util.List;
+
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Calculates the active profiles among a given collection of profiles.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProfileSelector
+{
+
+ /**
+ * Determines the profiles which are active in the specified activation context. Active profiles will eventually be
+ * injected into the model.
+ *
+ * @param profiles The profiles whose activation status should be determined, must not be {@code null}.
+ * @param context The environmental context used to determine the activation status of a profile, must not be
+ * {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ * @return The profiles that have been activated, never {@code null}.
+ */
+ List<Profile> getActiveProfiles( Collection<Profile> profiles, ProfileActivationContext context,
+ ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java
new file mode 100644
index 00000000..c0dcce23
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/FileProfileActivator.java
@@ -0,0 +1,192 @@
+package org.apache.maven.model.profile.activation;
+
+/*
+ * 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.model.Activation;
+import org.apache.maven.model.ActivationFile;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.path.PathTranslator;
+import org.apache.maven.model.profile.ProfileActivationContext;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.interpolation.AbstractValueSource;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Determines profile activation based on the existence/absence of some file.
+ * File name interpolation support is limited to <code>${basedir}</code> (since Maven 3,
+ * see <a href="http://jira.codehaus.org/browse/MNG-2363">MNG-2363</a>),
+ * System properties and request properties.
+ * <code>${project.basedir}</code> is intentionally not supported as this form would suggest that other
+ * <code>${project.*}</code> expressions can be used, which is however beyond the design.
+ *
+ * @author Benjamin Bentmann
+ * @see ActivationFile
+ * @see org.apache.maven.model.validation.DefaultModelValidator#validateRawModel
+ */
+@Component( role = ProfileActivator.class, hint = "file" )
+public class FileProfileActivator
+ implements ProfileActivator
+{
+
+ @Requirement
+ private PathTranslator pathTranslator;
+
+ public FileProfileActivator setPathTranslator( PathTranslator pathTranslator )
+ {
+ this.pathTranslator = pathTranslator;
+ return this;
+ }
+
+ @Override
+ public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationFile file = activation.getFile();
+
+ if ( file == null )
+ {
+ return false;
+ }
+
+ String path;
+ boolean missing;
+
+ if ( StringUtils.isNotEmpty( file.getExists() ) )
+ {
+ path = file.getExists();
+ missing = false;
+ }
+ else if ( StringUtils.isNotEmpty( file.getMissing() ) )
+ {
+ path = file.getMissing();
+ missing = true;
+ }
+ else
+ {
+ return false;
+ }
+
+ RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
+
+ final File basedir = context.getProjectDirectory();
+
+ if ( basedir != null )
+ {
+ interpolator.addValueSource( new AbstractValueSource( false )
+ {
+ @Override
+ public Object getValue( String expression )
+ {
+ /*
+ * NOTE: We intentionally only support ${basedir} and not ${project.basedir} as the latter form
+ * would suggest that other project.* expressions can be used which is however beyond the design.
+ */
+ if ( "basedir".equals( expression ) )
+ {
+ return basedir.getAbsolutePath();
+ }
+ return null;
+ }
+ } );
+ }
+ else if ( path.contains( "${basedir}" ) )
+ {
+ return false;
+ }
+
+ interpolator.addValueSource( new MapBasedValueSource( context.getProjectProperties() ) );
+
+ interpolator.addValueSource( new MapBasedValueSource( context.getUserProperties() ) );
+
+ interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) );
+
+ try
+ {
+ path = interpolator.interpolate( path, "" );
+ }
+ catch ( Exception e )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Failed to interpolate file location " + path + " for profile " + profile.getId()
+ + ": " + e.getMessage() )
+ .setLocation( file.getLocation( missing ? "missing" : "exists" ) )
+ .setException( e ) );
+ return false;
+ }
+
+ path = pathTranslator.alignToBaseDirectory( path, basedir );
+
+ // replace activation value with interpolated value
+ if ( missing )
+ {
+ file.setMissing( path );
+ }
+ else
+ {
+ file.setExists( path );
+ }
+
+ File f = new File( path );
+
+ if ( !f.isAbsolute() )
+ {
+ return false;
+ }
+
+ boolean fileExists = f.exists();
+
+ return missing ? !fileExists : fileExists;
+ }
+
+ @Override
+ public boolean presentInConfig( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationFile file = activation.getFile();
+
+ if ( file == null )
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java
new file mode 100644
index 00000000..e981bfd3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java
@@ -0,0 +1,224 @@
+package org.apache.maven.model.profile.activation;
+
+/*
+ * 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.model.Activation;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.profile.ProfileActivationContext;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Determines profile activation based on the version of the current Java runtime.
+ *
+ * @author Benjamin Bentmann
+ * @see Activation#getJdk()
+ */
+@Component( role = ProfileActivator.class, hint = "jdk-version" )
+public class JdkVersionProfileActivator
+ implements ProfileActivator
+{
+
+ @Override
+ public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ String jdk = activation.getJdk();
+
+ if ( jdk == null )
+ {
+ return false;
+ }
+
+ String version = context.getSystemProperties().get( "java.version" );
+
+ if ( version == null || version.length() <= 0 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Failed to determine Java version for profile " + profile.getId() )
+ .setLocation( activation.getLocation( "jdk" ) ) );
+ return false;
+ }
+
+ if ( jdk.startsWith( "!" ) )
+ {
+ return !version.startsWith( jdk.substring( 1 ) );
+ }
+ else if ( isRange( jdk ) )
+ {
+ return isInRange( version, getRange( jdk ) );
+ }
+ else
+ {
+ return version.startsWith( jdk );
+ }
+ }
+
+ @Override
+ public boolean presentInConfig( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ String jdk = activation.getJdk();
+
+ if ( jdk == null )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean isInRange( String value, List<RangeValue> range )
+ {
+ int leftRelation = getRelationOrder( value, range.get( 0 ), true );
+
+ if ( leftRelation == 0 )
+ {
+ return true;
+ }
+
+ if ( leftRelation < 0 )
+ {
+ return false;
+ }
+
+ return getRelationOrder( value, range.get( 1 ), false ) <= 0;
+ }
+
+ private static int getRelationOrder( String value, RangeValue rangeValue, boolean isLeft )
+ {
+ if ( rangeValue.value.length() <= 0 )
+ {
+ return isLeft ? 1 : -1;
+ }
+
+ value = value.replaceAll( "[^0-9\\.\\-\\_]", "" );
+
+ List<String> valueTokens = new ArrayList<String>( Arrays.asList( value.split( "[\\.\\-\\_]" ) ) );
+ List<String> rangeValueTokens = new ArrayList<String>( Arrays.asList( rangeValue.value.split( "\\." ) ) );
+
+ addZeroTokens( valueTokens, 3 );
+ addZeroTokens( rangeValueTokens, 3 );
+
+ for ( int i = 0; i < 3; i++ )
+ {
+ int x = Integer.parseInt( valueTokens.get( i ) );
+ int y = Integer.parseInt( rangeValueTokens.get( i ) );
+ if ( x < y )
+ {
+ return -1;
+ }
+ else if ( x > y )
+ {
+ return 1;
+ }
+ }
+ if ( !rangeValue.closed )
+ {
+ return isLeft ? -1 : 1;
+ }
+ return 0;
+ }
+
+ private static void addZeroTokens( List<String> tokens, int max )
+ {
+ while ( tokens.size() < max )
+ {
+ tokens.add( "0" );
+ }
+ }
+
+ private static boolean isRange( String value )
+ {
+ return value.startsWith( "[" ) || value.startsWith( "(" );
+ }
+
+ private static List<RangeValue> getRange( String range )
+ {
+ List<RangeValue> ranges = new ArrayList<RangeValue>();
+
+ for ( String token : range.split( "," ) )
+ {
+ if ( token.startsWith( "[" ) )
+ {
+ ranges.add( new RangeValue( token.replace( "[", "" ), true ) );
+ }
+ else if ( token.startsWith( "(" ) )
+ {
+ ranges.add( new RangeValue( token.replace( "(", "" ), false ) );
+ }
+ else if ( token.endsWith( "]" ) )
+ {
+ ranges.add( new RangeValue( token.replace( "]", "" ), true ) );
+ }
+ else if ( token.endsWith( ")" ) )
+ {
+ ranges.add( new RangeValue( token.replace( ")", "" ), false ) );
+ }
+ else if ( token.length() <= 0 )
+ {
+ ranges.add( new RangeValue( "", false ) );
+ }
+ }
+ if ( ranges.size() < 2 )
+ {
+ ranges.add( new RangeValue( "99999999", false ) );
+ }
+ return ranges;
+ }
+
+ private static class RangeValue
+ {
+ private String value;
+
+ private boolean closed;
+
+ RangeValue( String value, boolean closed )
+ {
+ this.value = value.trim();
+ this.closed = closed;
+ }
+
+ @Override
+ public String toString()
+ {
+ return value;
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java
new file mode 100644
index 00000000..30abb1fa
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java
@@ -0,0 +1,168 @@
+package org.apache.maven.model.profile.activation;
+
+/*
+ * 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.model.Activation;
+import org.apache.maven.model.ActivationOS;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.profile.ProfileActivationContext;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.Os;
+
+/**
+ * Determines profile activation based on the operating system of the current runtime platform.
+ *
+ * @author Benjamin Bentmann
+ * @see ActivationOS
+ */
+@Component( role = ProfileActivator.class, hint = "os" )
+public class OperatingSystemProfileActivator
+ implements ProfileActivator
+{
+
+ @Override
+ public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationOS os = activation.getOs();
+
+ if ( os == null )
+ {
+ return false;
+ }
+
+ boolean active = ensureAtLeastOneNonNull( os );
+
+ if ( active && os.getFamily() != null )
+ {
+ active = determineFamilyMatch( os.getFamily() );
+ }
+ if ( active && os.getName() != null )
+ {
+ active = determineNameMatch( os.getName() );
+ }
+ if ( active && os.getArch() != null )
+ {
+ active = determineArchMatch( os.getArch() );
+ }
+ if ( active && os.getVersion() != null )
+ {
+ active = determineVersionMatch( os.getVersion() );
+ }
+
+ return active;
+ }
+
+ @Override
+ public boolean presentInConfig( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationOS os = activation.getOs();
+
+ if ( os == null )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private boolean ensureAtLeastOneNonNull( ActivationOS os )
+ {
+ return os.getArch() != null || os.getFamily() != null || os.getName() != null || os.getVersion() != null;
+ }
+
+ private boolean determineVersionMatch( String version )
+ {
+ String test = version;
+ boolean reverse = false;
+
+ if ( test.startsWith( "!" ) )
+ {
+ reverse = true;
+ test = test.substring( 1 );
+ }
+
+ boolean result = Os.isVersion( test );
+
+ return reverse ? !result : result;
+ }
+
+ private boolean determineArchMatch( String arch )
+ {
+ String test = arch;
+ boolean reverse = false;
+
+ if ( test.startsWith( "!" ) )
+ {
+ reverse = true;
+ test = test.substring( 1 );
+ }
+
+ boolean result = Os.isArch( test );
+
+ return reverse ? !result : result;
+ }
+
+ private boolean determineNameMatch( String name )
+ {
+ String test = name;
+ boolean reverse = false;
+
+ if ( test.startsWith( "!" ) )
+ {
+ reverse = true;
+ test = test.substring( 1 );
+ }
+
+ boolean result = Os.isName( test );
+
+ return reverse ? !result : result;
+ }
+
+ private boolean determineFamilyMatch( String family )
+ {
+ String test = family;
+ boolean reverse = false;
+
+ if ( test.startsWith( "!" ) )
+ {
+ reverse = true;
+ test = test.substring( 1 );
+ }
+
+ boolean result = Os.isFamily( test );
+
+ return reverse ? !result : result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/ProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/ProfileActivator.java
new file mode 100644
index 00000000..0547e742
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/ProfileActivator.java
@@ -0,0 +1,59 @@
+package org.apache.maven.model.profile.activation;
+
+/*
+ * 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.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.profile.ProfileActivationContext;
+
+/**
+ * Determines whether a profile should be activated.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProfileActivator
+{
+
+ /**
+ * Determines whether the specified profile is active in the given activator context.
+ *
+ * @param profile The profile whose activation status should be determined, must not be {@code null}.
+ * @param context The environmental context used to determine the activation status of the profile, must not be
+ * {@code null}.
+ * @param problems The container used to collect problems (e.g. bad syntax) that were encountered, must not be
+ * {@code null}.
+ * @return {@code true} if the profile is active, {@code false} otherwise.
+ */
+ boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems );
+
+ /**
+ * Determines whether specified activation method is present in configuration or not. It should help to have AND
+ * between activation conditions
+ * Need for solving http://jira.codehaus.org/browse/MNG-4565
+ * @param profile The profile whose activation status should be determined, must not be {@code null}.
+ * @param context The environmental context used to determine the activation status of the profile, must not be
+ * {@code null}.
+ * @param problems The container used to collect problems (e.g. bad syntax) that were encountered, must not be
+ * {@code null}.
+ * @return {@code true} if the profile is active, {@code false} otherwise.
+ */
+ boolean presentInConfig( Profile profile, ProfileActivationContext context, ModelProblemCollector problems );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java
new file mode 100644
index 00000000..ba7886f0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/PropertyProfileActivator.java
@@ -0,0 +1,126 @@
+package org.apache.maven.model.profile.activation;
+
+/*
+ * 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.model.Activation;
+import org.apache.maven.model.ActivationProperty;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.profile.ProfileActivationContext;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Determines profile activation based on the existence or value of some execution property.
+ *
+ * @author Benjamin Bentmann
+ * @see ActivationProperty
+ */
+@Component( role = ProfileActivator.class, hint = "property" )
+public class PropertyProfileActivator
+ implements ProfileActivator
+{
+
+ @Override
+ public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationProperty property = activation.getProperty();
+
+ if ( property == null )
+ {
+ return false;
+ }
+
+ String name = property.getName();
+ boolean reverseName = false;
+
+ if ( name != null && name.startsWith( "!" ) )
+ {
+ reverseName = true;
+ name = name.substring( 1 );
+ }
+
+ if ( name == null || name.length() <= 0 )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "The property name is required to activate the profile " + profile.getId() )
+ .setLocation( property.getLocation( "" ) ) );
+ return false;
+ }
+
+ String sysValue = context.getUserProperties().get( name );
+ if ( sysValue == null )
+ {
+ sysValue = context.getSystemProperties().get( name );
+ }
+
+ String propValue = property.getValue();
+ if ( StringUtils.isNotEmpty( propValue ) )
+ {
+ boolean reverseValue = false;
+ if ( propValue.startsWith( "!" ) )
+ {
+ reverseValue = true;
+ propValue = propValue.substring( 1 );
+ }
+
+ // we have a value, so it has to match the system value...
+ boolean result = propValue.equals( sysValue );
+
+ return reverseValue ? !result : result;
+ }
+ else
+ {
+ boolean result = StringUtils.isNotEmpty( sysValue );
+
+ return reverseName ? !result : result;
+ }
+ }
+
+ @Override
+ public boolean presentInConfig( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
+ {
+ Activation activation = profile.getActivation();
+
+ if ( activation == null )
+ {
+ return false;
+ }
+
+ ActivationProperty property = activation.getProperty();
+
+ if ( property == null )
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/InvalidRepositoryException.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/InvalidRepositoryException.java
new file mode 100644
index 00000000..303aff08
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/InvalidRepositoryException.java
@@ -0,0 +1,73 @@
+package org.apache.maven.model.resolution;
+
+/*
+ * 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.model.Repository;
+
+/**
+ * Signals an error when adding a repository to the model resolver.
+ *
+ * @author Benjamin Bentmann
+ */
+public class InvalidRepositoryException
+ extends Exception
+{
+
+ /**
+ * The repository that raised this error, can be {@code null}.
+ */
+ private Repository repository;
+
+ /**
+ * Creates a new exception with specified detail message and cause for the given repository.
+ *
+ * @param message The detail message, may be {@code null}.
+ * @param repository The repository that caused the error, may be {@code null}.
+ * @param cause The cause, may be {@code null}.
+ */
+ public InvalidRepositoryException( String message, Repository repository, Throwable cause )
+ {
+ super( message, cause );
+ this.repository = repository;
+ }
+
+ /**
+ * Creates a new exception with specified detail message for the given repository.
+ *
+ * @param message The detail message, may be {@code null}.
+ * @param repository The repository that caused the error, may be {@code null}.
+ */
+ public InvalidRepositoryException( String message, Repository repository )
+ {
+ super( message );
+ this.repository = repository;
+ }
+
+ /**
+ * Gets the repository that causes this error (if any).
+ *
+ * @return The repository that causes this error or {@code null} if not known.
+ */
+ public Repository getRepository()
+ {
+ return repository;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java
new file mode 100644
index 00000000..c81a5369
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java
@@ -0,0 +1,93 @@
+package org.apache.maven.model.resolution;
+
+/*
+ * 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.model.Parent;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.building.ModelSource;
+
+/**
+ * Resolves a POM from its coordinates. During the build process, the
+ * {@link org.apache.maven.model.building.ModelBuilder} will add any relevant repositories to the model resolver. In
+ * other words, the model resolver is stateful and should not be reused across multiple model building requests.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ModelResolver
+{
+
+ /**
+ * Tries to resolve the POM for the specified coordinates.
+ *
+ * @param groupId The group identifier of the POM, must not be {@code null}.
+ * @param artifactId The artifact identifier of the POM, must not be {@code null}.
+ * @param version The version of the POM, must not be {@code null}.
+ * @return The source of the requested POM, never {@code null}.
+ * @throws UnresolvableModelException If the POM could not be resolved from any configured repository.
+ */
+ ModelSource resolveModel( String groupId, String artifactId, String version )
+ throws UnresolvableModelException;
+
+ /**
+ * Tries to resolve the POM for the specified parent coordinates possibly updating {@code parent}.
+ *
+ * @param parent The parent coordinates to resolve, must not be {@code null}.
+ * @return The source of the requested POM, never {@code null}.
+ * @throws UnresolvableModelException If the POM could not be resolved from any configured repository.
+ * @since 3.2.2
+ */
+ ModelSource resolveModel( Parent parent )
+ throws UnresolvableModelException;
+
+ /**
+ * Adds a repository to use for subsequent resolution requests. The order in which repositories are added matters,
+ * repositories that were added first should also be searched first. When multiple repositories with the same
+ * identifier are added, only the first repository being added will be used.
+ *
+ * @param repository The repository to add to the internal search chain, must not be {@code null}.
+ * @throws InvalidRepositoryException If the repository could not be added (e.g. due to invalid URL or layout).
+ */
+ void addRepository( Repository repository )
+ throws InvalidRepositoryException;
+
+ /**
+ * Adds a repository to use for subsequent resolution requests. The order in which repositories are added matters,
+ * repositories that were added first should also be searched first. When multiple repositories with the same
+ * identifier are added, then the value of the replace argument is determines the behaviour.
+ *
+ * If replace is false than any existing repository with the same Id will remain in use. If replace
+ * is true the new repository replaces the original.
+ *
+ * @param repository The repository to add to the internal search chain, must not be {@code null}.
+ * @throws InvalidRepositoryException If the repository could not be added (e.g. due to invalid URL or layout).
+ */
+ void addRepository( Repository repository, boolean replace )
+ throws InvalidRepositoryException;
+
+ /**
+ * Clones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep
+ * clone. The only requirement is that invocations of {@link #addRepository(Repository)} on the clone do not affect
+ * the state of the original resolver and vice versa.
+ *
+ * @return The cloned resolver, never {@code null}.
+ */
+ ModelResolver newCopy();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java
new file mode 100644
index 00000000..bdb623ac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/UnresolvableModelException.java
@@ -0,0 +1,126 @@
+package org.apache.maven.model.resolution;
+
+/*
+ * 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.
+ */
+
+/**
+ * Signals an error when resolving the path to an external model.
+ *
+ * @author Benjamin Bentmann
+ */
+public class UnresolvableModelException
+ extends Exception
+{
+
+ /**
+ * The group id of the unresolvable model.
+ */
+ private final String groupId;
+
+ /**
+ * The artifact id of the unresolvable model.
+ */
+ private final String artifactId;
+
+ /**
+ * The version of the unresolvable model.
+ */
+ private final String version;
+
+ /**
+ * Creates a new exception with specified detail message and cause.
+ *
+ * @param message The detail message, may be {@code null}.
+ * @param groupId The group id of the unresolvable model, may be {@code null}.
+ * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
+ * @param version The version of the unresolvable model, may be {@code null}.
+ * @param cause The cause, may be {@code null}.
+ */
+ public UnresolvableModelException( String message, String groupId, String artifactId, String version,
+ Throwable cause )
+ {
+ super( message, cause );
+ this.groupId = ( groupId != null ) ? groupId : "";
+ this.artifactId = ( artifactId != null ) ? artifactId : "";
+ this.version = ( version != null ) ? version : "";
+ }
+
+ /**
+ * Creates a new exception with specified detail message.
+ *
+ * @param message The detail message, may be {@code null}.
+ * @param groupId The group id of the unresolvable model, may be {@code null}.
+ * @param artifactId The artifact id of the unresolvable model, may be {@code null}.
+ * @param version The version of the unresolvable model, may be {@code null}.
+ */
+ public UnresolvableModelException( String message, String groupId, String artifactId, String version )
+ {
+ super( message );
+ this.groupId = ( groupId != null ) ? groupId : "";
+ this.artifactId = ( artifactId != null ) ? artifactId : "";
+ this.version = ( version != null ) ? version : "";
+ }
+
+ /**
+ * Creates a new exception with specified cause
+ *
+ * @param cause
+ * @param groupId
+ * @param artifactId
+ * @param version
+ */
+ public UnresolvableModelException( Throwable cause, String groupId, String artifactId, String version )
+ {
+ super( cause );
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.version = version;
+ }
+
+ /**
+ * Gets the group id of the unresolvable model.
+ *
+ * @return The group id of the unresolvable model, can be empty but never {@code null}.
+ */
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ /**
+ * Gets the artifact id of the unresolvable model.
+ *
+ * @return The artifact id of the unresolvable model, can be empty but never {@code null}.
+ */
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ /**
+ * Gets the version of the unresolvable model.
+ *
+ * @return The version of the unresolvable model, can be empty but never {@code null}.
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/WorkspaceModelResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/WorkspaceModelResolver.java
new file mode 100644
index 00000000..d12edea7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/resolution/WorkspaceModelResolver.java
@@ -0,0 +1,33 @@
+package org.apache.maven.model.resolution;
+
+/*
+ * 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.model.Model;
+
+public interface WorkspaceModelResolver
+{
+
+ Model resolveRawModel( String groupId, String artifactId, String versionConstraint )
+ throws UnresolvableModelException;
+
+ Model resolveEffectiveModel( String groupId, String artifactId, String versionConstraint )
+ throws UnresolvableModelException;
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
new file mode 100644
index 00000000..7d4f66a8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
@@ -0,0 +1,87 @@
+package org.apache.maven.model.superpom;
+
+/*
+ * 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;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.ModelProcessor;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Provides the super POM that all models implicitly inherit from.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = SuperPomProvider.class )
+public class DefaultSuperPomProvider
+ implements SuperPomProvider
+{
+
+ /**
+ * The cached super POM, lazily created.
+ */
+ private Model superModel;
+
+ @Requirement
+ private ModelProcessor modelProcessor;
+
+ public DefaultSuperPomProvider setModelProcessor( ModelProcessor modelProcessor )
+ {
+ this.modelProcessor = modelProcessor;
+ return this;
+ }
+
+ @Override
+ public Model getSuperModel( String version )
+ {
+ if ( superModel == null )
+ {
+ String resource = "/org/apache/maven/model/pom-" + version + ".xml";
+
+ InputStream is = getClass().getResourceAsStream( resource );
+
+ if ( is == null )
+ {
+ throw new IllegalStateException( "The super POM " + resource + " was not found"
+ + ", please verify the integrity of your Maven installation" );
+ }
+
+ try
+ {
+ Map<String, String> options = new HashMap<String, String>();
+ options.put( "xml:4.0.0", "xml:4.0.0" );
+ superModel = modelProcessor.read( is, options );
+ }
+ catch ( IOException e )
+ {
+ throw new IllegalStateException( "The super POM " + resource + " is damaged"
+ + ", please verify the integrity of your Maven installation", e );
+ }
+ }
+
+ return superModel;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/SuperPomProvider.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/SuperPomProvider.java
new file mode 100644
index 00000000..3f44fb7e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/superpom/SuperPomProvider.java
@@ -0,0 +1,42 @@
+package org.apache.maven.model.superpom;
+
+/*
+ * 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.model.Model;
+
+/**
+ * Provides the super POM that all models implicitly inherit from.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface SuperPomProvider
+{
+
+ /**
+ * Gets the super POM for the specified model version. The returned model is supposed to be read-only, i.e. if the
+ * caller intends to make updates to the model the return value must be cloned before updating to ensure the
+ * modifications don't affect future retrievals of the super POM.
+ *
+ * @param version The model version to retrieve the super POM for (e.g. "4.0.0"), must not be {@code null}.
+ * @return The super POM, never {@code null}.
+ */
+ Model getSuperModel( String version );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
new file mode 100644
index 00000000..dd7bd4e2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
@@ -0,0 +1,1076 @@
+package org.apache.maven.model.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.io.File;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+import org.apache.maven.model.Activation;
+import org.apache.maven.model.ActivationFile;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.BuildBase;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.InputLocationTracker;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.Reporting;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollector;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ */
+@Component( role = ModelValidator.class )
+public class DefaultModelValidator
+ implements ModelValidator
+{
+
+ private static final Pattern ID_REGEX = Pattern.compile( "[A-Za-z0-9_\\-.]+" );
+
+ private static final Pattern ID_WITH_WILDCARDS_REGEX = Pattern.compile( "[A-Za-z0-9_\\-.?*]+" );
+
+ private static final String ILLEGAL_FS_CHARS = "\\/:\"<>|?*";
+
+ private static final String ILLEGAL_VERSION_CHARS = ILLEGAL_FS_CHARS;
+
+ private static final String ILLEGAL_REPO_ID_CHARS = ILLEGAL_FS_CHARS;
+
+ @Override
+ public void validateRawModel( Model m, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ Parent parent = m.getParent();
+ if ( parent != null )
+ {
+ validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(),
+ parent );
+
+ validateStringNotEmpty( "parent.artifactId", problems, Severity.FATAL, Version.BASE,
+ parent.getArtifactId(), parent );
+
+ validateStringNotEmpty( "parent.version", problems, Severity.FATAL, Version.BASE, parent.getVersion(),
+ parent );
+
+ if ( equals( parent.getGroupId(), m.getGroupId() )
+ && equals( parent.getArtifactId(), m.getArtifactId() ) )
+ {
+ addViolation( problems, Severity.FATAL, Version.BASE, "parent.artifactId", null, "must be changed"
+ + ", the parent element cannot have the same groupId:artifactId as the project.", parent );
+ }
+ }
+
+ if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
+ "4.0.0" );
+
+ validateStringNoExpression( "groupId", problems, Severity.WARNING, Version.V20, m.getGroupId(), m );
+ if ( parent == null )
+ {
+ validateStringNotEmpty( "groupId", problems, Severity.FATAL, Version.V20, m.getGroupId(), m );
+ }
+
+ validateStringNoExpression( "artifactId", problems, Severity.WARNING, Version.V20, m.getArtifactId(), m );
+ validateStringNotEmpty( "artifactId", problems, Severity.FATAL, Version.V20, m.getArtifactId(), m );
+
+ validateVersionNoExpression( "version", problems, Severity.WARNING, Version.V20, m.getVersion(), m );
+ if ( parent == null )
+ {
+ validateStringNotEmpty( "version", problems, Severity.FATAL, Version.V20, m.getVersion(), m );
+ }
+
+ validate20RawDependencies( problems, m.getDependencies(), "dependencies.dependency", request );
+
+ if ( m.getDependencyManagement() != null )
+ {
+ validate20RawDependencies( problems, m.getDependencyManagement().getDependencies(),
+ "dependencyManagement.dependencies.dependency", request );
+ }
+
+ validateRawRepositories( problems, m.getRepositories(), "repositories.repository", request );
+
+ validateRawRepositories( problems, m.getPluginRepositories(), "pluginRepositories.pluginRepository",
+ request );
+
+ Build build = m.getBuild();
+ if ( build != null )
+ {
+ validate20RawPlugins( problems, build.getPlugins(), "build.plugins.plugin", request );
+
+ PluginManagement mngt = build.getPluginManagement();
+ if ( mngt != null )
+ {
+ validate20RawPlugins( problems, mngt.getPlugins(), "build.pluginManagement.plugins.plugin",
+ request );
+ }
+ }
+
+ Set<String> profileIds = new HashSet<String>();
+
+ for ( Profile profile : m.getProfiles() )
+ {
+ String prefix = "profiles.profile[" + profile.getId() + "]";
+
+ if ( !profileIds.add( profile.getId() ) )
+ {
+ addViolation( problems, errOn30, Version.V20, "profiles.profile.id", null,
+ "must be unique but found duplicate profile with id " + profile.getId(), profile );
+ }
+
+ validate30RawProfileActivation( problems, profile.getActivation(), profile.getId(), prefix
+ + ".activation", request );
+
+ validate20RawDependencies( problems, profile.getDependencies(), prefix + ".dependencies.dependency",
+ request );
+
+ if ( profile.getDependencyManagement() != null )
+ {
+ validate20RawDependencies( problems, profile.getDependencyManagement().getDependencies(), prefix
+ + ".dependencyManagement.dependencies.dependency", request );
+ }
+
+ validateRawRepositories( problems, profile.getRepositories(), prefix + ".repositories.repository",
+ request );
+
+ validateRawRepositories( problems, profile.getPluginRepositories(), prefix
+ + ".pluginRepositories.pluginRepository", request );
+
+ BuildBase buildBase = profile.getBuild();
+ if ( buildBase != null )
+ {
+ validate20RawPlugins( problems, buildBase.getPlugins(), prefix + ".plugins.plugin", request );
+
+ PluginManagement mngt = buildBase.getPluginManagement();
+ if ( mngt != null )
+ {
+ validate20RawPlugins( problems, mngt.getPlugins(), prefix + ".pluginManagement.plugins.plugin",
+ request );
+ }
+ }
+ }
+ }
+ }
+
+ private void validate30RawProfileActivation( ModelProblemCollector problems, Activation activation,
+ String sourceHint, String prefix, ModelBuildingRequest request )
+ {
+ if ( activation == null )
+ {
+ return;
+ }
+
+ ActivationFile file = activation.getFile();
+
+ if ( file != null )
+ {
+ String path;
+ boolean missing;
+
+ if ( StringUtils.isNotEmpty( file.getExists() ) )
+ {
+ path = file.getExists();
+ missing = false;
+ }
+ else if ( StringUtils.isNotEmpty( file.getMissing() ) )
+ {
+ path = file.getMissing();
+ missing = true;
+ }
+ else
+ {
+ return;
+ }
+
+ if ( path.contains( "${project.basedir}" ) )
+ {
+ addViolation( problems,
+ Severity.WARNING,
+ Version.V30,
+ prefix + ( missing ? ".file.missing" : ".file.exists" ),
+ null,
+ "Failed to interpolate file location " + path + " for profile " + sourceHint
+ + ": ${project.basedir} expression not supported during profile activation, "
+ + "use ${basedir} instead",
+ file.getLocation( missing ? "missing" : "exists" ) );
+ }
+ else if ( hasProjectExpression( path ) )
+ {
+ addViolation( problems,
+ Severity.WARNING,
+ Version.V30,
+ prefix + ( missing ? ".file.missing" : ".file.exists" ),
+ null,
+ "Failed to interpolate file location "
+ + path
+ + " for profile "
+ + sourceHint
+ + ": ${project.*} expressions are not supported during profile activation",
+ file.getLocation( missing ? "missing" : "exists" ) );
+ }
+ }
+ }
+
+ private void validate20RawPlugins( ModelProblemCollector problems, List<Plugin> plugins, String prefix,
+ ModelBuildingRequest request )
+ {
+ Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+
+ Map<String, Plugin> index = new HashMap<String, Plugin>();
+
+ for ( Plugin plugin : plugins )
+ {
+ String key = plugin.getKey();
+
+ Plugin existing = index.get( key );
+
+ if ( existing != null )
+ {
+ addViolation( problems, errOn31, Version.V20, prefix + ".(groupId:artifactId)", null,
+ "must be unique but found duplicate declaration of plugin " + key, plugin );
+ }
+ else
+ {
+ index.put( key, plugin );
+ }
+
+ Set<String> executionIds = new HashSet<String>();
+
+ for ( PluginExecution exec : plugin.getExecutions() )
+ {
+ if ( !executionIds.add( exec.getId() ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.V20, prefix + "[" + plugin.getKey()
+ + "].executions.execution.id", null, "must be unique but found duplicate execution with id "
+ + exec.getId(), exec );
+ }
+ }
+ }
+ }
+
+ @Override
+ public void validateEffectiveModel( Model m, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ validateStringNotEmpty( "modelVersion", problems, Severity.ERROR, Version.BASE, m.getModelVersion(), m );
+
+ validateId( "groupId", problems, m.getGroupId(), m );
+
+ validateId( "artifactId", problems, m.getArtifactId(), m );
+
+ validateStringNotEmpty( "packaging", problems, Severity.ERROR, Version.BASE, m.getPackaging(), m );
+
+ if ( !m.getModules().isEmpty() )
+ {
+ if ( !"pom".equals( m.getPackaging() ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.BASE, "packaging", null,
+ "with value '" + m.getPackaging() + "' is invalid. Aggregator projects "
+ + "require 'pom' as packaging.", m );
+ }
+
+ for ( int i = 0, n = m.getModules().size(); i < n; i++ )
+ {
+ String module = m.getModules().get( i );
+ if ( StringUtils.isBlank( module ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.BASE, "modules.module[" + i + "]", null,
+ "has been specified without a path to the project directory.",
+ m.getLocation( "modules" ) );
+ }
+ }
+ }
+
+ validateStringNotEmpty( "version", problems, Severity.ERROR, Version.BASE, m.getVersion(), m );
+
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ validateEffectiveDependencies( problems, m.getDependencies(), false, request );
+
+ DependencyManagement mgmt = m.getDependencyManagement();
+ if ( mgmt != null )
+ {
+ validateEffectiveDependencies( problems, mgmt.getDependencies(), true, request );
+ }
+
+ if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ Set<String> modules = new HashSet<String>();
+ for ( int i = 0, n = m.getModules().size(); i < n; i++ )
+ {
+ String module = m.getModules().get( i );
+ if ( !modules.add( module ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.V20, "modules.module[" + i + "]", null,
+ "specifies duplicate child module " + module, m.getLocation( "modules" ) );
+ }
+ }
+
+ Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+
+ validateBannedCharacters( "version", problems, errOn31, Version.V20, m.getVersion(), null, m,
+ ILLEGAL_VERSION_CHARS );
+ validate20ProperSnapshotVersion( "version", problems, errOn31, Version.V20, m.getVersion(), null, m );
+
+ Build build = m.getBuild();
+ if ( build != null )
+ {
+ for ( Plugin p : build.getPlugins() )
+ {
+ validateStringNotEmpty( "build.plugins.plugin.artifactId", problems, Severity.ERROR, Version.V20,
+ p.getArtifactId(), p );
+
+ validateStringNotEmpty( "build.plugins.plugin.groupId", problems, Severity.ERROR, Version.V20,
+ p.getGroupId(), p );
+
+ validate20PluginVersion( "build.plugins.plugin.version", problems, p.getVersion(), p.getKey(), p,
+ request );
+
+ validateBoolean( "build.plugins.plugin.inherited", problems, errOn30, Version.V20,
+ p.getInherited(), p.getKey(), p );
+
+ validateBoolean( "build.plugins.plugin.extensions", problems, errOn30, Version.V20,
+ p.getExtensions(), p.getKey(), p );
+
+ validate20EffectivePluginDependencies( problems, p, request );
+ }
+
+ validate20RawResources( problems, build.getResources(), "build.resources.resource", request );
+
+ validate20RawResources( problems, build.getTestResources(), "build.testResources.testResource",
+ request );
+ }
+
+ Reporting reporting = m.getReporting();
+ if ( reporting != null )
+ {
+ for ( ReportPlugin p : reporting.getPlugins() )
+ {
+ validateStringNotEmpty( "reporting.plugins.plugin.artifactId", problems, Severity.ERROR,
+ Version.V20, p.getArtifactId(), p );
+
+ validateStringNotEmpty( "reporting.plugins.plugin.groupId", problems, Severity.ERROR, Version.V20,
+ p.getGroupId(), p );
+ }
+ }
+
+ for ( Repository repository : m.getRepositories() )
+ {
+ validate20EffectiveRepository( problems, repository, "repositories.repository", request );
+ }
+
+ for ( Repository repository : m.getPluginRepositories() )
+ {
+ validate20EffectiveRepository( problems, repository, "pluginRepositories.pluginRepository", request );
+ }
+
+ DistributionManagement distMgmt = m.getDistributionManagement();
+ if ( distMgmt != null )
+ {
+ if ( distMgmt.getStatus() != null )
+ {
+ addViolation( problems, Severity.ERROR, Version.V20, "distributionManagement.status", null,
+ "must not be specified.", distMgmt );
+ }
+
+ validate20EffectiveRepository( problems, distMgmt.getRepository(), "distributionManagement.repository",
+ request );
+ validate20EffectiveRepository( problems, distMgmt.getSnapshotRepository(),
+ "distributionManagement.snapshotRepository", request );
+ }
+ }
+ }
+
+ private void validate20RawDependencies( ModelProblemCollector problems, List<Dependency> dependencies,
+ String prefix, ModelBuildingRequest request )
+ {
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+ Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+
+ Map<String, Dependency> index = new HashMap<String, Dependency>();
+
+ for ( Dependency dependency : dependencies )
+ {
+ String key = dependency.getManagementKey();
+
+ if ( "import".equals( dependency.getScope() ) )
+ {
+ if ( !"pom".equals( dependency.getType() ) )
+ {
+ addViolation( problems, Severity.WARNING, Version.V20, prefix + ".type", key,
+ "must be 'pom' to import the managed dependencies.", dependency );
+ }
+ else if ( StringUtils.isNotEmpty( dependency.getClassifier() ) )
+ {
+ addViolation( problems, errOn30, Version.V20, prefix + ".classifier", key,
+ "must be empty, imported POM cannot have a classifier.", dependency );
+ }
+ }
+ else if ( "system".equals( dependency.getScope() ) )
+ {
+ String sysPath = dependency.getSystemPath();
+ if ( StringUtils.isNotEmpty( sysPath ) )
+ {
+ if ( !hasExpression( sysPath ) )
+ {
+ addViolation( problems, Severity.WARNING, Version.V20, prefix + ".systemPath", key,
+ "should use a variable instead of a hard-coded path " + sysPath, dependency );
+ }
+ else if ( sysPath.contains( "${basedir}" ) || sysPath.contains( "${project.basedir}" ) )
+ {
+ addViolation( problems, Severity.WARNING, Version.V20, prefix + ".systemPath", key,
+ "should not point at files within the project directory, " + sysPath
+ + " will be unresolvable by dependent projects", dependency );
+ }
+ }
+ }
+
+ Dependency existing = index.get( key );
+
+ if ( existing != null )
+ {
+ String msg;
+ if ( equals( existing.getVersion(), dependency.getVersion() ) )
+ {
+ msg =
+ "duplicate declaration of version "
+ + StringUtils.defaultString( dependency.getVersion(), "(?)" );
+ }
+ else
+ {
+ msg =
+ "version " + StringUtils.defaultString( existing.getVersion(), "(?)" ) + " vs "
+ + StringUtils.defaultString( dependency.getVersion(), "(?)" );
+ }
+
+ addViolation( problems, errOn31, Version.V20, prefix + ".(groupId:artifactId:type:classifier)", null,
+ "must be unique: " + key + " -> " + msg, dependency );
+ }
+ else
+ {
+ index.put( key, dependency );
+ }
+ }
+ }
+
+ private void validateEffectiveDependencies( ModelProblemCollector problems, List<Dependency> dependencies,
+ boolean management, ModelBuildingRequest request )
+ {
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ String prefix = management ? "dependencyManagement.dependencies.dependency." : "dependencies.dependency.";
+
+ for ( Dependency d : dependencies )
+ {
+ validateEffectiveDependency( problems, d, management, prefix, request );
+
+ if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ validateBoolean( prefix + "optional", problems, errOn30, Version.V20, d.getOptional(),
+ d.getManagementKey(), d );
+
+ if ( !management )
+ {
+ validateVersion( prefix + "version", problems, errOn30, Version.V20, d.getVersion(),
+ d.getManagementKey(), d );
+
+ /*
+ * TODO: Extensions like Flex Mojos use custom scopes like "merged", "internal", "external", etc.
+ * In order to don't break backward-compat with those, only warn but don't error out.
+ */
+ validateEnum( prefix + "scope", problems, Severity.WARNING, Version.V20, d.getScope(),
+ d.getManagementKey(), d, "provided", "compile", "runtime", "test", "system" );
+ }
+ }
+ }
+ }
+
+ private void validate20EffectivePluginDependencies( ModelProblemCollector problems, Plugin plugin,
+ ModelBuildingRequest request )
+ {
+ List<Dependency> dependencies = plugin.getDependencies();
+
+ if ( !dependencies.isEmpty() )
+ {
+ String prefix = "build.plugins.plugin[" + plugin.getKey() + "].dependencies.dependency.";
+
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ for ( Dependency d : dependencies )
+ {
+ validateEffectiveDependency( problems, d, false, prefix, request );
+
+ validateVersion( prefix + "version", problems, errOn30, Version.BASE, d.getVersion(),
+ d.getManagementKey(), d );
+
+ validateEnum( prefix + "scope", problems, errOn30, Version.BASE, d.getScope(), d.getManagementKey(), d,
+ "compile", "runtime", "system" );
+ }
+ }
+ }
+
+ private void validateEffectiveDependency( ModelProblemCollector problems, Dependency d, boolean management,
+ String prefix, ModelBuildingRequest request )
+ {
+ validateId( prefix + "artifactId", problems, Severity.ERROR, Version.BASE, d.getArtifactId(),
+ d.getManagementKey(), d );
+
+ validateId( prefix + "groupId", problems, Severity.ERROR, Version.BASE, d.getGroupId(), d.getManagementKey(),
+ d );
+
+ if ( !management )
+ {
+ validateStringNotEmpty( prefix + "type", problems, Severity.ERROR, Version.BASE, d.getType(),
+ d.getManagementKey(), d );
+
+ validateDependencyVersion( problems, d, prefix );
+ }
+
+ if ( "system".equals( d.getScope() ) )
+ {
+ String systemPath = d.getSystemPath();
+
+ if ( StringUtils.isEmpty( systemPath ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.BASE, prefix + "systemPath", d.getManagementKey(),
+ "is missing.", d );
+ }
+ else
+ {
+ File sysFile = new File( systemPath );
+ if ( !sysFile.isAbsolute() )
+ {
+ addViolation( problems, Severity.ERROR, Version.BASE, prefix + "systemPath", d.getManagementKey(),
+ "must specify an absolute path but is " + systemPath, d );
+ }
+ else if ( !sysFile.isFile() )
+ {
+ String msg = "refers to a non-existing file " + sysFile.getAbsolutePath();
+ systemPath = systemPath.replace( '/', File.separatorChar ).replace( '\\', File.separatorChar );
+ String jdkHome =
+ request.getSystemProperties().getProperty( "java.home", "" ) + File.separator + "..";
+ if ( systemPath.startsWith( jdkHome ) )
+ {
+ msg += ". Please verify that you run Maven using a JDK and not just a JRE.";
+ }
+ addViolation( problems, Severity.WARNING, Version.BASE, prefix + "systemPath",
+ d.getManagementKey(), msg, d );
+ }
+ }
+ }
+ else if ( StringUtils.isNotEmpty( d.getSystemPath() ) )
+ {
+ addViolation( problems, Severity.ERROR, Version.BASE, prefix + "systemPath", d.getManagementKey(),
+ "must be omitted." + " This field may only be specified for a dependency with system scope.",
+ d );
+ }
+
+ if ( request.getValidationLevel() >= ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
+ {
+ for ( Exclusion exclusion : d.getExclusions() )
+ {
+ if ( request.getValidationLevel() < ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 )
+ {
+ validateId( prefix + "exclusions.exclusion.groupId", problems, Severity.WARNING, Version.V20,
+ exclusion.getGroupId(), d.getManagementKey(), exclusion );
+
+ validateId( prefix + "exclusions.exclusion.artifactId", problems, Severity.WARNING, Version.V20,
+ exclusion.getArtifactId(), d.getManagementKey(), exclusion );
+ }
+ else
+ {
+ validateIdWithWildcards( prefix + "exclusions.exclusion.groupId", problems, Severity.WARNING,
+ Version.V30, exclusion.getGroupId(), d.getManagementKey(), exclusion );
+
+ validateIdWithWildcards( prefix + "exclusions.exclusion.artifactId", problems, Severity.WARNING,
+ Version.V30, exclusion.getArtifactId(), d.getManagementKey(), exclusion );
+ }
+ }
+ }
+ }
+
+ /**
+ * @since 3.2.4
+ */
+ protected void validateDependencyVersion( ModelProblemCollector problems, Dependency d, String prefix )
+ {
+ validateStringNotEmpty( prefix + "version", problems, Severity.ERROR, Version.BASE, d.getVersion(),
+ d.getManagementKey(), d );
+ }
+
+ private void validateRawRepositories( ModelProblemCollector problems, List<Repository> repositories, String prefix,
+ ModelBuildingRequest request )
+ {
+ Map<String, Repository> index = new HashMap<String, Repository>();
+
+ for ( Repository repository : repositories )
+ {
+ validateStringNotEmpty( prefix + ".id", problems, Severity.ERROR, Version.V20, repository.getId(),
+ repository );
+
+ validateStringNotEmpty( prefix + "[" + repository.getId() + "].url", problems, Severity.ERROR, Version.V20,
+ repository.getUrl(), repository );
+
+ String key = repository.getId();
+
+ Repository existing = index.get( key );
+
+ if ( existing != null )
+ {
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ addViolation( problems, errOn30, Version.V20, prefix + ".id", null,
+ "must be unique: " + repository.getId() + " -> " + existing.getUrl() + " vs "
+ + repository.getUrl(), repository );
+ }
+ else
+ {
+ index.put( key, repository );
+ }
+ }
+ }
+
+ private void validate20EffectiveRepository( ModelProblemCollector problems, Repository repository, String prefix,
+ ModelBuildingRequest request )
+ {
+ if ( repository != null )
+ {
+ Severity errOn31 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1 );
+
+ validateBannedCharacters( prefix + ".id", problems, errOn31, Version.V20, repository.getId(), null,
+ repository, ILLEGAL_REPO_ID_CHARS );
+
+ if ( "local".equals( repository.getId() ) )
+ {
+ addViolation( problems, errOn31, Version.V20, 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.", repository );
+ }
+
+ if ( "legacy".equals( repository.getLayout() ) )
+ {
+ addViolation( problems, Severity.WARNING, Version.V20, prefix + ".layout", repository.getId(),
+ "uses the unsupported value 'legacy', artifact resolution might fail.", repository );
+ }
+ }
+ }
+
+ private void validate20RawResources( ModelProblemCollector problems, List<Resource> resources, String prefix,
+ ModelBuildingRequest request )
+ {
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ for ( Resource resource : resources )
+ {
+ validateStringNotEmpty( prefix + ".directory", problems, Severity.ERROR, Version.V20,
+ resource.getDirectory(), resource );
+
+ validateBoolean( prefix + ".filtering", problems, errOn30, Version.V20, resource.getFiltering(),
+ resource.getDirectory(), resource );
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // Field validation
+ // ----------------------------------------------------------------------
+
+ private boolean validateId( String fieldName, ModelProblemCollector problems, String id,
+ InputLocationTracker tracker )
+ {
+ return validateId( fieldName, problems, Severity.ERROR, Version.BASE, id, null, tracker );
+ }
+
+ private boolean validateId( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
+ String id, String sourceHint, InputLocationTracker tracker )
+ {
+ if ( !validateStringNotEmpty( fieldName, problems, severity, version, id, sourceHint, tracker ) )
+ {
+ return false;
+ }
+ else
+ {
+ boolean match = ID_REGEX.matcher( id ).matches();
+ if ( !match )
+ {
+ addViolation( problems, severity, version, fieldName, sourceHint, "with value '" + id
+ + "' does not match a valid id pattern.", tracker );
+ }
+ return match;
+ }
+ }
+
+ private boolean validateIdWithWildcards( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String id, String sourceHint,
+ InputLocationTracker tracker )
+ {
+ if ( !validateStringNotEmpty( fieldName, problems, severity, version, id, sourceHint, tracker ) )
+ {
+ return false;
+ }
+ else
+ {
+ boolean match = ID_WITH_WILDCARDS_REGEX.matcher( id ).matches();
+ if ( !match )
+ {
+ addViolation( problems, severity, version, fieldName, sourceHint, "with value '" + id
+ + "' does not match a valid id pattern.", tracker );
+ }
+ return match;
+ }
+ }
+
+
+ private boolean validateStringNoExpression( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, InputLocationTracker tracker )
+ {
+ if ( !hasExpression( string ) )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.",
+ tracker );
+
+ return false;
+ }
+
+ private boolean validateVersionNoExpression( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, InputLocationTracker tracker )
+ {
+
+ if ( !hasExpression( string ) )
+ {
+ return true;
+ }
+
+ //
+ // Acceptable versions for continuous delivery
+ //
+ // changelist
+ // revision
+ // sha1
+ //
+ if ( string.trim().contains( "${changelist}" ) || string.trim().contains( "${revision}" )
+ || string.trim().contains( "${sha1}" ) )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, null, "contains an expression but should be a constant.",
+ tracker );
+
+ return false;
+ }
+
+ private boolean hasExpression( String value )
+ {
+ return value != null && value.contains( "${" );
+ }
+
+ private boolean hasProjectExpression( String value )
+ {
+ return value != null && value.contains( "${project." );
+ }
+
+ private boolean validateStringNotEmpty( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, InputLocationTracker tracker )
+ {
+ return validateStringNotEmpty( fieldName, problems, severity, version, string, null, tracker );
+ }
+
+ /**
+ * Asserts:
+ * <p/>
+ * <ul>
+ * <li><code>string != null</code>
+ * <li><code>string.length > 0</code>
+ * </ul>
+ */
+ private boolean validateStringNotEmpty( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, String sourceHint,
+ InputLocationTracker tracker )
+ {
+ if ( !validateNotNull( fieldName, problems, severity, version, string, sourceHint, tracker ) )
+ {
+ return false;
+ }
+
+ if ( string.length() > 0 )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, sourceHint, "is missing.", tracker );
+
+ return false;
+ }
+
+ /**
+ * Asserts:
+ * <p/>
+ * <ul>
+ * <li><code>string != null</code>
+ * </ul>
+ */
+ private boolean validateNotNull( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, Object object, String sourceHint, InputLocationTracker tracker )
+ {
+ if ( object != null )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, sourceHint, "is missing.", tracker );
+
+ return false;
+ }
+
+ private boolean validateBoolean( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, String sourceHint, InputLocationTracker tracker )
+ {
+ if ( string == null || string.length() <= 0 )
+ {
+ return true;
+ }
+
+ if ( "true".equalsIgnoreCase( string ) || "false".equalsIgnoreCase( string ) )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, sourceHint, "must be 'true' or 'false' but is '" + string
+ + "'.", tracker );
+
+ return false;
+ }
+
+ private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, Version version,
+ String string, String sourceHint, InputLocationTracker tracker,
+ String... validValues )
+ {
+ if ( string == null || string.length() <= 0 )
+ {
+ return true;
+ }
+
+ List<String> values = Arrays.asList( validValues );
+
+ if ( values.contains( string ) )
+ {
+ return true;
+ }
+
+ addViolation( problems, severity, version, fieldName, sourceHint, "must be one of " + values + " but is '"
+ + string + "'.", tracker );
+
+ return false;
+ }
+
+ private boolean validateBannedCharacters( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, String sourceHint,
+ InputLocationTracker tracker, String banned )
+ {
+ if ( string != null )
+ {
+ for ( int i = string.length() - 1; i >= 0; i-- )
+ {
+ if ( banned.indexOf( string.charAt( i ) ) >= 0 )
+ {
+ addViolation( problems, severity, version, fieldName, sourceHint,
+ "must not contain any of these characters " + banned + " but found "
+ + string.charAt( i ), tracker );
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private boolean validateVersion( String fieldName, ModelProblemCollector problems, Severity severity,
+ Version version, String string, String sourceHint, InputLocationTracker tracker )
+ {
+ if ( string == null || string.length() <= 0 )
+ {
+ return true;
+ }
+
+ if ( hasExpression( string ) )
+ {
+ addViolation( problems, severity, version, fieldName, sourceHint,
+ "must be a valid version but is '" + string + "'.", tracker );
+ return false;
+ }
+
+ return validateBannedCharacters( fieldName, problems, severity, version, string, sourceHint, tracker,
+ ILLEGAL_VERSION_CHARS );
+
+ }
+
+ private boolean validate20ProperSnapshotVersion( String fieldName, ModelProblemCollector problems,
+ Severity severity, Version version, String string,
+ String sourceHint, InputLocationTracker tracker )
+ {
+ if ( string == null || string.length() <= 0 )
+ {
+ return true;
+ }
+
+ if ( string.endsWith( "SNAPSHOT" ) && !string.endsWith( "-SNAPSHOT" ) )
+ {
+ addViolation( problems, severity, version, fieldName, sourceHint,
+ "uses an unsupported snapshot version format, should be '*-SNAPSHOT' instead.", tracker );
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean validate20PluginVersion( String fieldName, ModelProblemCollector problems, String string,
+ String sourceHint, InputLocationTracker tracker,
+ ModelBuildingRequest request )
+ {
+ if ( string == null )
+ {
+ // NOTE: The check for missing plugin versions is handled directly by the model builder
+ return true;
+ }
+
+ Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
+
+ if ( !validateVersion( fieldName, problems, errOn30, Version.V20, string, sourceHint, tracker ) )
+ {
+ return false;
+ }
+
+ if ( string.length() <= 0 || "RELEASE".equals( string ) || "LATEST".equals( string ) )
+ {
+ addViolation( problems, errOn30, Version.V20, fieldName, sourceHint, "must be a valid version but is '"
+ + string + "'.", tracker );
+ return false;
+ }
+
+ return true;
+ }
+
+ private static void addViolation( ModelProblemCollector problems, Severity severity, Version version,
+ String fieldName, String sourceHint, String message,
+ InputLocationTracker tracker )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( '\'' ).append( fieldName ).append( '\'' );
+
+ if ( sourceHint != null )
+ {
+ buffer.append( " for " ).append( sourceHint );
+ }
+
+ buffer.append( ' ' ).append( message );
+
+ problems.add( new ModelProblemCollectorRequest( severity, version )
+ .setMessage( buffer.toString() ).setLocation( getLocation( fieldName, tracker ) ) );
+ }
+
+ private static InputLocation getLocation( String fieldName, InputLocationTracker tracker )
+ {
+ InputLocation location = null;
+
+ if ( tracker != null )
+ {
+ if ( fieldName != null )
+ {
+ Object key = fieldName;
+
+ int idx = fieldName.lastIndexOf( '.' );
+ if ( idx >= 0 )
+ {
+ fieldName = fieldName.substring( idx + 1 );
+ key = fieldName;
+ }
+
+ if ( fieldName.endsWith( "]" ) )
+ {
+ key = fieldName.substring( fieldName.lastIndexOf( '[' ) + 1, fieldName.length() - 1 );
+ try
+ {
+ key = Integer.valueOf( key.toString() );
+ }
+ catch ( NumberFormatException e )
+ {
+ // use key as is
+ }
+ }
+
+ location = tracker.getLocation( key );
+ }
+
+ if ( location == null )
+ {
+ location = tracker.getLocation( "" );
+ }
+ }
+
+ return location;
+ }
+
+ private static boolean equals( String s1, String s2 )
+ {
+ return StringUtils.clean( s1 ).equals( StringUtils.clean( s2 ) );
+ }
+
+ private static Severity getSeverity( ModelBuildingRequest request, int errorThreshold )
+ {
+ return getSeverity( request.getValidationLevel(), errorThreshold );
+ }
+
+ private static Severity getSeverity( int validationLevel, int errorThreshold )
+ {
+ if ( validationLevel < errorThreshold )
+ {
+ return Severity.WARNING;
+ }
+ else
+ {
+ return Severity.ERROR;
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/ModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/ModelValidator.java
new file mode 100644
index 00000000..84e3fadd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-model-builder/src/main/java/org/apache/maven/model/validation/ModelValidator.java
@@ -0,0 +1,54 @@
+package org.apache.maven.model.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.model.Model;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblemCollector;
+
+/**
+ * Checks the model for missing or invalid values.
+ *
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
+ */
+public interface ModelValidator
+{
+
+ /**
+ * Checks the specified (raw) model for missing or invalid values. The raw model is directly created from the POM
+ * file and has not been subjected to inheritance, interpolation or profile/default injection.
+ *
+ * @param model The model to validate, must not be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void validateRawModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+ /**
+ * Checks the specified (effective) model for missing or invalid values. The effective model is fully assembled and
+ * has undergone inheritance, interpolation and other model operations.
+ *
+ * @param model The model to validate, must not be {@code null}.
+ * @param request The model building request that holds further settings, must not be {@code null}.
+ * @param problems The container used to collect problems that were encountered, must not be {@code null}.
+ */
+ void validateEffectiveModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems );
+
+}