aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java')
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java77
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManager.java51
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java34
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildAbort.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildFailureException.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java112
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultMaven.java521
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java217
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java61
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/InternalErrorException.java36
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/Maven.java34
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MavenExecutionException.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MissingModuleException.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java95
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ReactorReader.java255
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java362
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/SessionScoped.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/DependencyResolutionRequiredException.java35
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java160
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java134
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java37
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java73
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java33
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java52
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java134
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java435
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java412
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryRequest.java95
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java112
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java255
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java129
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java92
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java61
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java110
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataParseException.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java329
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java358
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java89
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java31
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java109
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java251
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AbstractScopeArtifactFilter.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilter.java99
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/CumulativeScopeArtifactFilter.java122
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionSetFilter.java86
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/IncludesArtifactFilter.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java785
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ArtifactClassRealmConstituent.java76
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmConstituent.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManager.java88
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManagerDelegate.java36
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmRequest.java100
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java416
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmRequest.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BasedirBeanConfigurationPathTranslator.java71
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationException.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationPathTranslator.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationRequest.java130
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationValuePreprocessor.java45
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurator.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java195
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java160
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/AbstractEventSpy.java45
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/EventSpy.java77
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyDispatcher.java158
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyExecutionListener.java163
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyRepositoryListener.java176
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java336
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java30
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java79
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java116
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java61
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSuccess.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSummary.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java1299
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java318
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java109
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java92
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java66
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java443
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulationException.java43
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulator.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java70
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java438
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionEvent.java86
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionEvent.java90
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java199
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/SettingsAdapter.java126
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/MojoExecutionScoped.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScope.java190
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeCoreModule.java45
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java56
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExports.java75
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExportsProvider.java53
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExtensionEntry.java141
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java488
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java134
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java111
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/GraphBuilder.java31
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java271
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java141
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java177
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java144
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java32
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java80
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java111
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java89
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMappingDelegate.java52
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleNotFoundException.java54
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecyclePhaseNotFoundException.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java202
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MissingProjectException.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MojoExecutionConfigurator.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/NoGoalSpecifiedException.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java67
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java72
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java77
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java119
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java591
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java158
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java258
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java155
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java108
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java53
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java114
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java84
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java45
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java182
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java334
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java67
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java154
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java95
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java150
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java50
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java61
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java309
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java394
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java158
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java70
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java106
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java80
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java73
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java47
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java199
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java29
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java153
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java197
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java477
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java111
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java171
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java37
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java35
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java54
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java211
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CompoundMojoExecutionListener.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CycleDetectedInPluginGraphException.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java91
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java244
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultExtensionRealmCache.java170
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java218
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java219
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java219
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java84
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginDescriptorException.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/LegacySupport.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java128
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java237
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java91
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java88
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorCache.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorParsingException.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java90
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginIncompatibleException.java36
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginLoaderException.java124
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java197
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java192
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java482
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java85
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java47
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java946
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java256
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java261
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java87
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java71
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java158
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java97
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java109
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/DefaultPluginPrefixRequest.java156
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/NoPluginFoundForPrefixException.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixRequest.java115
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResolver.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java294
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResult.java90
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionRequest.java165
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java47
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionRequest.java115
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java107
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolver.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResult.java47
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java408
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResult.java69
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java111
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java128
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java155
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java929
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java295
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java339
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java110
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java333
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java147
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java42
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java81
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java80
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java80
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java88
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java168
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java59
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java1976
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java76
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java98
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java145
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java81
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java194
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java74
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java40
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java248
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java79
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java289
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java103
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java106
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java36
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java403
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java33
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java185
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java347
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java37
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java38
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java770
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java94
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java100
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java130
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java70
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java51
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java34
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java343
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java35
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java36
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java66
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java195
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java33
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java164
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java65
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java68
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java132
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java113
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/RuntimeInformation.java49
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java150
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java169
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java63
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java158
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java81
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java63
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsUtils.java321
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java190
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java140
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivate.java82
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java78
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java39
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java30
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java109
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java44
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java58
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java48
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java46
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java138
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingRequest.java63
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java66
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuilder.java41
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingException.java93
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingRequest.java64
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java50
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java115
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsParseException.java94
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsReader.java83
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java55
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java67
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java127
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java87
-rw-r--r--framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/merge/MavenToolchainMerger.java103
330 files changed, 45107 insertions, 0 deletions
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java
new file mode 100644
index 00000000..20f6c802
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/AbstractMavenLifecycleParticipant.java
@@ -0,0 +1,77 @@
+package org.apache.maven;
+
+/*
+ * 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.execution.MavenSession;
+
+/**
+ * Allows core extensions to participate in Maven build session lifecycle.
+ *
+ * All callback methods (will) follow beforeXXX/afterXXX naming pattern to
+ * indicate at what lifecycle point it is being called.
+ *
+ * @see <a href="http://maven.apache.org/examples/maven-3-lifecycle-extensions.html">example</a>
+ * @see <a href="http://jira.codehaus.org/browse/MNG-4224">MNG-4224</a>
+ * @since 3.0-alpha-3
+ */
+public abstract class AbstractMavenLifecycleParticipant
+{
+
+ /**
+ * Invoked after all MavenProject instances have been created.
+ *
+ * This callback is intended to allow extensions to manipulate MavenProjects
+ * before they are sorted and actual build execution starts.
+ */
+ public void afterProjectsRead( MavenSession session )
+ throws MavenExecutionException
+ {
+ // do nothing
+ }
+
+ /**
+ * Invoked after MavenSession instance has been created.
+ *
+ * This callback is intended to allow extensions to inject execution properties,
+ * activate profiles and perform similar tasks that affect MavenProject
+ * instance construction.
+ */
+ // TODO: This is too early for build extensions, so maybe just remove it?
+ public void afterSessionStart( MavenSession session )
+ throws MavenExecutionException
+ {
+ // do nothing
+ }
+
+ /**
+ * Invoked after all projects were built.
+ *
+ * This callback is intended to allow extensions to perform cleanup of any
+ * allocated external resources after the build. It is invoked on best-effort
+ * basis and may be missed due to an Error or RuntimeException in Maven core
+ * code.
+ * @since 3.2.1, MNG-5389
+ */
+ public void afterSessionEnd( MavenSession session )
+ throws MavenExecutionException
+ {
+ // do nothing
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManager.java
new file mode 100644
index 00000000..2cf9f996
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManager.java
@@ -0,0 +1,51 @@
+package org.apache.maven;
+
+/*
+ * 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.Set;
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+public interface ArtifactFilterManager
+{
+ /**
+ * Returns a filter for core + extension artifacts.
+ *
+ * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin
+ * extensions.
+ */
+ ArtifactFilter getArtifactFilter();
+
+ /**
+ * Returns a filter for only the core artifacts.
+ */
+ ArtifactFilter getCoreArtifactFilter();
+
+ /**
+ * Exclude an extension artifact (doesn't affect getArtifactFilter's result, only getExtensionArtifactFilter).
+ *
+ * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin
+ * extensions.
+ */
+ void excludeArtifact( String artifactId );
+
+ Set<String> getCoreArtifactExcludes();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java
new file mode 100644
index 00000000..13893254
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java
@@ -0,0 +1,34 @@
+package org.apache.maven;
+
+/*
+ * 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.Set;
+
+/**
+ * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core extensions.
+ */
+public interface ArtifactFilterManagerDelegate
+{
+
+ void addExcludes( Set<String> excludes );
+
+ void addCoreExcludes( Set<String> excludes );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildAbort.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildAbort.java
new file mode 100644
index 00000000..3255e32b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildAbort.java
@@ -0,0 +1,39 @@
+package org.apache.maven;
+
+/*
+ * 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.
+ */
+
+/**
+ * A special throwable used to signal a graceful abort of the build.
+ */
+public class BuildAbort
+ extends Error
+{
+
+ public BuildAbort( String message )
+ {
+ super( message );
+ }
+
+ public BuildAbort( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildFailureException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildFailureException.java
new file mode 100644
index 00000000..d35b0d2a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/BuildFailureException.java
@@ -0,0 +1,39 @@
+package org.apache.maven;
+
+/*
+ * 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.
+ */
+
+/**
+ * One or more builds failed.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class BuildFailureException
+ extends Exception
+{
+ public BuildFailureException( String message )
+ {
+ super( message );
+ }
+
+ public BuildFailureException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
new file mode 100644
index 00000000..1962f917
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java
@@ -0,0 +1,112 @@
+package org.apache.maven;
+
+/*
+ * 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.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
+import org.apache.maven.extension.internal.CoreExportsProvider;
+
+/**
+ * @author Jason van Zyl
+ */
+@Named
+@Singleton
+@SuppressWarnings( "deprecation" )
+public class DefaultArtifactFilterManager
+ implements ArtifactFilterManager
+{
+
+ // this is a live injected collection
+ protected final List<ArtifactFilterManagerDelegate> delegates;
+
+ protected Set<String> excludedArtifacts;
+
+ private final Set<String> coreArtifacts;
+
+ @Inject
+ public DefaultArtifactFilterManager( List<ArtifactFilterManagerDelegate> delegates,
+ CoreExportsProvider coreExports )
+ {
+ this.delegates = delegates;
+ this.coreArtifacts = coreExports.get().getExportedArtifacts();
+ }
+
+ private synchronized Set<String> getExcludedArtifacts()
+ {
+ if ( excludedArtifacts == null )
+ {
+ excludedArtifacts = new LinkedHashSet<String>( coreArtifacts );
+ }
+ return excludedArtifacts;
+ }
+
+ /**
+ * Returns the artifact filter for the core + extension artifacts.
+ *
+ * @see org.apache.maven.ArtifactFilterManager#getArtifactFilter()
+ */
+ public ArtifactFilter getArtifactFilter()
+ {
+ Set<String> excludes = new LinkedHashSet<String>( getExcludedArtifacts() );
+
+ for ( ArtifactFilterManagerDelegate delegate : delegates )
+ {
+ delegate.addExcludes( excludes );
+ }
+
+ return new ExclusionSetFilter( excludes );
+ }
+
+ /**
+ * Returns the artifact filter for the standard core artifacts.
+ *
+ * @see org.apache.maven.ArtifactFilterManager#getExtensionDependencyFilter()
+ */
+ public ArtifactFilter getCoreArtifactFilter()
+ {
+ return new ExclusionSetFilter( getCoreArtifactExcludes() );
+ }
+
+ public void excludeArtifact( String artifactId )
+ {
+ getExcludedArtifacts().add( artifactId );
+ }
+
+ public Set<String> getCoreArtifactExcludes()
+ {
+ Set<String> excludes = new LinkedHashSet<String>( coreArtifacts );
+
+ for ( ArtifactFilterManagerDelegate delegate : delegates )
+ {
+ delegate.addCoreExcludes( excludes );
+ }
+
+ return excludes;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
new file mode 100644
index 00000000..94e75e02
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -0,0 +1,521 @@
+package org.apache.maven;
+
+/*
+ * 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.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.execution.DefaultMavenExecutionResult;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.graph.GraphBuilder;
+import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
+import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
+import org.apache.maven.lifecycle.internal.LifecycleStarter;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.repository.LocalRepositoryNotAccessibleException;
+import org.apache.maven.session.scope.internal.SessionScope;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.util.repository.ChainedWorkspaceReader;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Jason van Zyl
+ */
+@Component( role = Maven.class )
+public class DefaultMaven
+ implements Maven
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ protected ProjectBuilder projectBuilder;
+
+ @Requirement
+ private LifecycleStarter lifecycleStarter;
+
+ @Requirement
+ protected PlexusContainer container;
+
+ @Requirement
+ private ExecutionEventCatapult eventCatapult;
+
+ @Requirement
+ private LegacySupport legacySupport;
+
+ @Requirement
+ private SessionScope sessionScope;
+
+ @Requirement
+ private DefaultRepositorySystemSessionFactory repositorySessionFactory;
+
+ @Requirement( hint = GraphBuilder.HINT )
+ private GraphBuilder graphBuilder;
+
+ @Override
+ public MavenExecutionResult execute( MavenExecutionRequest request )
+ {
+ MavenExecutionResult result;
+
+ try
+ {
+ result = doExecute( request );
+ }
+ catch ( OutOfMemoryError e )
+ {
+ result = addExceptionToResult( new DefaultMavenExecutionResult(), e );
+ }
+ catch ( RuntimeException e )
+ {
+ //TODO Hack to make the cycle detection the same for the new graph builder
+ if ( e.getCause() instanceof ProjectCycleException )
+ {
+ result = addExceptionToResult( new DefaultMavenExecutionResult(), e.getCause() );
+ }
+ else
+ {
+ result = addExceptionToResult( new DefaultMavenExecutionResult(),
+ new InternalErrorException( "Internal error: " + e, e ) );
+ }
+ }
+ finally
+ {
+ legacySupport.setSession( null );
+ }
+
+ return result;
+ }
+
+ //
+ // 1) Setup initial properties.
+ //
+ // 2) Validate local repository directory is accessible.
+ //
+ // 3) Create RepositorySystemSession.
+ //
+ // 4) Create MavenSession.
+ //
+ // 5) Execute AbstractLifecycleParticipant.afterSessionStart(session)
+ //
+ // 6) Get reactor projects looking for general POM errors
+ //
+ // 7) Create ProjectDependencyGraph using trimming which takes into account --projects and reactor mode.
+ // This ensures that the projects passed into the ReactorReader are only those specified.
+ //
+ // 8) Create ReactorReader with the getProjectMap( projects ). NOTE that getProjectMap(projects) is the code that
+ // checks for duplicate projects definitions in the build. Ideally this type of duplicate checking should be
+ // part of getting the reactor projects in 6). The duplicate checking is conflated with getProjectMap(projects).
+ //
+ // 9) Execute AbstractLifecycleParticipant.afterProjectsRead(session)
+ //
+ // 10) Create ProjectDependencyGraph without trimming (as trimming was done in 7). A new topological sort is
+ // required after the execution of 9) as the AbstractLifecycleParticipants are free to mutate the MavenProject
+ // instances, which may change dependencies which can, in turn, affect the build order.
+ //
+ // 11) Execute LifecycleStarter.start()
+ //
+ @SuppressWarnings( "checkstyle:methodlength" )
+ private MavenExecutionResult doExecute( MavenExecutionRequest request )
+ {
+ request.setStartTime( new Date() );
+
+ MavenExecutionResult result = new DefaultMavenExecutionResult();
+
+ try
+ {
+ validateLocalRepository( request );
+ }
+ catch ( LocalRepositoryNotAccessibleException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+
+ //
+ // We enter the session scope right after the MavenSession creation and before any of the
+ // AbstractLifecycleParticipant lookups
+ // so that @SessionScoped components can be @Injected into AbstractLifecycleParticipants.
+ //
+ sessionScope.enter();
+ try
+ {
+ DefaultRepositorySystemSession repoSession =
+ (DefaultRepositorySystemSession) newRepositorySession( request );
+ MavenSession session = new MavenSession( container, repoSession, request, result );
+
+ sessionScope.seed( MavenSession.class, session );
+
+ legacySupport.setSession( session );
+
+ return doExecute( request, session, result, repoSession );
+ }
+ finally
+ {
+ sessionScope.exit();
+ }
+ }
+
+ private MavenExecutionResult doExecute( MavenExecutionRequest request, MavenSession session,
+ MavenExecutionResult result, DefaultRepositorySystemSession repoSession )
+ {
+ try
+ {
+ for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( Collections
+ .<MavenProject>emptyList() ) )
+ {
+ listener.afterSessionStart( session );
+ }
+ }
+ catch ( MavenExecutionException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+
+ eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null );
+
+ Result<? extends ProjectDependencyGraph> graphResult = buildGraph( session, result );
+
+ if ( graphResult.hasErrors() )
+ {
+ return addExceptionToResult( result,
+ Iterables.toArray( graphResult.getProblems(), ModelProblem.class )[0]
+ .getException() );
+ }
+
+ try
+ {
+ session.setProjectMap( getProjectMap( session.getProjects() ) );
+ }
+ catch ( DuplicateProjectException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+
+ WorkspaceReader reactorWorkspace;
+ try
+ {
+ reactorWorkspace = container.lookup( WorkspaceReader.class, ReactorReader.HINT );
+ }
+ catch ( ComponentLookupException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+
+ //
+ // Desired order of precedence for local artifact repositories
+ //
+ // Reactor
+ // Workspace
+ // User Local Repository
+ //
+ repoSession.setWorkspaceReader( ChainedWorkspaceReader.newInstance( reactorWorkspace,
+ repoSession.getWorkspaceReader() ) );
+
+ repoSession.setReadOnly();
+
+ ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( session.getProjects() ) )
+ {
+ Thread.currentThread().setContextClassLoader( listener.getClass().getClassLoader() );
+
+ listener.afterProjectsRead( session );
+ }
+ }
+ catch ( MavenExecutionException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( originalClassLoader );
+ }
+
+ //
+ // The projects need to be topologically after the participants have run their afterProjectsRead(session)
+ // because the participant is free to change the dependencies of a project which can potentially change the
+ // topological order of the projects, and therefore can potentially change the build order.
+ //
+ // Note that participants may affect the topological order of the projects but it is
+ // not expected that a participant will add or remove projects from the session.
+ //
+
+ graphResult = buildGraph( session, result );
+
+ if ( graphResult.hasErrors() )
+ {
+ return addExceptionToResult( result,
+ Iterables.toArray( graphResult.getProblems(), ModelProblem.class )[0]
+ .getException() );
+ }
+
+ try
+ {
+ if ( result.hasExceptions() )
+ {
+ return result;
+ }
+
+ result.setTopologicallySortedProjects( session.getProjects() );
+
+ result.setProject( session.getTopLevelProject() );
+
+ lifecycleStarter.execute( session );
+
+ validateActivatedProfiles( session.getProjects(), request.getActiveProfiles() );
+
+ if ( session.getResult().hasExceptions() )
+ {
+ return addExceptionToResult( result, session.getResult().getExceptions().get( 0 ) );
+ }
+ }
+ finally
+ {
+ try
+ {
+ afterSessionEnd( session.getProjects(), session );
+ }
+ catch ( MavenExecutionException e )
+ {
+ return addExceptionToResult( result, e );
+ }
+ }
+
+ return result;
+ }
+
+ private void afterSessionEnd( Collection<MavenProject> projects, MavenSession session )
+ throws MavenExecutionException
+ {
+ ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ for ( AbstractMavenLifecycleParticipant listener : getLifecycleParticipants( projects ) )
+ {
+ Thread.currentThread().setContextClassLoader( listener.getClass().getClassLoader() );
+
+ listener.afterSessionEnd( session );
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( originalClassLoader );
+ }
+ }
+
+ public RepositorySystemSession newRepositorySession( MavenExecutionRequest request )
+ {
+ return repositorySessionFactory.newRepositorySession( request );
+ }
+
+ private void validateLocalRepository( MavenExecutionRequest request )
+ throws LocalRepositoryNotAccessibleException
+ {
+ File localRepoDir = request.getLocalRepositoryPath();
+
+ logger.debug( "Using local repository at " + localRepoDir );
+
+ localRepoDir.mkdirs();
+
+ if ( !localRepoDir.isDirectory() )
+ {
+ throw new LocalRepositoryNotAccessibleException( "Could not create local repository at " + localRepoDir );
+ }
+ }
+
+ private Collection<AbstractMavenLifecycleParticipant> getLifecycleParticipants( Collection<MavenProject> projects )
+ {
+ Collection<AbstractMavenLifecycleParticipant> lifecycleListeners =
+ new LinkedHashSet<AbstractMavenLifecycleParticipant>();
+
+ ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ try
+ {
+ lifecycleListeners.addAll( container.lookupList( AbstractMavenLifecycleParticipant.class ) );
+ }
+ catch ( ComponentLookupException e )
+ {
+ // this is just silly, lookupList should return an empty list!
+ logger.warn( "Failed to lookup lifecycle participants: " + e.getMessage() );
+ }
+
+ Collection<ClassLoader> scannedRealms = new HashSet<ClassLoader>();
+
+ for ( MavenProject project : projects )
+ {
+ ClassLoader projectRealm = project.getClassRealm();
+
+ if ( projectRealm != null && scannedRealms.add( projectRealm ) )
+ {
+ Thread.currentThread().setContextClassLoader( projectRealm );
+
+ try
+ {
+ lifecycleListeners.addAll( container.lookupList( AbstractMavenLifecycleParticipant.class ) );
+ }
+ catch ( ComponentLookupException e )
+ {
+ // this is just silly, lookupList should return an empty list!
+ logger.warn( "Failed to lookup lifecycle participants: " + e.getMessage() );
+ }
+ }
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( originalClassLoader );
+ }
+
+ return lifecycleListeners;
+ }
+
+ private MavenExecutionResult addExceptionToResult( MavenExecutionResult result, Throwable e )
+ {
+ if ( !result.getExceptions().contains( e ) )
+ {
+ result.addException( e );
+ }
+
+ return result;
+ }
+
+ private void validateActivatedProfiles( List<MavenProject> projects, List<String> activeProfileIds )
+ {
+ Collection<String> notActivatedProfileIds = new LinkedHashSet<String>( activeProfileIds );
+
+ for ( MavenProject project : projects )
+ {
+ for ( List<String> profileIds : project.getInjectedProfileIds().values() )
+ {
+ notActivatedProfileIds.removeAll( profileIds );
+ }
+ }
+
+ for ( String notActivatedProfileId : notActivatedProfileIds )
+ {
+ logger.warn( "The requested profile \"" + notActivatedProfileId
+ + "\" could not be activated because it does not exist." );
+ }
+ }
+
+ private Map<String, MavenProject> getProjectMap( Collection<MavenProject> projects )
+ throws DuplicateProjectException
+ {
+ Map<String, MavenProject> index = new LinkedHashMap<String, MavenProject>();
+ Map<String, List<File>> collisions = new LinkedHashMap<String, List<File>>();
+
+ for ( MavenProject project : projects )
+ {
+ String projectId = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
+
+ MavenProject collision = index.get( projectId );
+
+ if ( collision == null )
+ {
+ index.put( projectId, project );
+ }
+ else
+ {
+ List<File> pomFiles = collisions.get( projectId );
+
+ if ( pomFiles == null )
+ {
+ pomFiles = new ArrayList<File>( Arrays.asList( collision.getFile(), project.getFile() ) );
+ collisions.put( projectId, pomFiles );
+ }
+ else
+ {
+ pomFiles.add( project.getFile() );
+ }
+ }
+ }
+
+ if ( !collisions.isEmpty() )
+ {
+ throw new DuplicateProjectException( "Two or more projects in the reactor"
+ + " have the same identifier, please make sure that <groupId>:<artifactId>:<version>"
+ + " is unique for each project: " + collisions, collisions );
+ }
+
+ return index;
+ }
+
+ private Result<? extends ProjectDependencyGraph> buildGraph( MavenSession session, MavenExecutionResult result )
+ {
+ Result<? extends ProjectDependencyGraph> graphResult = graphBuilder.build( session );
+ for ( ModelProblem problem : graphResult.getProblems() )
+ {
+ if ( problem.getSeverity() == ModelProblem.Severity.WARNING )
+ {
+ logger.warn( problem.toString() );
+ }
+ else
+ {
+ logger.error( problem.toString() );
+ }
+ }
+
+ if ( !graphResult.hasErrors() )
+ {
+ ProjectDependencyGraph projectDependencyGraph = graphResult.get();
+ session.setProjects( projectDependencyGraph.getSortedProjects() );
+ session.setAllProjects( projectDependencyGraph.getSortedProjects() );
+ session.setProjectDependencyGraph( projectDependencyGraph );
+ }
+
+ return graphResult;
+ }
+
+ @Deprecated
+ // 5 January 2014
+ protected Logger getLogger()
+ {
+ return logger;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java
new file mode 100644
index 00000000..fa8be382
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java
@@ -0,0 +1,217 @@
+package org.apache.maven;
+
+/*
+ * 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.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
+import org.apache.maven.artifact.resolver.ResolutionErrorHandler;
+import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.ProjectArtifact;
+import org.apache.maven.repository.RepositorySystem;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Deprecated
+@Component( role = ProjectDependenciesResolver.class )
+public class DefaultProjectDependenciesResolver
+ implements ProjectDependenciesResolver
+{
+
+ @Requirement
+ private RepositorySystem repositorySystem;
+
+ @Requirement
+ private ResolutionErrorHandler resolutionErrorHandler;
+
+ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ return resolve( Collections.singleton( project ), scopesToResolve, session );
+ }
+
+ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ Set<MavenProject> mavenProjects = Collections.singleton( project );
+ return resolveImpl( mavenProjects, scopesToCollect, scopesToResolve, session,
+ getIgnorableArtifacts( mavenProjects ) );
+ }
+
+ public Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopesToResolve,
+ MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ return resolveImpl( projects, null, scopesToResolve, session, getIgnorableArtifacts( projects ) );
+ }
+
+ public Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session,
+ Set<Artifact> ignoreableArtifacts )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ return resolveImpl( Collections.singleton( project ), scopesToCollect, scopesToResolve, session,
+ getIgnorableArtifacts( ignoreableArtifacts ) );
+ }
+
+
+ private Set<Artifact> resolveImpl( Collection<? extends MavenProject> projects, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session,
+ Set<String> projectIds )
+ throws ArtifactResolutionException, ArtifactNotFoundException
+ {
+ Set<Artifact> resolved = new LinkedHashSet<Artifact>();
+
+ if ( projects == null || projects.isEmpty() )
+ {
+ return resolved;
+ }
+
+ if ( ( scopesToCollect == null || scopesToCollect.isEmpty() )
+ && ( scopesToResolve == null || scopesToResolve.isEmpty() ) )
+ {
+ return resolved;
+ }
+
+ /*
+
+ Logic for transitive global exclusions
+
+ List<String> exclusions = new ArrayList<String>();
+
+ for ( Dependency d : project.getDependencies() )
+ {
+ if ( d.getExclusions() != null )
+ {
+ for ( Exclusion e : d.getExclusions() )
+ {
+ exclusions.add( e.getGroupId() + ":" + e.getArtifactId() );
+ }
+ }
+ }
+
+ ArtifactFilter scopeFilter = new ScopeArtifactFilter( scope );
+
+ ArtifactFilter filter;
+
+ if ( ! exclusions.isEmpty() )
+ {
+ filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{
+ new ExcludesArtifactFilter( exclusions ), scopeFilter } ) );
+ }
+ else
+ {
+ filter = scopeFilter;
+ }
+ */
+
+ CumulativeScopeArtifactFilter resolutionScopeFilter = new CumulativeScopeArtifactFilter( scopesToResolve );
+
+ CumulativeScopeArtifactFilter collectionScopeFilter = new CumulativeScopeArtifactFilter( scopesToCollect );
+ collectionScopeFilter = new CumulativeScopeArtifactFilter( collectionScopeFilter, resolutionScopeFilter );
+
+ ArtifactResolutionRequest request =
+ new ArtifactResolutionRequest().setResolveRoot( false ).setResolveTransitively( true ).setCollectionFilter(
+ collectionScopeFilter ).setResolutionFilter( resolutionScopeFilter ).setLocalRepository(
+ session.getLocalRepository() ).setOffline( session.isOffline() ).setForceUpdate(
+ session.getRequest().isUpdateSnapshots() );
+ request.setServers( session.getRequest().getServers() );
+ request.setMirrors( session.getRequest().getMirrors() );
+ request.setProxies( session.getRequest().getProxies() );
+
+ for ( MavenProject project : projects )
+ {
+ request.setArtifact( new ProjectArtifact( project ) );
+ request.setArtifactDependencies( project.getDependencyArtifacts() );
+ request.setManagedVersionMap( project.getManagedVersionMap() );
+ request.setRemoteRepositories( project.getRemoteArtifactRepositories() );
+
+ ArtifactResolutionResult result = repositorySystem.resolve( request );
+
+ try
+ {
+ resolutionErrorHandler.throwErrors( request, result );
+ }
+ catch ( MultipleArtifactsNotFoundException e )
+ {
+
+ Collection<Artifact> missing = new HashSet<Artifact>( e.getMissingArtifacts() );
+
+ for ( Iterator<Artifact> it = missing.iterator(); it.hasNext(); )
+ {
+ String key = ArtifactUtils.key( it.next() );
+ if ( projectIds.contains( key ) )
+ {
+ it.remove();
+ }
+ }
+
+ if ( !missing.isEmpty() )
+ {
+ throw e;
+ }
+ }
+
+ resolved.addAll( result.getArtifacts() );
+ }
+
+ return resolved;
+ }
+
+
+ private Set<String> getIgnorableArtifacts( Collection<? extends MavenProject> projects )
+ {
+ Set<String> projectIds = new HashSet<String>( projects.size() * 2 );
+
+ for ( MavenProject p : projects )
+ {
+ String key = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
+ projectIds.add( key );
+ }
+ return projectIds;
+ }
+
+ private Set<String> getIgnorableArtifacts( Iterable<Artifact> artifactIterable )
+ {
+ Set<String> projectIds = new HashSet<String>();
+
+ for ( Artifact artifact : artifactIterable )
+ {
+ String key = ArtifactUtils.key( artifact );
+ projectIds.add( key );
+ }
+ return projectIds;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java
new file mode 100644
index 00000000..b1398729
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/DuplicateProjectException.java
@@ -0,0 +1,61 @@
+package org.apache.maven;
+
+/*
+ * 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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Signals a collision of two or more projects with the same g:a:v during a reactor build.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DuplicateProjectException
+ extends MavenExecutionException
+{
+
+ private Map<String, List<File>> collisions;
+
+ /**
+ * Creates a new exception with specified details.
+ *
+ * @param message The message text, may be {@code null}.
+ * @param collisions The POM files of the projects that collided, indexed by their g:a:v, may be {@code null}.
+ */
+ public DuplicateProjectException( String message, Map<String, List<File>> collisions )
+ {
+ super( message, (File) null );
+
+ this.collisions = ( collisions != null ) ? collisions : new LinkedHashMap<String, List<File>>();
+ }
+
+ /**
+ * Gets the POM files of the projects that collided.
+ *
+ * @return The POM files of the projects that collided, indexed by their g:a:v, never {@code null}.
+ */
+ public Map<String, List<File>> getCollisions()
+ {
+ return collisions;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/InternalErrorException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/InternalErrorException.java
new file mode 100644
index 00000000..afe92c1b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/InternalErrorException.java
@@ -0,0 +1,36 @@
+package org.apache.maven;
+
+/*
+ * 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 internal error in Maven itself, e.g. a programming bug.
+ *
+ * @author Benjamin Bentmann
+ */
+public class InternalErrorException
+ extends MavenExecutionException
+{
+
+ public InternalErrorException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/Maven.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/Maven.java
new file mode 100644
index 00000000..85638476
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/Maven.java
@@ -0,0 +1,34 @@
+package org.apache.maven;
+
+/*
+ * 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.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionResult;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface Maven
+{
+ @Deprecated
+ String POMv4 = "pom.xml";
+
+ MavenExecutionResult execute( MavenExecutionRequest request );
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MavenExecutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MavenExecutionException.java
new file mode 100644
index 00000000..5708e525
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MavenExecutionException.java
@@ -0,0 +1,55 @@
+package org.apache.maven;
+
+/*
+ * 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.project.ProjectBuildingException;
+
+/**
+ * @author Jason van Zyl
+ */
+public class MavenExecutionException
+ extends Exception
+{
+ private File pomFile;
+
+ public MavenExecutionException( String message, File pomFile )
+ {
+ super( message );
+ this.pomFile = pomFile;
+ }
+
+ public MavenExecutionException( String message, File pomFile, ProjectBuildingException cause )
+ {
+ super( message, cause );
+ this.pomFile = pomFile;
+ }
+
+ public MavenExecutionException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public File getPomFile()
+ {
+ return pomFile;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MissingModuleException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MissingModuleException.java
new file mode 100644
index 00000000..c920a6ea
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/MissingModuleException.java
@@ -0,0 +1,48 @@
+package org.apache.maven;
+
+/*
+ * 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;
+
+public class MissingModuleException
+ extends MavenExecutionException
+{
+
+ private File moduleFile;
+ private final String moduleName;
+
+ public MissingModuleException( String moduleName, File moduleFile, File pomFile )
+ {
+ super( "The module: " + moduleName + " cannot be found in file: " + moduleFile, pomFile );
+ this.moduleName = moduleName;
+ this.moduleFile = moduleFile;
+ }
+
+ public File getModuleFile()
+ {
+ return moduleFile;
+ }
+
+ public String getModuleName()
+ {
+ return moduleName;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java
new file mode 100644
index 00000000..66ed3a08
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java
@@ -0,0 +1,55 @@
+package org.apache.maven;
+
+/*
+ * 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.plugin.MojoFailureException;
+
+/**
+ * Exception which occurs when a normal (i.e. non-aggregator) mojo fails to
+ * execute. In this case, the mojo failed while executing against a particular
+ * project instance, so we can wrap the {@link MojoFailureException} with context
+ * information including projectId that caused the failure.
+ *
+ * @author jdcasey
+ *
+ */
+public class ProjectBuildFailureException
+ extends BuildFailureException
+{
+
+ private final String projectId;
+
+ public ProjectBuildFailureException( String projectId, MojoFailureException cause )
+ {
+ super( "Build for project: " + projectId + " failed during execution of mojo.", cause );
+
+ this.projectId = projectId;
+ }
+
+ public MojoFailureException getMojoFailureException()
+ {
+ return (MojoFailureException) getCause();
+ }
+
+ public String getProjectId()
+ {
+ return projectId;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java
new file mode 100644
index 00000000..ecd8ecac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectCycleException.java
@@ -0,0 +1,39 @@
+package org.apache.maven;
+
+/*
+ * 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.util.dag.CycleDetectedException;
+
+/**
+ * @author jdcasey
+ */
+public class ProjectCycleException
+ extends BuildFailureException
+{
+ public ProjectCycleException( String message )
+ {
+ super( message );
+ }
+
+ public ProjectCycleException( String message, CycleDetectedException cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java
new file mode 100644
index 00000000..01e62278
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ProjectDependenciesResolver.java
@@ -0,0 +1,95 @@
+package org.apache.maven;
+
+/*
+ * 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.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+
+@Deprecated
+/**
+ * @deprecated As of 3.2.2, and there is no direct replacement. This is an internal class which was not marked as such,
+ * but should have been.
+ * @author jvanzyl
+ *
+ */
+public interface ProjectDependenciesResolver
+{
+
+ /**
+ * Resolves the transitive dependencies of the specified project.
+ *
+ * @param project The project whose dependencies should be resolved, must not be {@code null}.
+ * @param scopesToResolve The dependency scopes that should be resolved, may be {@code null}.
+ * @param session The current build session, must not be {@code null}.
+ * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
+ */
+ Set<Artifact> resolve( MavenProject project, Collection<String> scopesToResolve, MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException;
+
+ /**
+ * Resolves the transitive dependencies of the specified project.
+ *
+ * @param project The project whose dependencies should be resolved, must not be {@code null}.
+ * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}.
+ * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}.
+ * @param session The current build session, must not be {@code null}.
+ * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
+ */
+ Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException;
+
+ /**
+ * Resolves the transitive dependencies of the specified project.
+ *
+ * @param project The project whose dependencies should be resolved, must not be {@code null}.
+ * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}.
+ * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}.
+ * @param session The current build session, must not be {@code null}.
+ * @param ignoreableArtifacts Artifacts that need not be resolved
+ * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}.
+ */
+ Set<Artifact> resolve( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session, Set<Artifact> ignoreableArtifacts )
+ throws ArtifactResolutionException, ArtifactNotFoundException;
+
+ /**
+ * Resolves the transitive dependencies of the specified projects. Note that dependencies which can't be resolved
+ * from any repository but are present among the set of specified projects will not cause an exception. Instead,
+ * those unresolved artifacts will be returned in the result set, allowing the caller to take special care of
+ * artifacts that haven't been build yet.
+ *
+ * @param projects The projects whose dependencies should be resolved, may be {@code null}.
+ * @param scopes The dependency scopes that should be resolved, may be {@code null}.
+ * @param session The current build session, must not be {@code null}.
+ * @return The transitive dependencies of the specified projects that match the requested scopes, never
+ * {@code null}.
+ */
+ Set<Artifact> resolve( Collection<? extends MavenProject> projects, Collection<String> scopes,
+ MavenSession session )
+ throws ArtifactResolutionException, ArtifactNotFoundException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ReactorReader.java
new file mode 100644
index 00000000..252bdd09
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -0,0 +1,255 @@
+package org.apache.maven;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.repository.internal.MavenWorkspaceReader;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.repository.WorkspaceRepository;
+import org.eclipse.aether.util.artifact.ArtifactIdUtils;
+
+/**
+ * An implementation of a workspace reader that knows how to search the Maven reactor for artifacts, either
+ * as packaged jar if it has been built, or only compile output directory if packaging hasn't happened yet.
+ *
+ * @author Jason van Zyl
+ */
+@Named( ReactorReader.HINT )
+@SessionScoped
+class ReactorReader
+ implements MavenWorkspaceReader
+{
+ public static final String HINT = "reactor";
+
+ private static final Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
+
+ private Map<String, MavenProject> projectsByGAV;
+
+ private Map<String, List<MavenProject>> projectsByGA;
+
+ private WorkspaceRepository repository;
+
+ @Inject
+ public ReactorReader( MavenSession session )
+ {
+ projectsByGAV = session.getProjectMap();
+
+ projectsByGA = new HashMap<String, List<MavenProject>>( projectsByGAV.size() * 2 );
+ for ( MavenProject project : projectsByGAV.values() )
+ {
+ String key = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+
+ List<MavenProject> projects = projectsByGA.get( key );
+
+ if ( projects == null )
+ {
+ projects = new ArrayList<MavenProject>( 1 );
+ projectsByGA.put( key, projects );
+ }
+
+ projects.add( project );
+ }
+
+ repository = new WorkspaceRepository( "reactor", new HashSet<String>( projectsByGAV.keySet() ) );
+ }
+
+ //
+ // Public API
+ //
+
+ public WorkspaceRepository getRepository()
+ {
+ return repository;
+ }
+
+ public File findArtifact( Artifact artifact )
+ {
+ String projectKey = ArtifactUtils.key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
+
+ MavenProject project = projectsByGAV.get( projectKey );
+
+ if ( project != null )
+ {
+ File file = find( project, artifact );
+ if ( file == null && project != project.getExecutionProject() )
+ {
+ file = find( project.getExecutionProject(), artifact );
+ }
+ return file;
+ }
+
+ return null;
+ }
+
+ public List<String> findVersions( Artifact artifact )
+ {
+ String key = ArtifactUtils.versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );
+
+ List<MavenProject> projects = projectsByGA.get( key );
+ if ( projects == null || projects.isEmpty() )
+ {
+ return Collections.emptyList();
+ }
+
+ List<String> versions = new ArrayList<String>();
+
+ for ( MavenProject project : projects )
+ {
+ if ( find( project, artifact ) != null )
+ {
+ versions.add( project.getVersion() );
+ }
+ }
+
+ return Collections.unmodifiableList( versions );
+ }
+
+ @Override
+ public Model findModel( Artifact artifact )
+ {
+ String projectKey = ArtifactUtils.key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
+ MavenProject project = projectsByGAV.get( projectKey );
+ return project == null ? null : project.getModel();
+ }
+
+ //
+ // Implementation
+ //
+
+ private File find( MavenProject project, Artifact artifact )
+ {
+ if ( "pom".equals( artifact.getExtension() ) )
+ {
+ return project.getFile();
+ }
+
+ Artifact projectArtifact = findMatchingArtifact( project, artifact );
+
+ if ( hasArtifactFileFromPackagePhase( projectArtifact ) )
+ {
+ return projectArtifact.getFile();
+ }
+ else if ( !hasBeenPackaged( project ) )
+ {
+ // fallback to loose class files only if artifacts haven't been packaged yet
+ // and only for plain old jars. Not war files, not ear files, not anything else.
+
+ if ( isTestArtifact( artifact ) )
+ {
+ if ( project.hasLifecyclePhase( "test-compile" ) )
+ {
+ return new File( project.getBuild().getTestOutputDirectory() );
+ }
+ }
+ else
+ {
+ String type = artifact.getProperty( "type", "" );
+ if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
+ {
+ return new File( project.getBuild().getOutputDirectory() );
+ }
+ }
+ }
+
+ // The fall-through indicates that the artifact cannot be found;
+ // for instance if package produced nothing or classifier problems.
+ return null;
+ }
+
+ private boolean hasArtifactFileFromPackagePhase( Artifact projectArtifact )
+ {
+ return projectArtifact != null && projectArtifact.getFile() != null && projectArtifact.getFile().exists();
+ }
+
+ private boolean hasBeenPackaged( MavenProject project )
+ {
+ return project.hasLifecyclePhase( "package" ) || project.hasLifecyclePhase( "install" )
+ || project.hasLifecyclePhase( "deploy" );
+ }
+
+ /**
+ * Tries to resolve the specified artifact from the artifacts of the given project.
+ *
+ * @param project The project to try to resolve the artifact from, must not be <code>null</code>.
+ * @param requestedArtifact The artifact to resolve, must not be <code>null</code>.
+ * @return The matching artifact from the project or <code>null</code> if not found. Note that this
+ */
+ private Artifact findMatchingArtifact( MavenProject project, Artifact requestedArtifact )
+ {
+ String requestedRepositoryConflictId = ArtifactIdUtils.toVersionlessId( requestedArtifact );
+
+ Artifact mainArtifact = RepositoryUtils.toArtifact( project.getArtifact() );
+ if ( requestedRepositoryConflictId.equals( ArtifactIdUtils.toVersionlessId( mainArtifact ) ) )
+ {
+ return mainArtifact;
+ }
+
+ for ( Artifact attachedArtifact : RepositoryUtils.toArtifacts( project.getAttachedArtifacts() ) )
+ {
+ if ( attachedArtifactComparison( requestedArtifact, attachedArtifact ) )
+ {
+ return attachedArtifact;
+ }
+ }
+
+ return null;
+ }
+
+ private boolean attachedArtifactComparison( Artifact requested, Artifact attached )
+ {
+ //
+ // We are taking as much as we can from the DefaultArtifact.equals(). The requested artifact has no file so
+ // we want to remove that from the comparison.
+ //
+ return requested.getArtifactId().equals( attached.getArtifactId() )
+ && requested.getGroupId().equals( attached.getGroupId() )
+ && requested.getVersion().equals( attached.getVersion() )
+ && requested.getExtension().equals( attached.getExtension() )
+ && requested.getClassifier().equals( attached.getClassifier() );
+ }
+
+ /**
+ * Determines whether the specified artifact refers to test classes.
+ *
+ * @param artifact The artifact to check, must not be {@code null}.
+ * @return {@code true} if the artifact refers to test classes, {@code false} otherwise.
+ */
+ private static boolean isTestArtifact( Artifact artifact )
+ {
+ return ( "test-jar".equals( artifact.getProperty( "type", "" ) ) )
+ || ( "jar".equals( artifact.getExtension() ) && "tests".equals( artifact.getClassifier() ) );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
new file mode 100644
index 00000000..d7fd88e2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/RepositoryUtils.java
@@ -0,0 +1,362 @@
+package org.apache.maven;
+
+/*
+ * 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.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.ArtifactProperties;
+import org.eclipse.aether.artifact.ArtifactType;
+import org.eclipse.aether.artifact.ArtifactTypeRegistry;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.artifact.DefaultArtifactType;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.Exclusion;
+import org.eclipse.aether.repository.Authentication;
+import org.eclipse.aether.repository.Proxy;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
+
+/**
+ * <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
+ * of the public API. In particular, this class can be changed or deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public class RepositoryUtils
+{
+
+ private static String nullify( String string )
+ {
+ return ( string == null || string.length() <= 0 ) ? null : string;
+ }
+
+ private static org.apache.maven.artifact.Artifact toArtifact( Dependency dependency )
+ {
+ if ( dependency == null )
+ {
+ return null;
+ }
+
+ org.apache.maven.artifact.Artifact result = toArtifact( dependency.getArtifact() );
+ result.setScope( dependency.getScope() );
+ result.setOptional( dependency.isOptional() );
+
+ return result;
+ }
+
+ public static org.apache.maven.artifact.Artifact toArtifact( Artifact artifact )
+ {
+ if ( artifact == null )
+ {
+ return null;
+ }
+
+ ArtifactHandler handler = newHandler( artifact );
+
+ /*
+ * NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some
+ * plugins only check for null, so be sure to nullify an empty classifier.
+ */
+ org.apache.maven.artifact.Artifact result =
+ new org.apache.maven.artifact.DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getVersion(), null,
+ artifact.getProperty( ArtifactProperties.TYPE,
+ artifact.getExtension() ),
+ nullify( artifact.getClassifier() ), handler );
+
+ result.setFile( artifact.getFile() );
+ result.setResolved( artifact.getFile() != null );
+
+ List<String> trail = new ArrayList<String>( 1 );
+ trail.add( result.getId() );
+ result.setDependencyTrail( trail );
+
+ return result;
+ }
+
+ public static void toArtifacts( Collection<org.apache.maven.artifact.Artifact> artifacts,
+ Collection<? extends DependencyNode> nodes, List<String> trail,
+ DependencyFilter filter )
+ {
+ for ( DependencyNode node : nodes )
+ {
+ org.apache.maven.artifact.Artifact artifact = toArtifact( node.getDependency() );
+
+ List<String> nodeTrail = new ArrayList<String>( trail.size() + 1 );
+ nodeTrail.addAll( trail );
+ nodeTrail.add( artifact.getId() );
+
+ if ( filter == null || filter.accept( node, Collections.<DependencyNode>emptyList() ) )
+ {
+ artifact.setDependencyTrail( nodeTrail );
+ artifacts.add( artifact );
+ }
+
+ toArtifacts( artifacts, node.getChildren(), nodeTrail, filter );
+ }
+ }
+
+ public static Artifact toArtifact( org.apache.maven.artifact.Artifact artifact )
+ {
+ if ( artifact == null )
+ {
+ return null;
+ }
+
+ String version = artifact.getVersion();
+ if ( version == null && artifact.getVersionRange() != null )
+ {
+ version = artifact.getVersionRange().toString();
+ }
+
+ Map<String, String> props = null;
+ if ( org.apache.maven.artifact.Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+ {
+ String localPath = ( artifact.getFile() != null ) ? artifact.getFile().getPath() : "";
+ props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, localPath );
+ }
+
+ Artifact result =
+ new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(),
+ artifact.getArtifactHandler().getExtension(), version, props,
+ newArtifactType( artifact.getType(), artifact.getArtifactHandler() ) );
+ result = result.setFile( artifact.getFile() );
+
+ return result;
+ }
+
+ public static Dependency toDependency( org.apache.maven.artifact.Artifact artifact,
+ Collection<org.apache.maven.model.Exclusion> exclusions )
+ {
+ if ( artifact == null )
+ {
+ return null;
+ }
+
+ Artifact result = toArtifact( artifact );
+
+ List<Exclusion> excl = null;
+ if ( exclusions != null )
+ {
+ excl = new ArrayList<Exclusion>( exclusions.size() );
+ for ( org.apache.maven.model.Exclusion exclusion : exclusions )
+ {
+ excl.add( toExclusion( exclusion ) );
+ }
+ }
+
+ return new Dependency( result, artifact.getScope(), artifact.isOptional(), excl );
+ }
+
+ public static List<RemoteRepository> toRepos( List<ArtifactRepository> repos )
+ {
+ if ( repos == null )
+ {
+ return null;
+ }
+
+ List<RemoteRepository> results = new ArrayList<RemoteRepository>( repos.size() );
+ for ( ArtifactRepository repo : repos )
+ {
+ results.add( toRepo( repo ) );
+ }
+ return results;
+ }
+
+ public static RemoteRepository toRepo( ArtifactRepository repo )
+ {
+ RemoteRepository result = null;
+ if ( repo != null )
+ {
+ RemoteRepository.Builder builder =
+ new RemoteRepository.Builder( repo.getId(), getLayout( repo ), repo.getUrl() );
+ builder.setSnapshotPolicy( toPolicy( repo.getSnapshots() ) );
+ builder.setReleasePolicy( toPolicy( repo.getReleases() ) );
+ builder.setAuthentication( toAuthentication( repo.getAuthentication() ) );
+ builder.setProxy( toProxy( repo.getProxy() ) );
+ builder.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) );
+ result = builder.build();
+ }
+ return result;
+ }
+
+ public static String getLayout( ArtifactRepository repo )
+ {
+ try
+ {
+ return repo.getLayout().getId();
+ }
+ catch ( LinkageError e )
+ {
+ /*
+ * NOTE: getId() was added in 3.x and is as such not implemented by plugins compiled against 2.x APIs.
+ */
+ String className = repo.getLayout().getClass().getSimpleName();
+ if ( className.endsWith( "RepositoryLayout" ) )
+ {
+ String layout = className.substring( 0, className.length() - "RepositoryLayout".length() );
+ if ( layout.length() > 0 )
+ {
+ layout = Character.toLowerCase( layout.charAt( 0 ) ) + layout.substring( 1 );
+ return layout;
+ }
+ }
+ return "";
+ }
+ }
+
+ private static RepositoryPolicy toPolicy( ArtifactRepositoryPolicy policy )
+ {
+ RepositoryPolicy result = null;
+ if ( policy != null )
+ {
+ result = new RepositoryPolicy( policy.isEnabled(), policy.getUpdatePolicy(), policy.getChecksumPolicy() );
+ }
+ return result;
+ }
+
+ private static Authentication toAuthentication( org.apache.maven.artifact.repository.Authentication auth )
+ {
+ Authentication result = null;
+ if ( auth != null )
+ {
+ AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+ authBuilder.addUsername( auth.getUsername() ).addPassword( auth.getPassword() );
+ authBuilder.addPrivateKey( auth.getPrivateKey(), auth.getPassphrase() );
+ result = authBuilder.build();
+ }
+ return result;
+ }
+
+ private static Proxy toProxy( org.apache.maven.repository.Proxy proxy )
+ {
+ Proxy result = null;
+ if ( proxy != null )
+ {
+ AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+ authBuilder.addUsername( proxy.getUserName() ).addPassword( proxy.getPassword() );
+ result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() );
+ }
+ return result;
+ }
+
+ public static ArtifactHandler newHandler( Artifact artifact )
+ {
+ String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() );
+ DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
+ handler.setExtension( artifact.getExtension() );
+ handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
+ String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" );
+ handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) );
+ String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" );
+ handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) );
+ return handler;
+ }
+
+ public static ArtifactType newArtifactType( String id, ArtifactHandler handler )
+ {
+ return new DefaultArtifactType( id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(),
+ handler.isAddedToClasspath(), handler.isIncludesDependencies() );
+ }
+
+ public static Dependency toDependency( org.apache.maven.model.Dependency dependency,
+ ArtifactTypeRegistry stereotypes )
+ {
+ ArtifactType stereotype = stereotypes.get( dependency.getType() );
+ if ( stereotype == null )
+ {
+ stereotype = new DefaultArtifactType( dependency.getType() );
+ }
+
+ boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0;
+
+ Map<String, String> props = null;
+ if ( system )
+ {
+ props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() );
+ }
+
+ Artifact artifact =
+ new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null,
+ dependency.getVersion(), props, stereotype );
+
+ List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() );
+ for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() )
+ {
+ exclusions.add( toExclusion( exclusion ) );
+ }
+
+ Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions );
+
+ return result;
+ }
+
+ private static Exclusion toExclusion( org.apache.maven.model.Exclusion exclusion )
+ {
+ return new Exclusion( exclusion.getGroupId(), exclusion.getArtifactId(), "*", "*" );
+ }
+
+ public static ArtifactTypeRegistry newArtifactTypeRegistry( ArtifactHandlerManager handlerManager )
+ {
+ return new MavenArtifactTypeRegistry( handlerManager );
+ }
+
+ static class MavenArtifactTypeRegistry
+ implements ArtifactTypeRegistry
+ {
+
+ private final ArtifactHandlerManager handlerManager;
+
+ public MavenArtifactTypeRegistry( ArtifactHandlerManager handlerManager )
+ {
+ this.handlerManager = handlerManager;
+ }
+
+ public ArtifactType get( String stereotypeId )
+ {
+ ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId );
+ return newArtifactType( stereotypeId, handler );
+ }
+
+ }
+
+ public static Collection<Artifact> toArtifacts( Collection<org.apache.maven.artifact.Artifact> artifactsToConvert )
+ {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ for ( org.apache.maven.artifact.Artifact a : artifactsToConvert )
+ {
+ artifacts.add( toArtifact( a ) );
+ }
+ return artifacts;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/SessionScoped.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/SessionScoped.java
new file mode 100644
index 00000000..63b1eb77
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/SessionScoped.java
@@ -0,0 +1,42 @@
+package org.apache.maven;
+
+/*
+ * 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 java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.ScopeAnnotation;
+
+/**
+ * Indicates that annotated component should be instantiated before session starts and discarded after session execution
+ * completes.
+ *
+ * @author Jason van Zyl
+ * @since 3.2.0
+ */
+@Target( { TYPE } )
+@Retention( RUNTIME )
+@ScopeAnnotation
+public @interface SessionScoped
+{
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/DependencyResolutionRequiredException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/DependencyResolutionRequiredException.java
new file mode 100644
index 00000000..b54ba070
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/DependencyResolutionRequiredException.java
@@ -0,0 +1,35 @@
+package org.apache.maven.artifact;
+
+/*
+ * 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.
+ */
+
+/**
+ * Exception that occurs when an artifact file is used, but has not been resolved.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @todo it may be better for artifact.getFile() to throw it - perhaps it is a runtime exception?
+ */
+public class DependencyResolutionRequiredException
+ extends Exception
+{
+ public DependencyResolutionRequiredException( Artifact artifact )
+ {
+ super( "Attempted to access the artifact " + artifact + "; which has not yet been resolved" );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
new file mode 100644
index 00000000..62991f11
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/InvalidRepositoryException.java
@@ -0,0 +1,65 @@
+package org.apache.maven.artifact;
+
+/*
+ * 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.MalformedURLException;
+
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+/**
+ * Error constructing an artifact repository.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class InvalidRepositoryException
+ extends Exception
+{
+ private final String repositoryId;
+
+ public InvalidRepositoryException( String message, String repositoryId, MalformedURLException cause )
+ {
+ super( message, cause );
+ this.repositoryId = repositoryId;
+ }
+
+ protected InvalidRepositoryException( String message, String repositoryId, ComponentLookupException cause )
+ {
+ super( message, cause );
+ this.repositoryId = repositoryId;
+ }
+
+ @Deprecated
+ public InvalidRepositoryException( String message, Throwable t )
+ {
+ super( message, t );
+ this.repositoryId = null;
+ }
+
+ public InvalidRepositoryException( String message, String repositoryId )
+ {
+ super( message );
+ this.repositoryId = repositoryId;
+ }
+
+ public String getRepositoryId()
+ {
+ return repositoryId;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java
new file mode 100644
index 00000000..a16f64f6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java
@@ -0,0 +1,59 @@
+package org.apache.maven.artifact.factory;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+@Deprecated
+public interface ArtifactFactory
+{
+ @Deprecated
+ String ROLE = ArtifactFactory.class.getName();
+
+ Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
+
+ Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
+ String classifier );
+
+ Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope );
+
+ Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, boolean optional );
+
+ Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope );
+
+ Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope, boolean optional );
+
+ Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging );
+
+ Artifact createProjectArtifact( String groupId, String artifactId, String version );
+
+ Artifact createParentArtifact( String groupId, String artifactId, String version );
+
+ Artifact createPluginArtifact( String groupId, String artifactId, VersionRange versionRange );
+
+ Artifact createProjectArtifact( String groupId, String artifactId, String version, String scope );
+
+ Artifact createExtensionArtifact( String groupId, String artifactId, VersionRange versionRange );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
new file mode 100644
index 00000000..dfcac019
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
@@ -0,0 +1,160 @@
+package org.apache.maven.artifact.factory;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Component( role = ArtifactFactory.class )
+public class DefaultArtifactFactory
+ implements ArtifactFactory
+{
+ @Requirement
+ private ArtifactHandlerManager artifactHandlerManager;
+
+ public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
+ {
+ return createArtifact( groupId, artifactId, version, scope, type, null, null );
+ }
+
+ public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
+ String classifier )
+ {
+ return createArtifact( groupId, artifactId, version, null, type, classifier, null );
+ }
+
+ public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
+ String type, String classifier, String scope )
+ {
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null );
+ }
+
+ public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
+ String type, String classifier, String scope, boolean optional )
+ {
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional );
+ }
+
+ public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
+ String type, String classifier, String scope, String inheritedScope )
+ {
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
+ }
+
+ public Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
+ String type, String classifier, String scope, String inheritedScope,
+ boolean optional )
+ {
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, optional );
+ }
+
+ public Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging )
+ {
+ return createArtifact( groupId, artifactId, version, null, packaging, null, null );
+ }
+
+ public Artifact createProjectArtifact( String groupId, String artifactId, String version )
+ {
+ return createProjectArtifact( groupId, artifactId, version, null );
+ }
+
+ public Artifact createParentArtifact( String groupId, String artifactId, String version )
+ {
+ return createProjectArtifact( groupId, artifactId, version );
+ }
+
+ public Artifact createPluginArtifact( String groupId, String artifactId, VersionRange versionRange )
+ {
+ return createArtifact( groupId, artifactId, versionRange, "maven-plugin", null, Artifact.SCOPE_RUNTIME, null );
+ }
+
+ public Artifact createProjectArtifact( String groupId, String artifactId, String version, String scope )
+ {
+ return createArtifact( groupId, artifactId, version, scope, "pom" );
+ }
+
+ public Artifact createExtensionArtifact( String groupId, String artifactId, VersionRange versionRange )
+ {
+ return createArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null );
+ }
+
+ private Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type,
+ String classifier, String inheritedScope )
+ {
+ VersionRange versionRange = null;
+ if ( version != null )
+ {
+ versionRange = VersionRange.createFromVersion( version );
+ }
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
+ }
+
+ private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope )
+ {
+ return createArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false );
+ }
+
+ private Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope, boolean optional )
+ {
+ String desiredScope = Artifact.SCOPE_RUNTIME;
+
+ if ( inheritedScope == null )
+ {
+ desiredScope = scope;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_PROVIDED.equals( scope ) )
+ {
+ return null;
+ }
+ else if ( Artifact.SCOPE_COMPILE.equals( scope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
+ {
+ // added to retain compile artifactScope. Remove if you want compile inherited as runtime
+ desiredScope = Artifact.SCOPE_COMPILE;
+ }
+
+ if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
+ {
+ desiredScope = Artifact.SCOPE_TEST;
+ }
+
+ if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) )
+ {
+ desiredScope = Artifact.SCOPE_PROVIDED;
+ }
+
+ if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
+ {
+ // system scopes come through unchanged...
+ desiredScope = Artifact.SCOPE_SYSTEM;
+ }
+
+ ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
+
+ return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
+ optional );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
new file mode 100644
index 00000000..628f38bc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
@@ -0,0 +1,134 @@
+package org.apache.maven.artifact.handler;
+
+/*
+ * 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;
+
+/**
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @author Jason van Zyl
+ */
+@Component( role = ArtifactHandler.class )
+public class DefaultArtifactHandler
+ implements ArtifactHandler
+{
+ private String extension;
+
+ private String type;
+
+ private String classifier;
+
+ private String directory;
+
+ private String packaging;
+
+ private boolean includesDependencies;
+
+ private String language;
+
+ private boolean addedToClasspath;
+
+ public DefaultArtifactHandler()
+ {
+ }
+
+ public DefaultArtifactHandler( String type )
+ {
+ this.type = type;
+ }
+
+ public String getExtension()
+ {
+ if ( extension == null )
+ {
+ extension = type;
+ }
+ return extension;
+ }
+
+ public void setExtension( String extension )
+ {
+ this.extension = extension;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ public String getDirectory()
+ {
+ if ( directory == null )
+ {
+ directory = getPackaging() + "s";
+ }
+ return directory;
+ }
+
+ public String getPackaging()
+ {
+ if ( packaging == null )
+ {
+ packaging = type;
+ }
+ return packaging;
+ }
+
+ public boolean isIncludesDependencies()
+ {
+ return includesDependencies;
+ }
+
+ public void setIncludesDependencies( boolean includesDependencies )
+ {
+ this.includesDependencies = includesDependencies;
+ }
+
+ public String getLanguage()
+ {
+ if ( language == null )
+ {
+ language = "none";
+ }
+
+ return language;
+ }
+
+ public void setLanguage( String language )
+ {
+ this.language = language;
+ }
+
+ public boolean isAddedToClasspath()
+ {
+ return addedToClasspath;
+ }
+
+ public void setAddedToClasspath( boolean addedToClasspath )
+ {
+ this.addedToClasspath = addedToClasspath;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java
new file mode 100644
index 00000000..cada9e93
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/ArtifactHandlerManager.java
@@ -0,0 +1,37 @@
+package org.apache.maven.artifact.handler.manager;
+
+/*
+ * 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.Map;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface ArtifactHandlerManager
+{
+ String ROLE = ArtifactHandlerManager.class.getName();
+
+ ArtifactHandler getArtifactHandler( String type );
+
+ @Deprecated
+ void addHandlers( Map<String, ArtifactHandler> handlers );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java
new file mode 100644
index 00000000..6be636b0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/handler/manager/DefaultArtifactHandlerManager.java
@@ -0,0 +1,73 @@
+package org.apache.maven.artifact.handler.manager;
+
+/*
+ * 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.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * @author Jason van Zyl
+ */
+@Component( role = ArtifactHandlerManager.class )
+public class DefaultArtifactHandlerManager
+ implements ArtifactHandlerManager
+{
+
+ @Requirement( role = ArtifactHandler.class )
+ private Map<String, ArtifactHandler> artifactHandlers;
+
+ private Map<String, ArtifactHandler> unmanagedHandlers = new ConcurrentHashMap<String, ArtifactHandler>();
+
+ public ArtifactHandler getArtifactHandler( String type )
+ {
+ ArtifactHandler handler = unmanagedHandlers.get( type );
+
+ if ( handler == null )
+ {
+ handler = artifactHandlers.get( type );
+
+ if ( handler == null )
+ {
+ handler = new DefaultArtifactHandler( type );
+ }
+ }
+
+ return handler;
+ }
+
+ public void addHandlers( Map<String, ArtifactHandler> handlers )
+ {
+ // legacy support for maven-gpg-plugin:1.0
+ unmanagedHandlers.putAll( handlers );
+ }
+
+ @Deprecated
+ public Set<String> getHandlerTypes()
+ {
+ return artifactHandlers.keySet();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java
new file mode 100644
index 00000000..5ef3a980
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java
@@ -0,0 +1,33 @@
+package org.apache.maven.artifact.metadata;
+
+/*
+ * 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.artifact.Artifact;
+
+@Deprecated
+public abstract class AbstractArtifactMetadata
+ extends org.apache.maven.repository.legacy.metadata.AbstractArtifactMetadata
+ implements org.apache.maven.artifact.metadata.ArtifactMetadata
+{
+ protected AbstractArtifactMetadata( Artifact artifact )
+ {
+ super( artifact );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java
new file mode 100644
index 00000000..e419ef9e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java
@@ -0,0 +1,55 @@
+package org.apache.maven.artifact.metadata;
+
+/*
+ * 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.artifact.Artifact;
+
+@Deprecated
+public class ArtifactMetadataRetrievalException
+ extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException
+{
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( String message )
+ {
+ super( message, null, null );
+ }
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( Throwable cause )
+ {
+ super( null, cause, null );
+ }
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( String message,
+ Throwable cause )
+ {
+ super( message, cause, null );
+ }
+
+ public ArtifactMetadataRetrievalException( String message, Throwable cause, Artifact artifact )
+ {
+ super( message, cause, artifact );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
new file mode 100644
index 00000000..ccd58363
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
@@ -0,0 +1,52 @@
+package org.apache.maven.artifact.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
+
+@Deprecated
+public interface ArtifactMetadataSource
+ extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource
+{
+
+ ResolutionGroup retrieve( MetadataResolutionRequest request )
+ throws ArtifactMetadataRetrievalException;
+
+ ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException;
+
+ List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request )
+ throws ArtifactMetadataRetrievalException;
+
+ List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException;
+
+ List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
+ ArtifactRepository localRepository,
+ ArtifactRepository remoteRepository )
+ throws ArtifactMetadataRetrievalException;
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java
new file mode 100644
index 00000000..c219b24e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java
@@ -0,0 +1,46 @@
+package org.apache.maven.artifact.metadata;
+
+/*
+ * 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 java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+@Deprecated
+public class ResolutionGroup
+ extends org.apache.maven.repository.legacy.metadata.ResolutionGroup
+{
+
+ public ResolutionGroup( Artifact pomArtifact, Set<Artifact> artifacts,
+ List<ArtifactRepository> resolutionRepositories )
+ {
+ super( pomArtifact, artifacts, resolutionRepositories );
+ }
+
+ public ResolutionGroup( Artifact pomArtifact, Artifact relocatedArtifact, Set<Artifact> artifacts,
+ Map<String, Artifact> managedVersions, List<ArtifactRepository> resolutionRepositories )
+ {
+ super( pomArtifact, relocatedArtifact, artifacts, managedVersions, resolutionRepositories );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java
new file mode 100644
index 00000000..6b18789d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/DefaultRepositoryRequest.java
@@ -0,0 +1,134 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Collects basic settings to access the repository system.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultRepositoryRequest
+ implements RepositoryRequest
+{
+
+ private boolean offline;
+
+ private boolean forceUpdate;
+
+ private ArtifactRepository localRepository;
+
+ private List<ArtifactRepository> remoteRepositories;
+
+ /**
+ * Creates an empty repository request.
+ */
+ public DefaultRepositoryRequest()
+ {
+ // enables no-arg constructor
+ }
+
+ /**
+ * Creates a shallow copy of the specified repository request.
+ *
+ * @param repositoryRequest The repository request to copy from, must not be {@code null}.
+ */
+ public DefaultRepositoryRequest( RepositoryRequest repositoryRequest )
+ {
+ setLocalRepository( repositoryRequest.getLocalRepository() );
+ setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
+ setOffline( repositoryRequest.isOffline() );
+ setForceUpdate( repositoryRequest.isForceUpdate() );
+ }
+
+ public static RepositoryRequest getRepositoryRequest( MavenSession session, MavenProject project )
+ {
+ RepositoryRequest request = new DefaultRepositoryRequest();
+
+ request.setLocalRepository( session.getLocalRepository() );
+ if ( project != null )
+ {
+ request.setRemoteRepositories( project.getPluginArtifactRepositories() );
+ }
+ request.setOffline( session.isOffline() );
+ request.setForceUpdate( session.getRequest().isUpdateSnapshots() );
+
+ return request;
+ }
+
+ public boolean isOffline()
+ {
+ return offline;
+ }
+
+ public DefaultRepositoryRequest setOffline( boolean offline )
+ {
+ this.offline = offline;
+
+ return this;
+ }
+
+ public boolean isForceUpdate()
+ {
+ return forceUpdate;
+ }
+
+ public DefaultRepositoryRequest setForceUpdate( boolean forceUpdate )
+ {
+ this.forceUpdate = forceUpdate;
+
+ return this;
+ }
+
+ public ArtifactRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public DefaultRepositoryRequest setLocalRepository( ArtifactRepository localRepository )
+ {
+ this.localRepository = localRepository;
+
+ return this;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ if ( remoteRepositories == null )
+ {
+ remoteRepositories = new ArrayList<ArtifactRepository>();
+ }
+
+ return remoteRepositories;
+ }
+
+ public DefaultRepositoryRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
+ {
+ this.remoteRepositories = remoteRepositories;
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java
new file mode 100644
index 00000000..f56fb459
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java
@@ -0,0 +1,435 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * 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.List;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
+import org.apache.maven.repository.Proxy;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.metadata.Metadata;
+import org.eclipse.aether.repository.LocalArtifactRegistration;
+import org.eclipse.aether.repository.LocalArtifactRequest;
+import org.eclipse.aether.repository.LocalArtifactResult;
+import org.eclipse.aether.repository.LocalMetadataRegistration;
+import org.eclipse.aether.repository.LocalMetadataRequest;
+import org.eclipse.aether.repository.LocalMetadataResult;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.LocalRepositoryManager;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
+ * of the public API. In particular, this class can be changed or deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public class LegacyLocalRepositoryManager
+ implements LocalRepositoryManager
+{
+
+ private final ArtifactRepository delegate;
+
+ private final LocalRepository repo;
+
+ private final boolean realLocalRepo;
+
+ public static RepositorySystemSession overlay( ArtifactRepository repository, RepositorySystemSession session,
+ RepositorySystem system )
+ {
+ if ( repository == null || repository.getBasedir() == null )
+ {
+ return session;
+ }
+
+ if ( session != null )
+ {
+ LocalRepositoryManager lrm = session.getLocalRepositoryManager();
+ if ( lrm != null && lrm.getRepository().getBasedir().equals( new File( repository.getBasedir() ) ) )
+ {
+ return session;
+ }
+ }
+ else
+ {
+ session = new DefaultRepositorySystemSession();
+ }
+
+ final LocalRepositoryManager llrm = new LegacyLocalRepositoryManager( repository );
+
+ return new DefaultRepositorySystemSession( session ).setLocalRepositoryManager( llrm );
+ }
+
+ private LegacyLocalRepositoryManager( ArtifactRepository delegate )
+ {
+ if ( delegate == null )
+ {
+ throw new IllegalArgumentException( "local repository delegate missing" );
+ }
+ this.delegate = delegate;
+
+ ArtifactRepositoryLayout layout = delegate.getLayout();
+ repo =
+ new LocalRepository( new File( delegate.getBasedir() ),
+ ( layout != null ) ? layout.getClass().getSimpleName() : "legacy" );
+
+ /*
+ * NOTE: "invoker:install" vs "appassembler:assemble": Both mojos use the artifact installer to put an artifact
+ * into a repository. In the first case, the result needs to be a proper local repository that one can use for
+ * local artifact resolution. In the second case, the result needs to precisely obey the path information of the
+ * repository's layout to allow pointing at artifacts within the repository. Unfortunately,
+ * DefaultRepositoryLayout does not correctly describe the layout of a local repository which unlike a remote
+ * repository never uses timestamps in the filename of a snapshot artifact. The discrepancy gets notable when a
+ * remotely resolved snapshot artifact gets passed into pathOf(). So producing a proper local artifact path
+ * using DefaultRepositoryLayout requires us to enforce usage of the artifact's base version. This
+ * transformation however contradicts the other use case of precisely obeying the repository's layout. The below
+ * flag tries to detect which use case applies to make both plugins happy.
+ */
+ realLocalRepo = ( layout instanceof DefaultRepositoryLayout ) && "local".equals( delegate.getId() );
+ }
+
+ public LocalRepository getRepository()
+ {
+ return repo;
+ }
+
+ public String getPathForLocalArtifact( Artifact artifact )
+ {
+ if ( realLocalRepo )
+ {
+ return delegate.pathOf( RepositoryUtils.toArtifact( artifact.setVersion( artifact.getBaseVersion() ) ) );
+ }
+ return delegate.pathOf( RepositoryUtils.toArtifact( artifact ) );
+ }
+
+ public String getPathForRemoteArtifact( Artifact artifact, RemoteRepository repository, String context )
+ {
+ return delegate.pathOf( RepositoryUtils.toArtifact( artifact ) );
+ }
+
+ public String getPathForLocalMetadata( Metadata metadata )
+ {
+ return delegate.pathOfLocalRepositoryMetadata( new ArtifactMetadataAdapter( metadata ), delegate );
+ }
+
+ public String getPathForRemoteMetadata( Metadata metadata, RemoteRepository repository, String context )
+ {
+ return delegate.pathOfLocalRepositoryMetadata( new ArtifactMetadataAdapter( metadata ),
+ new ArtifactRepositoryAdapter( repository ) );
+ }
+
+ public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request )
+ {
+ String path = getPathForLocalArtifact( request.getArtifact() );
+ File file = new File( getRepository().getBasedir(), path );
+
+ LocalArtifactResult result = new LocalArtifactResult( request );
+ if ( file.isFile() )
+ {
+ result.setFile( file );
+ result.setAvailable( true );
+ }
+
+ return result;
+ }
+
+ public LocalMetadataResult find( RepositorySystemSession session, LocalMetadataRequest request )
+ {
+ Metadata metadata = request.getMetadata();
+
+ String path;
+ if ( request.getRepository() == null )
+ {
+ path = getPathForLocalMetadata( metadata );
+ }
+ else
+ {
+ path = getPathForRemoteMetadata( metadata, request.getRepository(), request.getContext() );
+ }
+
+ File file = new File( getRepository().getBasedir(), path );
+
+ LocalMetadataResult result = new LocalMetadataResult( request );
+ if ( file.isFile() )
+ {
+ result.setFile( file );
+ }
+
+ return result;
+ }
+
+ public void add( RepositorySystemSession session, LocalArtifactRegistration request )
+ {
+ // noop
+ }
+
+ public void add( RepositorySystemSession session, LocalMetadataRegistration request )
+ {
+ // noop
+ }
+
+ static class ArtifactMetadataAdapter
+ implements ArtifactMetadata
+ {
+
+ private final Metadata metadata;
+
+ public ArtifactMetadataAdapter( Metadata metadata )
+ {
+ this.metadata = metadata;
+ }
+
+ public boolean storedInArtifactVersionDirectory()
+ {
+ return metadata.getVersion().length() > 0;
+ }
+
+ public boolean storedInGroupDirectory()
+ {
+ return metadata.getArtifactId().length() <= 0;
+ }
+
+ public String getGroupId()
+ {
+ return nullify( metadata.getGroupId() );
+ }
+
+ public String getArtifactId()
+ {
+ return nullify( metadata.getArtifactId() );
+ }
+
+ public String getBaseVersion()
+ {
+ return nullify( metadata.getVersion() );
+ }
+
+ private String nullify( String str )
+ {
+ return ( str == null || str.length() <= 0 ) ? null : str;
+ }
+
+ public Object getKey()
+ {
+ return metadata.toString();
+ }
+
+ public String getRemoteFilename()
+ {
+ return metadata.getType();
+ }
+
+ public String getLocalFilename( ArtifactRepository repository )
+ {
+ return insertRepositoryKey( getRemoteFilename(), repository.getKey() );
+ }
+
+ private String insertRepositoryKey( String filename, String repositoryKey )
+ {
+ String result;
+ int idx = filename.indexOf( '.' );
+ if ( idx < 0 )
+ {
+ result = filename + '-' + repositoryKey;
+ }
+ else
+ {
+ result = filename.substring( 0, idx ) + '-' + repositoryKey + filename.substring( idx );
+ }
+ return result;
+ }
+
+ public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata )
+ {
+ // not used
+ }
+
+ public void merge( ArtifactMetadata metadata )
+ {
+ // not used
+ }
+
+ public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository )
+ throws RepositoryMetadataStoreException
+ {
+ // not used
+ }
+
+ public String extendedToString()
+ {
+ return metadata.toString();
+ }
+
+ }
+
+ static class ArtifactRepositoryAdapter
+ implements ArtifactRepository
+ {
+
+ private final RemoteRepository repository;
+
+ public ArtifactRepositoryAdapter( RemoteRepository repository )
+ {
+ this.repository = repository;
+ }
+
+ public String pathOf( org.apache.maven.artifact.Artifact artifact )
+ {
+ return null;
+ }
+
+ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+ {
+ return null;
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ return null;
+ }
+
+ public String getUrl()
+ {
+ return repository.getUrl();
+ }
+
+ public void setUrl( String url )
+ {
+ }
+
+ public String getBasedir()
+ {
+ return null;
+ }
+
+ public String getProtocol()
+ {
+ return repository.getProtocol();
+ }
+
+ public String getId()
+ {
+ return repository.getId();
+ }
+
+ public void setId( String id )
+ {
+ }
+
+ public ArtifactRepositoryPolicy getSnapshots()
+ {
+ return null;
+ }
+
+ public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy )
+ {
+ }
+
+ public ArtifactRepositoryPolicy getReleases()
+ {
+ return null;
+ }
+
+ public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy )
+ {
+ }
+
+ public ArtifactRepositoryLayout getLayout()
+ {
+ return null;
+ }
+
+ public void setLayout( ArtifactRepositoryLayout layout )
+ {
+ }
+
+ public String getKey()
+ {
+ return getId();
+ }
+
+ public boolean isUniqueVersion()
+ {
+ return true;
+ }
+
+ public boolean isBlacklisted()
+ {
+ return false;
+ }
+
+ public void setBlacklisted( boolean blackListed )
+ {
+ }
+
+ public org.apache.maven.artifact.Artifact find( org.apache.maven.artifact.Artifact artifact )
+ {
+ return null;
+ }
+
+ public List<String> findVersions( org.apache.maven.artifact.Artifact artifact )
+ {
+ return Collections.emptyList();
+ }
+
+ public boolean isProjectAware()
+ {
+ return false;
+ }
+
+ public void setAuthentication( Authentication authentication )
+ {
+ }
+
+ public Authentication getAuthentication()
+ {
+ return null;
+ }
+
+ public void setProxy( Proxy proxy )
+ {
+ }
+
+ public Proxy getProxy()
+ {
+ return null;
+ }
+
+ public List<ArtifactRepository> getMirroredRepositories()
+ {
+ return Collections.emptyList();
+ }
+
+ public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories )
+ {
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
new file mode 100644
index 00000000..8e45b203
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
@@ -0,0 +1,412 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * 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.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.repository.Proxy;
+
+//TODO: completely separate local and remote artifact repositories
+public class MavenArtifactRepository
+ implements ArtifactRepository
+{
+ private String id;
+
+ private String url;
+
+ private String basedir;
+
+ private String protocol;
+
+ private ArtifactRepositoryLayout layout;
+
+ private ArtifactRepositoryPolicy snapshots;
+
+ private ArtifactRepositoryPolicy releases;
+
+ private Authentication authentication;
+
+ private Proxy proxy;
+
+ private List<ArtifactRepository> mirroredRepositories = Collections.emptyList();
+
+ public MavenArtifactRepository()
+ {
+ }
+
+ /**
+ * Create a remote download repository.
+ *
+ * @param id the unique identifier of the repository
+ * @param url the URL of the repository
+ * @param layout the layout of the repository
+ * @param snapshots the policies to use for snapshots
+ * @param releases the policies to use for releases
+ */
+ public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout,
+ ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
+ {
+ this.id = id;
+ this.url = url;
+ this.layout = layout;
+ this.snapshots = snapshots;
+ this.releases = releases;
+ //
+ // Derive these from the URL
+ //
+ this.protocol = protocol( url );
+ this.basedir = basedir( url );
+ }
+
+ public String pathOf( Artifact artifact )
+ {
+ return layout.pathOf( artifact );
+ }
+
+ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+ {
+ return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ return layout.pathOfLocalRepositoryMetadata( metadata, repository );
+ }
+
+ public void setLayout( ArtifactRepositoryLayout layout )
+ {
+ this.layout = layout;
+ }
+
+ public ArtifactRepositoryLayout getLayout()
+ {
+ return layout;
+ }
+
+ public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy snapshots )
+ {
+ this.snapshots = snapshots;
+ }
+
+ public ArtifactRepositoryPolicy getSnapshots()
+ {
+ return snapshots;
+ }
+
+ public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy releases )
+ {
+ this.releases = releases;
+ }
+
+ public ArtifactRepositoryPolicy getReleases()
+ {
+ return releases;
+ }
+
+ public String getKey()
+ {
+ return getId();
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( " id: " ).append( getId() ).append( "\n" );
+ sb.append( " url: " ).append( getUrl() ).append( "\n" );
+ sb.append( " layout: " ).append( layout != null ? layout : "none" ).append( "\n" );
+
+ if ( proxy != null )
+ {
+ sb.append( " proxy: " ).append( proxy.getHost() ).append( ":" ).append( proxy.getPort() ).append( "\n" );
+ }
+
+ if ( snapshots != null )
+ {
+ sb.append( "snapshots: [enabled => " ).append( snapshots.isEnabled() );
+ sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]\n" );
+ }
+
+ if ( releases != null )
+ {
+ sb.append( " releases: [enabled => " ).append( releases.isEnabled() );
+ sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" );
+ }
+
+ return sb.toString();
+ }
+
+ public Artifact find( Artifact artifact )
+ {
+ File artifactFile = new File( getBasedir(), pathOf( artifact ) );
+
+ // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
+ // with multiple local repository implementations yet.
+ artifact.setFile( artifactFile );
+
+ return artifact;
+ }
+
+ public List<String> findVersions( Artifact artifact )
+ {
+ return Collections.emptyList();
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public String getBasedir()
+ {
+ return basedir;
+ }
+
+ public String getProtocol()
+ {
+ return protocol;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ public void setUrl( String url )
+ {
+ this.url = url;
+
+ this.protocol = protocol( url );
+ this.basedir = basedir( url );
+ }
+
+ // Path Utils
+
+ /**
+ * Return the protocol name.
+ * <br/>
+ * E.g: for input
+ * <code>http://www.codehause.org</code> this method will return <code>http</code>
+ *
+ * @param url the url
+ * @return the host name
+ */
+ private static String protocol( final String url )
+ {
+ final int pos = url.indexOf( ":" );
+
+ if ( pos == -1 )
+ {
+ return "";
+ }
+ return url.substring( 0, pos ).trim();
+ }
+
+ /**
+ * Derive the path portion of the given URL.
+ *
+ * @param url the repository URL
+ * @return the basedir of the repository
+ * @todo need to URL decode for spaces?
+ */
+ private String basedir( String url )
+ {
+ String retValue = null;
+
+ if ( protocol.equalsIgnoreCase( "file" ) )
+ {
+ retValue = url.substring( protocol.length() + 1 );
+ retValue = decode( retValue );
+ // special case: if omitted // on protocol, keep path as is
+ if ( retValue.startsWith( "//" ) )
+ {
+ retValue = retValue.substring( 2 );
+
+ if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
+ {
+ // special case: if there is a windows drive letter, then keep the original return value
+ retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+ }
+ else
+ {
+ // Now we expect the host
+ int index = retValue.indexOf( "/" );
+ if ( index >= 0 )
+ {
+ retValue = retValue.substring( index + 1 );
+ }
+
+ // special case: if there is a windows drive letter, then keep the original return value
+ if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
+ {
+ retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+ }
+ else if ( index >= 0 )
+ {
+ // leading / was previously stripped
+ retValue = "/" + retValue;
+ }
+ }
+ }
+
+ // special case: if there is a windows drive letter using |, switch to :
+ if ( retValue.length() >= 2 && retValue.charAt( 1 ) == '|' )
+ {
+ retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+ }
+
+ // normalize separators
+ retValue = new File( retValue ).getPath();
+ }
+
+ if ( retValue == null )
+ {
+ retValue = "/";
+ }
+ return retValue.trim();
+ }
+
+ /**
+ * Decodes the specified (portion of a) URL. <strong>Note:</strong> This decoder assumes that ISO-8859-1 is used to
+ * convert URL-encoded bytes to characters.
+ *
+ * @param url The URL to decode, may be <code>null</code>.
+ * @return The decoded URL or <code>null</code> if the input was <code>null</code>.
+ */
+ private static String decode( String url )
+ {
+ String decoded = url;
+ if ( url != null )
+ {
+ int pos = -1;
+ while ( ( pos = decoded.indexOf( '%', pos + 1 ) ) >= 0 )
+ {
+ if ( pos + 2 < decoded.length() )
+ {
+ String hexStr = decoded.substring( pos + 1, pos + 3 );
+ char ch = (char) Integer.parseInt( hexStr, 16 );
+ decoded = decoded.substring( 0, pos ) + ch + decoded.substring( pos + 3 );
+ }
+ }
+ }
+ return decoded;
+ }
+
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( getId() == null ) ? 0 : getId().hashCode() );
+ return result;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( obj == null )
+ {
+ return false;
+ }
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ ArtifactRepository other = (ArtifactRepository) obj;
+
+ return eq( getId(), other.getId() );
+ }
+
+ protected static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ public Authentication getAuthentication()
+ {
+ return authentication;
+ }
+
+ public void setAuthentication( Authentication authentication )
+ {
+ this.authentication = authentication;
+ }
+
+ public Proxy getProxy()
+ {
+ return proxy;
+ }
+
+ public void setProxy( Proxy proxy )
+ {
+ this.proxy = proxy;
+ }
+
+ public boolean isBlacklisted()
+ {
+ return false;
+ }
+
+ public void setBlacklisted( boolean blackListed )
+ {
+ // no op
+ }
+
+ public boolean isUniqueVersion()
+ {
+ return true;
+ }
+
+ public boolean isProjectAware()
+ {
+ return false;
+ }
+
+ public List<ArtifactRepository> getMirroredRepositories()
+ {
+ return mirroredRepositories;
+ }
+
+ public void setMirroredRepositories( List<ArtifactRepository> mirroredRepositories )
+ {
+ if ( mirroredRepositories != null )
+ {
+ this.mirroredRepositories = mirroredRepositories;
+ }
+ else
+ {
+ this.mirroredRepositories = Collections.emptyList();
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java
new file mode 100644
index 00000000..bf79d698
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryCache.java
@@ -0,0 +1,58 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * 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 repository access like already processed metadata. The data in the cache is meant
+ * for exclusive consumption by the repository system and is opaque to the cache implementation.
+ *
+ * @author Benjamin Bentmann
+ */
+@Deprecated
+//
+// Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+// this here, possibly indefinitely.
+//
+public interface RepositoryCache
+{
+
+ /**
+ * Puts the specified data into the cache. <strong>Warning:</strong> The cache will directly save the provided
+ * reference. If the cached data is mutable, i.e. could be modified after being put into the cache, the caller is
+ * responsible for creating a copy of the original data and store the copy in the cache.
+ *
+ * @param request The repository request from which this cache was retrieved, must not be {@code null}.
+ * @param key The key to use associate the data with, must not be {@code null}.
+ * @param data The data to store in the cache, may be {@code null}.
+ */
+ void put( RepositoryRequest request, Object key, Object data );
+
+ /**
+ * Gets the specified data from the cache. <strong>Warning:</strong> The cache will directly return the saved
+ * reference. If the cached data is to be modified after its retrieval, the caller is responsible to create a copy
+ * of the returned data and use this instead of the cache record.
+ *
+ * @param request The repository request from which this cache was retrieved, must not be {@code null}.
+ * @param key The key to use for lookup of the data, must not be {@code null}.
+ * @return The requested data or {@code null} if none was present in the cache.
+ */
+ Object get( RepositoryRequest request, Object key );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryRequest.java
new file mode 100644
index 00000000..55f60686
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/RepositoryRequest.java
@@ -0,0 +1,95 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * 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;
+
+/**
+ * Collects basic settings to access the repository system.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface RepositoryRequest
+{
+
+ /**
+ * Indicates whether network access to remote repositories has been disabled.
+ *
+ * @return {@code true} if remote access has been disabled, {@code false} otherwise.
+ */
+ boolean isOffline();
+
+ /**
+ * Enables/disables network access to remote repositories.
+ *
+ * @param offline {@code true} to disable remote access, {@code false} to allow network access.
+ * @return This request, never {@code null}.
+ */
+ RepositoryRequest setOffline( boolean offline );
+
+ /**
+ * Indicates whether remote repositories should be re-checked for updated artifacts/metadata regardless of their
+ * configured update policy.
+ *
+ * @return {@code true} if remote repositories should be re-checked for updated artifacts/metadata, {@code false}
+ * otherwise.
+ */
+ boolean isForceUpdate();
+
+ /**
+ * Enables/disabled forced checks for updated artifacts/metadata on remote repositories.
+ *
+ * @param forceUpdate {@code true} to forcibly check the remote repositories for updated artifacts/metadata, {@code
+ * false} to use the update policy configured on each repository.
+ * @return This request, never {@code null}.
+ */
+ RepositoryRequest setForceUpdate( boolean forceUpdate );
+
+ /**
+ * Gets the local repository to use.
+ *
+ * @return The local repository to use or {@code null} if not set.
+ */
+ ArtifactRepository getLocalRepository();
+
+ /**
+ * Sets the local repository to use.
+ *
+ * @param localRepository The local repository to use.
+ * @return This request, never {@code null}.
+ */
+ RepositoryRequest setLocalRepository( ArtifactRepository localRepository );
+
+ /**
+ * Gets the remote repositories to use.
+ *
+ * @return The remote repositories to use, never {@code null}.
+ */
+ List<ArtifactRepository> getRemoteRepositories();
+
+ /**
+ * Sets the remote repositories to use.
+ *
+ * @param remoteRepositories The remote repositories to use.
+ * @return This request, never {@code null}.
+ */
+ RepositoryRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
new file mode 100644
index 00000000..70c0b14c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
@@ -0,0 +1,112 @@
+package org.apache.maven.artifact.repository.layout;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * @author jdcasey
+ */
+@Component( role = ArtifactRepositoryLayout.class, hint = "default" )
+public class DefaultRepositoryLayout
+ implements ArtifactRepositoryLayout
+{
+ private static final char PATH_SEPARATOR = '/';
+
+ private static final char GROUP_SEPARATOR = '.';
+
+ private static final char ARTIFACT_SEPARATOR = '-';
+
+ public String getId()
+ {
+ return "default";
+ }
+
+ public String pathOf( Artifact artifact )
+ {
+ ArtifactHandler artifactHandler = artifact.getArtifactHandler();
+
+ StringBuilder path = new StringBuilder( 128 );
+
+ path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
+ path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
+ path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
+ path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
+
+ if ( artifact.hasClassifier() )
+ {
+ path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
+ }
+
+ if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
+ {
+ path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
+ }
+
+ return path.toString();
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
+ }
+
+ private String pathOfRepositoryMetadata( ArtifactMetadata metadata,
+ String filename )
+ {
+ StringBuilder path = new StringBuilder( 128 );
+
+ path.append( formatAsDirectory( metadata.getGroupId() ) ).append( PATH_SEPARATOR );
+ if ( !metadata.storedInGroupDirectory() )
+ {
+ path.append( metadata.getArtifactId() ).append( PATH_SEPARATOR );
+
+ if ( metadata.storedInArtifactVersionDirectory() )
+ {
+ path.append( metadata.getBaseVersion() ).append( PATH_SEPARATOR );
+ }
+ }
+
+ path.append( filename );
+
+ return path.toString();
+ }
+
+ public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
+ {
+ return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
+ }
+
+ private String formatAsDirectory( String directory )
+ {
+ return directory.replace( GROUP_SEPARATOR, PATH_SEPARATOR );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getId();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
new file mode 100644
index 00000000..e1e5fe3f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
@@ -0,0 +1,255 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.Reader;
+import java.io.Writer;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.WriterFactory;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Shared methods of the repository metadata handling.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractRepositoryMetadata
+ implements RepositoryMetadata
+{
+ private Metadata metadata;
+
+ protected AbstractRepositoryMetadata( Metadata metadata )
+ {
+ this.metadata = metadata;
+ }
+
+ public String getRemoteFilename()
+ {
+ return "maven-metadata.xml";
+ }
+
+ public String getLocalFilename( ArtifactRepository repository )
+ {
+ return "maven-metadata-" + repository.getKey() + ".xml";
+ }
+
+ public void storeInLocalRepository( ArtifactRepository localRepository,
+ ArtifactRepository remoteRepository )
+ throws RepositoryMetadataStoreException
+ {
+ try
+ {
+ updateRepositoryMetadata( localRepository, remoteRepository );
+ }
+ catch ( IOException e )
+ {
+ throw new RepositoryMetadataStoreException( "Error updating group repository metadata", e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new RepositoryMetadataStoreException( "Error updating group repository metadata", e );
+ }
+ }
+
+ protected void updateRepositoryMetadata( ArtifactRepository localRepository,
+ ArtifactRepository remoteRepository )
+ throws IOException, XmlPullParserException
+ {
+ MetadataXpp3Reader mappingReader = new MetadataXpp3Reader();
+
+ Metadata metadata = null;
+
+ File metadataFile = new File( localRepository.getBasedir(),
+ localRepository.pathOfLocalRepositoryMetadata( this, remoteRepository ) );
+
+ if ( metadataFile.length() == 0 )
+ {
+ if ( !metadataFile.delete() )
+ {
+ // sleep for 10ms just in case this is windows holding a file lock
+ try
+ {
+ Thread.sleep( 10 );
+ }
+ catch ( InterruptedException e )
+ {
+ // ignore
+ }
+ metadataFile.delete(); // if this fails, forget about it, we'll try to overwrite it anyway so no need
+ // to delete on exit
+ }
+ }
+ else if ( metadataFile.exists() )
+ {
+ Reader reader = null;
+
+ try
+ {
+ reader = ReaderFactory.newXmlReader( metadataFile );
+
+ metadata = mappingReader.read( reader, false );
+ }
+ finally
+ {
+ IOUtil.close( reader );
+ }
+ }
+
+ boolean changed;
+
+ // If file could not be found or was not valid, start from scratch
+ if ( metadata == null )
+ {
+ metadata = this.metadata;
+
+ changed = true;
+ }
+ else
+ {
+ changed = metadata.merge( this.metadata );
+ }
+
+ // beware meta-versions!
+ String version = metadata.getVersion();
+ if ( version != null && ( Artifact.LATEST_VERSION.equals( version ) || Artifact.RELEASE_VERSION.equals(
+ version ) ) )
+ {
+ // meta-versions are not valid <version/> values...don't write them.
+ metadata.setVersion( null );
+ }
+
+ if ( changed || !metadataFile.exists() )
+ {
+ Writer writer = null;
+ try
+ {
+ metadataFile.getParentFile().mkdirs();
+ writer = WriterFactory.newXmlWriter( metadataFile );
+
+ MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer();
+
+ mappingWriter.write( writer, metadata );
+ }
+ finally
+ {
+ IOUtil.close( writer );
+ }
+ }
+ else
+ {
+ metadataFile.setLastModified( System.currentTimeMillis() );
+ }
+ }
+
+ public String toString()
+ {
+ return "repository metadata for: \'" + getKey() + "\'";
+ }
+
+ protected static Metadata createMetadata( Artifact artifact,
+ Versioning versioning )
+ {
+ Metadata metadata = new Metadata();
+ metadata.setGroupId( artifact.getGroupId() );
+ metadata.setArtifactId( artifact.getArtifactId() );
+ metadata.setVersion( artifact.getVersion() );
+ metadata.setVersioning( versioning );
+ return metadata;
+ }
+
+ protected static Versioning createVersioning( Snapshot snapshot )
+ {
+ Versioning versioning = new Versioning();
+ versioning.setSnapshot( snapshot );
+ versioning.updateTimestamp();
+ return versioning;
+ }
+
+ public void setMetadata( Metadata metadata )
+ {
+ this.metadata = metadata;
+ }
+
+ public Metadata getMetadata()
+ {
+ return metadata;
+ }
+
+ public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata )
+ {
+ // TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces?
+ AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata;
+ this.metadata.merge( repoMetadata.getMetadata() );
+ }
+
+ public void merge( ArtifactMetadata metadata )
+ {
+ // TODO: not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact replaces?
+ AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata;
+ this.metadata.merge( repoMetadata.getMetadata() );
+ }
+
+ public String extendedToString()
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append( "\nRepository Metadata\n--------------------------" );
+ buffer.append( "\nGroupId: " ).append( getGroupId() );
+ buffer.append( "\nArtifactId: " ).append( getArtifactId() );
+ buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
+
+ return buffer.toString();
+ }
+
+ public int getNature()
+ {
+ return RELEASE;
+ }
+
+ public ArtifactRepositoryPolicy getPolicy( ArtifactRepository repository )
+ {
+ int nature = getNature();
+ if ( ( nature & RepositoryMetadata.RELEASE_OR_SNAPSHOT ) == RepositoryMetadata.RELEASE_OR_SNAPSHOT )
+ {
+ ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( repository.getReleases() );
+ policy.merge( repository.getSnapshots() );
+ return policy;
+ }
+ else if ( ( nature & RepositoryMetadata.SNAPSHOT ) != 0 )
+ {
+ return repository.getSnapshots();
+ }
+ else
+ {
+ return repository.getReleases();
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java
new file mode 100644
index 00000000..85fc6018
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java
@@ -0,0 +1,129 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.Restriction;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+/**
+ * Metadata for the artifact directory of the repository.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ArtifactRepositoryMetadata
+ extends AbstractRepositoryMetadata
+{
+ private Artifact artifact;
+
+ public ArtifactRepositoryMetadata( Artifact artifact )
+ {
+ this( artifact, null );
+ }
+
+ public ArtifactRepositoryMetadata( Artifact artifact,
+ Versioning versioning )
+ {
+ super( createMetadata( artifact, versioning ) );
+ this.artifact = artifact;
+ }
+
+ public boolean storedInGroupDirectory()
+ {
+ return false;
+ }
+
+ public boolean storedInArtifactVersionDirectory()
+ {
+ return false;
+ }
+
+ public String getGroupId()
+ {
+ return artifact.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return artifact.getArtifactId();
+ }
+
+ public String getBaseVersion()
+ {
+ // Don't want the artifact's version in here, as this is stored in the directory above that
+ return null;
+ }
+
+ public Object getKey()
+ {
+ return "artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId();
+ }
+
+ public boolean isSnapshot()
+ {
+ // Don't consider the artifact's version in here, as this is stored in the directory above that
+ return false;
+ }
+
+ public int getNature()
+ {
+ if ( artifact.getVersion() != null )
+ {
+ return artifact.isSnapshot() ? SNAPSHOT : RELEASE;
+ }
+
+ VersionRange range = artifact.getVersionRange();
+ if ( range != null )
+ {
+ for ( Restriction restriction : range.getRestrictions() )
+ {
+ if ( isSnapshot( restriction.getLowerBound() ) || isSnapshot( restriction.getUpperBound() ) )
+ {
+ return RELEASE_OR_SNAPSHOT;
+ }
+ }
+ }
+
+ return RELEASE;
+ }
+
+ private boolean isSnapshot( ArtifactVersion version )
+ {
+ return version != null && ArtifactUtils.isSnapshot( version.getQualifier() );
+ }
+
+ public ArtifactRepository getRepository()
+ {
+ return null;
+ }
+
+ public void setRepository( ArtifactRepository remoteRepository )
+ {
+ /*
+ * NOTE: Metadata at the g:a level contains a collection of available versions. After merging, we can't tell
+ * which repository provides which version so the metadata manager must not restrict the artifact resolution to
+ * the repository with the most recent updates.
+ */
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java
new file mode 100644
index 00000000..22e3ade8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java
@@ -0,0 +1,92 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+
+/**
+ * Describes repository directory metadata.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @todo not happy about the store method - they use "this"
+ */
+public interface RepositoryMetadata
+ extends org.apache.maven.artifact.metadata.ArtifactMetadata
+{
+
+ int RELEASE = 1;
+
+ int SNAPSHOT = 2;
+
+ int RELEASE_OR_SNAPSHOT = RELEASE | SNAPSHOT;
+
+ /**
+ * Get the repository the metadata was located in.
+ *
+ * @return the repository
+ */
+ ArtifactRepository getRepository();
+
+ /**
+ * Set the repository the metadata was located in.
+ *
+ * @param remoteRepository the repository
+ */
+ void setRepository( ArtifactRepository remoteRepository );
+
+ /**
+ * Get the repository metadata associated with this marker.
+ *
+ * @return the metadata, or <code>null</code> if none loaded
+ */
+ Metadata getMetadata();
+
+ /**
+ * Set the metadata contents.
+ *
+ * @param metadata the metadata
+ */
+ void setMetadata( Metadata metadata );
+
+ /**
+ * Whether this represents a snapshot.
+ *
+ * @return if it is a snapshot
+ */
+ boolean isSnapshot();
+
+ /**
+ * Gets the artifact quality this metadata refers to. One of {@link #RELEASE}, {@link #SNAPSHOT} or
+ * {@link #RELEASE_OR_SNAPSHOT}.
+ *
+ * @return The artifact quality this metadata refers to.
+ */
+ int getNature();
+
+ /**
+ * Gets the policy that applies to this metadata regarding the specified repository.
+ *
+ * @param repository The repository for which to determine the policy, must not be {@code null}.
+ * @return The policy, never {@code null}.
+ */
+ ArtifactRepositoryPolicy getPolicy( ArtifactRepository repository );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java
new file mode 100644
index 00000000..94545650
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java
@@ -0,0 +1,40 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.
+ */
+
+/**
+ * Error while deploying repository metadata.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class RepositoryMetadataDeploymentException
+ extends Throwable
+{
+ public RepositoryMetadataDeploymentException( String message )
+ {
+ super( message );
+ }
+
+ public RepositoryMetadataDeploymentException( String message,
+ Exception e )
+ {
+ super( message, e );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java
new file mode 100644
index 00000000..55bb57ed
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java
@@ -0,0 +1,40 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.
+ */
+
+/**
+ * Error while installing repository metadata.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class RepositoryMetadataInstallationException
+ extends Throwable
+{
+ public RepositoryMetadataInstallationException( String message )
+ {
+ super( message );
+ }
+
+ public RepositoryMetadataInstallationException( String message,
+ Exception e )
+ {
+ super( message, e );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java
new file mode 100644
index 00000000..35626e58
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java
@@ -0,0 +1,61 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryRequest;
+
+public interface RepositoryMetadataManager
+{
+
+ void resolve( RepositoryMetadata repositoryMetadata, RepositoryRequest repositoryRequest )
+ throws RepositoryMetadataResolutionException;
+
+ void resolve( RepositoryMetadata repositoryMetadata, List<ArtifactRepository> repositories,
+ ArtifactRepository localRepository )
+ throws RepositoryMetadataResolutionException;
+
+ void resolveAlways( RepositoryMetadata metadata, ArtifactRepository localRepository,
+ ArtifactRepository remoteRepository )
+ throws RepositoryMetadataResolutionException;
+
+ /**
+ * Deploy metadata to the remote repository.
+ *
+ * @param metadata the metadata to deploy
+ * @param localRepository the local repository to install to first
+ * @param deploymentRepository the remote repository to deploy to
+ */
+ void deploy( ArtifactMetadata metadata, ArtifactRepository localRepository,
+ ArtifactRepository deploymentRepository )
+ throws RepositoryMetadataDeploymentException;
+
+ /**
+ * Install the metadata in the local repository.
+ *
+ * @param metadata the metadata
+ * @param localRepository the local repository
+ */
+ void install( ArtifactMetadata metadata, ArtifactRepository localRepository )
+ throws RepositoryMetadataInstallationException;
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java
new file mode 100644
index 00000000..8a6f38d4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java
@@ -0,0 +1,40 @@
+package org.apache.maven.artifact.repository.metadata;
+
+/*
+ * 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.
+ */
+
+/**
+ * Error while retrieving repository metadata from the repository.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class RepositoryMetadataResolutionException
+ extends Exception
+{
+ public RepositoryMetadataResolutionException( String message )
+ {
+ super( message );
+ }
+
+ public RepositoryMetadataResolutionException( String message,
+ Exception e )
+ {
+ super( message, e );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java
new file mode 100644
index 00000000..6a1578d8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/DefaultMetadataReader.java
@@ -0,0 +1,110 @@
+package org.apache.maven.artifact.repository.metadata.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.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
+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 metadata from some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = MetadataReader.class )
+public class DefaultMetadataReader
+ implements MetadataReader
+{
+
+ public Metadata read( File input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input file missing" );
+ }
+
+ Metadata metadata = read( ReaderFactory.newXmlReader( input ), options );
+
+ return metadata;
+ }
+
+ public Metadata read( Reader input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input reader missing" );
+ }
+
+ try
+ {
+ MetadataXpp3Reader r = new MetadataXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ public Metadata read( InputStream input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input stream missing" );
+ }
+
+ try
+ {
+ MetadataXpp3Reader r = new MetadataXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ private boolean isStrict( Map<String, ?> options )
+ {
+ Object value = ( options != null ) ? options.get( IS_STRICT ) : null;
+ return value == null || Boolean.parseBoolean( value.toString() );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataParseException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataParseException.java
new file mode 100644
index 00000000..e3e141b1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataParseException.java
@@ -0,0 +1,93 @@
+package org.apache.maven.artifact.repository.metadata.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 metadata due to invalid syntax (e.g. non-wellformed XML or unknown elements).
+ *
+ * @author Benjamin Bentmann
+ */
+public class MetadataParseException
+ 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 MetadataParseException( 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 MetadataParseException( 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-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java
new file mode 100644
index 00000000..232246fd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/repository/metadata/io/MetadataReader.java
@@ -0,0 +1,82 @@
+package org.apache.maven.artifact.repository.metadata.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.artifact.repository.metadata.Metadata;
+
+/**
+ * Handles deserialization of metadata from some kind of textual format like XML.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface MetadataReader
+{
+
+ /**
+ * 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.artifact.repository.metadata.io.isStrict";
+
+ /**
+ * Reads the metadata from the specified file.
+ *
+ * @param input The file to deserialize the metadata 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 metadata, never {@code null}.
+ * @throws IOException If the metadata could not be deserialized.
+ * @throws MetadataParseException If the input format could not be parsed.
+ */
+ Metadata read( File input, Map<String, ?> options )
+ throws IOException, MetadataParseException;
+
+ /**
+ * Reads the metadata from the specified character reader. The reader will be automatically closed before the method
+ * returns.
+ *
+ * @param input The reader to deserialize the metadata 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 metadata, never {@code null}.
+ * @throws IOException If the metadata could not be deserialized.
+ * @throws MetadataParseException If the input format could not be parsed.
+ */
+ Metadata read( Reader input, Map<String, ?> options )
+ throws IOException, MetadataParseException;
+
+ /**
+ * Reads the metadata from the specified byte stream. The stream will be automatically closed before the method
+ * returns.
+ *
+ * @param input The stream to deserialize the metadata 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 metadata, never {@code null}.
+ * @throws IOException If the metadata could not be deserialized.
+ * @throws MetadataParseException If the input format could not be parsed.
+ */
+ Metadata read( InputStream input, Map<String, ?> options )
+ throws IOException, MetadataParseException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
new file mode 100644
index 00000000..050ec478
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java
@@ -0,0 +1,329 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryCache;
+import org.apache.maven.artifact.repository.RepositoryRequest;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+
+/**
+ * A resolution request allows you to either use an existing MavenProject, or a coordinate (gid:aid:version)
+ * to process a POMs dependencies.
+ *
+ * @author Jason van Zyl
+ */
+public class ArtifactResolutionRequest
+ implements RepositoryRequest
+{
+
+ private Artifact artifact;
+
+ // Needs to go away
+ // These are really overrides now, projects defining dependencies for a plugin that override what is
+ // specified in the plugin itself.
+ private Set<Artifact> artifactDependencies;
+
+ private ArtifactRepository localRepository;
+
+ private List<ArtifactRepository> remoteRepositories;
+
+ private ArtifactFilter collectionFilter;
+
+ private ArtifactFilter resolutionFilter;
+
+ // Needs to go away
+ private List<ResolutionListener> listeners = new ArrayList<ResolutionListener>();
+
+ // This is like a filter but overrides all transitive versions
+ private Map<String, Artifact> managedVersionMap;
+
+ private boolean resolveRoot = true;
+
+ private boolean resolveTransitively = false;
+
+ private boolean offline;
+
+ private boolean forceUpdate;
+
+ private List<Server> servers;
+
+ private List<Mirror> mirrors;
+
+ private List<Proxy> proxies;
+
+ public ArtifactResolutionRequest()
+ {
+ // nothing here
+ }
+
+ public ArtifactResolutionRequest( RepositoryRequest request )
+ {
+ setLocalRepository( request.getLocalRepository() );
+ setRemoteRepositories( request.getRemoteRepositories() );
+ setOffline( request.isOffline() );
+ setForceUpdate( request.isForceUpdate() );
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public ArtifactResolutionRequest setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+
+ return this;
+ }
+
+ public ArtifactResolutionRequest setArtifactDependencies( Set<Artifact> artifactDependencies )
+ {
+ this.artifactDependencies = artifactDependencies;
+
+ return this;
+ }
+
+ public Set<Artifact> getArtifactDependencies()
+ {
+ return artifactDependencies;
+ }
+
+ public ArtifactRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public ArtifactResolutionRequest setLocalRepository( ArtifactRepository localRepository )
+ {
+ this.localRepository = localRepository;
+
+ return this;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ return remoteRepositories;
+ }
+
+ public ArtifactResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
+ {
+ this.remoteRepositories = remoteRepositories;
+
+ return this;
+ }
+
+ /**
+ * Gets the artifact filter that controls traversal of the dependency graph.
+ *
+ * @return The filter used to determine which of the artifacts in the dependency graph should be traversed or
+ * {@code null} to collect all transitive dependencies.
+ */
+ public ArtifactFilter getCollectionFilter()
+ {
+ return collectionFilter;
+ }
+
+ public ArtifactResolutionRequest setCollectionFilter( ArtifactFilter filter )
+ {
+ this.collectionFilter = filter;
+
+ return this;
+ }
+
+ /**
+ * Gets the artifact filter that controls downloading of artifact files. This filter operates on those artifacts
+ * that have been included by the {@link #getCollectionFilter()}.
+ *
+ * @return The filter used to determine which of the artifacts should have their files resolved or {@code null} to
+ * resolve the files for all collected artifacts.
+ */
+ public ArtifactFilter getResolutionFilter()
+ {
+ return resolutionFilter;
+ }
+
+ public ArtifactResolutionRequest setResolutionFilter( ArtifactFilter filter )
+ {
+ this.resolutionFilter = filter;
+
+ return this;
+ }
+
+ public List<ResolutionListener> getListeners()
+ {
+ return listeners;
+ }
+
+ public ArtifactResolutionRequest setListeners( List<ResolutionListener> listeners )
+ {
+ this.listeners = listeners;
+
+ return this;
+ }
+
+ public ArtifactResolutionRequest addListener( ResolutionListener listener )
+ {
+ listeners.add( listener );
+
+ return this;
+ }
+
+ public Map<String, Artifact> getManagedVersionMap()
+ {
+ return managedVersionMap;
+ }
+
+ public ArtifactResolutionRequest setManagedVersionMap( Map<String, Artifact> managedVersionMap )
+ {
+ this.managedVersionMap = managedVersionMap;
+
+ return this;
+ }
+
+ public ArtifactResolutionRequest setResolveRoot( boolean resolveRoot )
+ {
+ this.resolveRoot = resolveRoot;
+
+ return this;
+ }
+
+ public boolean isResolveRoot()
+ {
+ return resolveRoot;
+ }
+
+ public ArtifactResolutionRequest setResolveTransitively( boolean resolveDependencies )
+ {
+ this.resolveTransitively = resolveDependencies;
+
+ return this;
+ }
+
+ public boolean isResolveTransitively()
+ {
+ return resolveTransitively;
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder()
+ .append( "REQUEST: " ).append( "\n" )
+ .append( "artifact: " ).append( artifact ).append( "\n" )
+ .append( artifactDependencies ).append( "\n" )
+ .append( "localRepository: " ).append( localRepository ).append( "\n" )
+ .append( "remoteRepositories: " ).append( remoteRepositories ).append( "\n" );
+
+ return sb.toString();
+ }
+
+ public boolean isOffline()
+ {
+ return offline;
+ }
+
+ public ArtifactResolutionRequest setOffline( boolean offline )
+ {
+ this.offline = offline;
+
+ return this;
+ }
+
+ public boolean isForceUpdate()
+ {
+ return forceUpdate;
+ }
+
+ public ArtifactResolutionRequest setForceUpdate( boolean forceUpdate )
+ {
+ this.forceUpdate = forceUpdate;
+
+ return this;
+ }
+
+ public ArtifactResolutionRequest setServers( List<Server> servers )
+ {
+ this.servers = servers;
+
+ return this;
+ }
+
+ public List<Server> getServers()
+ {
+ if ( servers == null )
+ {
+ servers = new ArrayList<Server>();
+ }
+
+ return servers;
+ }
+
+ public ArtifactResolutionRequest setMirrors( List<Mirror> mirrors )
+ {
+ this.mirrors = mirrors;
+
+ return this;
+ }
+
+ public List<Mirror> getMirrors()
+ {
+ if ( mirrors == null )
+ {
+ mirrors = new ArrayList<Mirror>();
+ }
+
+ return mirrors;
+ }
+
+ public ArtifactResolutionRequest setProxies( List<Proxy> proxies )
+ {
+ this.proxies = proxies;
+
+ return this;
+ }
+
+ public List<Proxy> getProxies()
+ {
+ if ( proxies == null )
+ {
+ proxies = new ArrayList<Proxy>();
+ }
+
+ return proxies;
+ }
+
+ //
+ // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+ // this here, possibly indefinitely.
+ //
+ public ArtifactResolutionRequest setCache( RepositoryCache cache )
+ {
+ return this;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
new file mode 100644
index 00000000..86bfdb60
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java
@@ -0,0 +1,358 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * 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.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+
+/**
+ * Specific problems during resolution that we want to account for:
+ * <p/>
+ * - missing metadata - version range violations - version circular dependencies - missing artifacts
+ * - network/transfer errors - file system errors: permissions
+ *
+ * @author Jason van Zyl
+ * @TODO carlos: all these possible has*Exceptions and get*Exceptions methods make the clients too
+ * complex requiring a long list of checks, need to create a parent/interfact/encapsulation
+ * for the types of exceptions
+ */
+public class ArtifactResolutionResult
+{
+ private Artifact originatingArtifact;
+
+ private List<Artifact> missingArtifacts;
+
+ // Exceptions
+
+ private List<Exception> exceptions;
+
+ private List<Exception> versionRangeViolations;
+
+ private List<ArtifactResolutionException> metadataResolutionExceptions;
+
+ private List<CyclicDependencyException> circularDependencyExceptions;
+
+ private List<ArtifactResolutionException> errorArtifactExceptions;
+
+ // file system errors
+
+ private List<ArtifactRepository> repositories;
+
+ private Set<Artifact> artifacts;
+
+ private Set<ResolutionNode> resolutionNodes;
+
+ public Artifact getOriginatingArtifact()
+ {
+ return originatingArtifact;
+ }
+
+ public ArtifactResolutionResult setOriginatingArtifact( final Artifact originatingArtifact )
+ {
+ this.originatingArtifact = originatingArtifact;
+
+ return this;
+ }
+
+ public void addArtifact( Artifact artifact )
+ {
+ if ( artifacts == null )
+ {
+ artifacts = new LinkedHashSet<Artifact>();
+ }
+
+ artifacts.add( artifact );
+ }
+
+ public Set<Artifact> getArtifacts()
+ {
+ if ( artifacts == null )
+ {
+ artifacts = new LinkedHashSet<Artifact>();
+ }
+
+ return artifacts;
+ }
+
+ public void setArtifacts( Set<Artifact> artifacts )
+ {
+ this.artifacts = artifacts;
+ }
+
+ public Set<ResolutionNode> getArtifactResolutionNodes()
+ {
+ if ( resolutionNodes == null )
+ {
+ resolutionNodes = new LinkedHashSet<ResolutionNode>();
+ }
+
+ return resolutionNodes;
+ }
+
+ public void setArtifactResolutionNodes( Set<ResolutionNode> resolutionNodes )
+ {
+ this.resolutionNodes = resolutionNodes;
+ }
+
+ public boolean hasMissingArtifacts()
+ {
+ return missingArtifacts != null && !missingArtifacts.isEmpty();
+ }
+
+ public List<Artifact> getMissingArtifacts()
+ {
+ return missingArtifacts == null ? Collections.<Artifact>emptyList() : missingArtifacts;
+ }
+
+ public ArtifactResolutionResult addMissingArtifact( Artifact artifact )
+ {
+ missingArtifacts = initList( missingArtifacts );
+
+ missingArtifacts.add( artifact );
+
+ return this;
+ }
+
+ public ArtifactResolutionResult setUnresolvedArtifacts( final List<Artifact> unresolvedArtifacts )
+ {
+ this.missingArtifacts = unresolvedArtifacts;
+
+ return this;
+ }
+
+ public boolean isSuccess()
+ {
+ return !( hasMissingArtifacts() || hasExceptions() );
+ }
+
+ // ------------------------------------------------------------------------
+ // Exceptions
+ // ------------------------------------------------------------------------
+
+ public boolean hasExceptions()
+ {
+ return exceptions != null && !exceptions.isEmpty();
+ }
+
+ public List<Exception> getExceptions()
+ {
+ return exceptions == null ? Collections.<Exception>emptyList() : exceptions;
+ }
+
+ // ------------------------------------------------------------------------
+ // Version Range Violations
+ // ------------------------------------------------------------------------
+
+ public boolean hasVersionRangeViolations()
+ {
+ return versionRangeViolations != null;
+ }
+
+ /**
+ * @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by
+ * {@link #getVersionRangeViolation(int)} but it's not used like that in
+ * {@link DefaultLegacyArtifactCollector}
+ */
+ public ArtifactResolutionResult addVersionRangeViolation( Exception e )
+ {
+ versionRangeViolations = initList( versionRangeViolations );
+
+ versionRangeViolations.add( e );
+
+ exceptions = initList( exceptions );
+
+ exceptions.add( e );
+
+ return this;
+ }
+
+ public OverConstrainedVersionException getVersionRangeViolation( int i )
+ {
+ return (OverConstrainedVersionException) versionRangeViolations.get( i );
+ }
+
+ public List<Exception> getVersionRangeViolations()
+ {
+ return versionRangeViolations == null ? Collections.<Exception>emptyList() : versionRangeViolations;
+ }
+
+ // ------------------------------------------------------------------------
+ // Metadata Resolution Exceptions: ArtifactResolutionExceptions
+ // ------------------------------------------------------------------------
+
+ public boolean hasMetadataResolutionExceptions()
+ {
+ return metadataResolutionExceptions != null;
+ }
+
+ public ArtifactResolutionResult addMetadataResolutionException( ArtifactResolutionException e )
+ {
+ metadataResolutionExceptions = initList( metadataResolutionExceptions );
+
+ metadataResolutionExceptions.add( e );
+
+ exceptions = initList( exceptions );
+
+ exceptions.add( e );
+
+ return this;
+ }
+
+ public ArtifactResolutionException getMetadataResolutionException( int i )
+ {
+ return metadataResolutionExceptions.get( i );
+ }
+
+ public List<ArtifactResolutionException> getMetadataResolutionExceptions()
+ {
+ return metadataResolutionExceptions == null ? Collections.<ArtifactResolutionException>emptyList()
+ : metadataResolutionExceptions;
+ }
+
+ // ------------------------------------------------------------------------
+ // ErrorArtifactExceptions: ArtifactResolutionExceptions
+ // ------------------------------------------------------------------------
+
+ public boolean hasErrorArtifactExceptions()
+ {
+ return errorArtifactExceptions != null;
+ }
+
+ public ArtifactResolutionResult addErrorArtifactException( ArtifactResolutionException e )
+ {
+ errorArtifactExceptions = initList( errorArtifactExceptions );
+
+ errorArtifactExceptions.add( e );
+
+ exceptions = initList( exceptions );
+
+ exceptions.add( e );
+
+ return this;
+ }
+
+ public List<ArtifactResolutionException> getErrorArtifactExceptions()
+ {
+ if ( errorArtifactExceptions == null )
+ {
+ return Collections.emptyList();
+ }
+
+ return errorArtifactExceptions;
+ }
+
+ // ------------------------------------------------------------------------
+ // Circular Dependency Exceptions
+ // ------------------------------------------------------------------------
+
+ public boolean hasCircularDependencyExceptions()
+ {
+ return circularDependencyExceptions != null;
+ }
+
+ public ArtifactResolutionResult addCircularDependencyException( CyclicDependencyException e )
+ {
+ circularDependencyExceptions = initList( circularDependencyExceptions );
+
+ circularDependencyExceptions.add( e );
+
+ exceptions = initList( exceptions );
+
+ exceptions.add( e );
+
+ return this;
+ }
+
+ public CyclicDependencyException getCircularDependencyException( int i )
+ {
+ return circularDependencyExceptions.get( i );
+ }
+
+ public List<CyclicDependencyException> getCircularDependencyExceptions()
+ {
+ if ( circularDependencyExceptions == null )
+ {
+ return Collections.emptyList();
+ }
+
+ return circularDependencyExceptions;
+ }
+
+ // ------------------------------------------------------------------------
+ // Repositories
+ // ------------------------------------------------------------------------
+
+ public List<ArtifactRepository> getRepositories()
+ {
+ if ( repositories == null )
+ {
+ return Collections.emptyList();
+ }
+
+ return repositories;
+ }
+
+ public ArtifactResolutionResult setRepositories( final List<ArtifactRepository> repositories )
+ {
+ this.repositories = repositories;
+
+ return this;
+ }
+
+ //
+ // Internal
+ //
+
+ private <T> List<T> initList( final List<T> l )
+ {
+ if ( l == null )
+ {
+ return new ArrayList<T>();
+ }
+ return l;
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if ( artifacts != null )
+ {
+ int i = 1;
+ sb.append( "---------" ).append( "\n" );
+ sb.append( artifacts.size() ).append( "\n" );
+ for ( Artifact a : artifacts )
+ {
+ sb.append( i ).append( " " ).append( a ).append( "\n" );
+ i++;
+ }
+ sb.append( "---------" ).append( "\n" );
+ }
+
+ return sb.toString();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java
new file mode 100644
index 00000000..a8caa79b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java
@@ -0,0 +1,89 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * 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.List;
+
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = ResolutionErrorHandler.class )
+public class DefaultResolutionErrorHandler
+ implements ResolutionErrorHandler
+{
+
+ public void throwErrors( ArtifactResolutionRequest request, ArtifactResolutionResult result )
+ throws ArtifactResolutionException
+ {
+ // Metadata cannot be found
+
+ if ( result.hasMetadataResolutionExceptions() )
+ {
+ throw result.getMetadataResolutionException( 0 );
+ }
+
+ // Metadata cannot be retrieved
+
+ // Cyclic Dependency Error
+
+ if ( result.hasCircularDependencyExceptions() )
+ {
+ throw result.getCircularDependencyException( 0 );
+ }
+
+ // Version Range Violation
+
+ if ( result.hasVersionRangeViolations() )
+ {
+ throw result.getVersionRangeViolation( 0 );
+ }
+
+ // Transfer Error
+
+ if ( result.hasErrorArtifactExceptions() )
+ {
+ throw result.getErrorArtifactExceptions().get( 0 );
+ }
+
+ if ( result.hasMissingArtifacts() )
+ {
+ throw new MultipleArtifactsNotFoundException( request.getArtifact(), toList( result.getArtifacts() ),
+ result.getMissingArtifacts(),
+ request.getRemoteRepositories() );
+ }
+
+ // this should never happen since we checked all possible error sources before but better be sure
+ if ( result.hasExceptions() )
+ {
+ throw new ArtifactResolutionException( "Unknown error during artifact resolution, " + request + ", "
+ + result.getExceptions(), request.getArtifact(), request.getRemoteRepositories() );
+ }
+ }
+
+ private static <T> List<T> toList( Collection<T> items )
+ {
+ return ( items != null ) ? new ArrayList<T>( items ) : null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java
new file mode 100644
index 00000000..c54e5b6c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java
@@ -0,0 +1,31 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Benjamin Bentmann
+ */
+public interface ResolutionErrorHandler
+{
+
+ void throwErrors( ArtifactResolutionRequest request, ArtifactResolutionResult result )
+ throws ArtifactResolutionException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java
new file mode 100644
index 00000000..97687de2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java
@@ -0,0 +1,109 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+/**
+ * Listens to the resolution process and handles events.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public interface ResolutionListener
+{
+ String ROLE = ResolutionListener.class.getName();
+
+ int TEST_ARTIFACT = 1;
+
+ int PROCESS_CHILDREN = 2;
+
+ int FINISH_PROCESSING_CHILDREN = 3;
+
+ int INCLUDE_ARTIFACT = 4;
+
+ int OMIT_FOR_NEARER = 5;
+
+ int UPDATE_SCOPE = 6;
+
+ @Deprecated
+ int MANAGE_ARTIFACT = 7;
+
+ int OMIT_FOR_CYCLE = 8;
+
+ /**
+ * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current
+ * node is in the first level pom
+ */
+ int UPDATE_SCOPE_CURRENT_POM = 9;
+
+ int SELECT_VERSION_FROM_RANGE = 10;
+
+ int RESTRICT_RANGE = 11;
+
+ int MANAGE_ARTIFACT_VERSION = 12;
+
+ int MANAGE_ARTIFACT_SCOPE = 13;
+
+ int MANAGE_ARTIFACT_SYSTEM_PATH = 14;
+
+ void testArtifact( Artifact node );
+
+ void startProcessChildren( Artifact artifact );
+
+ void endProcessChildren( Artifact artifact );
+
+ void includeArtifact( Artifact artifact );
+
+ void omitForNearer( Artifact omitted,
+ Artifact kept );
+
+ void updateScope( Artifact artifact,
+ String scope );
+
+ @Deprecated
+ void manageArtifact( Artifact artifact,
+ Artifact replacement );
+
+ // TODO Use the following two instead of manageArtifact
+ // TODO Remove ResolutionListenerDM interface
+
+ //void manageArtifactVersion( Artifact artifact, Artifact replacement );
+
+ //void manageArtifactScope( Artifact artifact, Artifact replacement );
+
+ void omitForCycle( Artifact artifact );
+
+ /**
+ * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current
+ * node is in the first level pom
+ *
+ * @param artifact current node artifact, the one in the first level pom
+ * @param ignoredScope artifactScope that was ignored because artifact was in first level pom
+ */
+ void updateScopeCurrentPom( Artifact artifact,
+ String ignoredScope );
+
+ void selectVersionFromRange( Artifact artifact );
+
+ void restrictRange( Artifact artifact,
+ Artifact replacement,
+ VersionRange newRange );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
new file mode 100644
index 00000000..ae6c9214
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java
@@ -0,0 +1,251 @@
+package org.apache.maven.artifact.resolver;
+
+/*
+ * 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.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+
+public class ResolutionNode
+{
+ private Artifact artifact;
+
+ private List<ResolutionNode> children;
+
+ private final List<Object> parents;
+
+ private final int depth;
+
+ private final ResolutionNode parent;
+
+ private final List<ArtifactRepository> remoteRepositories;
+
+ private boolean active = true;
+
+ private List<Artifact> trail;
+
+ public ResolutionNode( Artifact artifact, List<ArtifactRepository> remoteRepositories )
+ {
+ this.artifact = artifact;
+ this.remoteRepositories = remoteRepositories;
+ depth = 0;
+ parents = Collections.emptyList();
+ parent = null;
+ }
+
+ public ResolutionNode( Artifact artifact, List<ArtifactRepository> remoteRepositories, ResolutionNode parent )
+ {
+ this.artifact = artifact;
+ this.remoteRepositories = remoteRepositories;
+ depth = parent.depth + 1;
+ parents = new ArrayList<Object>();
+ parents.addAll( parent.parents );
+ parents.add( parent.getKey() );
+ this.parent = parent;
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public Object getKey()
+ {
+ return artifact.getDependencyConflictId();
+ }
+
+ public void addDependencies( Set<Artifact> artifacts, List<ArtifactRepository> remoteRepositories,
+ ArtifactFilter filter )
+ throws CyclicDependencyException, OverConstrainedVersionException
+ {
+ if ( artifacts != null && !artifacts.isEmpty() )
+ {
+ children = new ArrayList<ResolutionNode>( artifacts.size() );
+
+ for ( Artifact a : artifacts )
+ {
+ if ( parents.contains( a.getDependencyConflictId() ) )
+ {
+ a.setDependencyTrail( getDependencyTrail() );
+
+ throw new CyclicDependencyException( "A dependency has introduced a cycle", a );
+ }
+
+ children.add( new ResolutionNode( a, remoteRepositories, this ) );
+ }
+ }
+ else
+ {
+ children = Collections.emptyList();
+ }
+ trail = null;
+ }
+
+ /**
+ * @return {@link List} &lt; {@link String} > with artifact ids
+ * @throws OverConstrainedVersionException
+ */
+ public List<String> getDependencyTrail()
+ throws OverConstrainedVersionException
+ {
+ List<Artifact> trial = getTrail();
+
+ List<String> ret = new ArrayList<String>( trial.size() );
+
+ for ( Artifact artifact : trial )
+ {
+ ret.add( artifact.getId() );
+ }
+
+ return ret;
+ }
+
+ private List<Artifact> getTrail()
+ throws OverConstrainedVersionException
+ {
+ if ( trail == null )
+ {
+ List<Artifact> ids = new LinkedList<Artifact>();
+ ResolutionNode node = this;
+ while ( node != null )
+ {
+ Artifact artifact = node.getArtifact();
+ if ( artifact.getVersion() == null )
+ {
+ // set the recommended version
+ ArtifactVersion selected = artifact.getSelectedVersion();
+ // MNG-2123: null is a valid response to getSelectedVersion, don't
+ // assume it won't ever be.
+ if ( selected != null )
+ {
+ artifact.selectVersion( selected.toString() );
+ }
+ else
+ {
+ throw new OverConstrainedVersionException( "Unable to get a selected Version for "
+ + artifact.getArtifactId(), artifact );
+ }
+ }
+
+ ids.add( 0, artifact );
+ node = node.parent;
+ }
+ trail = ids;
+ }
+ return trail;
+ }
+
+ public boolean isResolved()
+ {
+ return children != null;
+ }
+
+ /**
+ * Test whether the node is direct or transitive dependency.
+ */
+ public boolean isChildOfRootNode()
+ {
+ return parent != null && parent.parent == null;
+ }
+
+ public Iterator<ResolutionNode> getChildrenIterator()
+ {
+ return children.iterator();
+ }
+
+ public int getDepth()
+ {
+ return depth;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ return remoteRepositories;
+ }
+
+ public boolean isActive()
+ {
+ return active;
+ }
+
+ public void enable()
+ {
+ active = true;
+
+ // TODO: if it was null, we really need to go find them now... or is this taken care of by the ordering?
+ if ( children != null )
+ {
+ for ( ResolutionNode node : children )
+ {
+ node.enable();
+ }
+ }
+ }
+
+ public void disable()
+ {
+ active = false;
+ if ( children != null )
+ {
+ for ( ResolutionNode node : children )
+ {
+ node.disable();
+ }
+ }
+ }
+
+ public boolean filterTrail( ArtifactFilter filter )
+ throws OverConstrainedVersionException
+ {
+ boolean success = true;
+ if ( filter != null )
+ {
+ for ( Artifact artifact : getTrail() )
+ {
+ if ( !filter.include( artifact ) )
+ {
+ success = false;
+ }
+ }
+ }
+ return success;
+ }
+
+ @Override
+ public String toString()
+ {
+ return artifact.toString() + " (" + depth + "; " + ( active ? "enabled" : "disabled" ) + ")";
+ }
+
+ public void setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AbstractScopeArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AbstractScopeArtifactFilter.java
new file mode 100644
index 00000000..95872dbb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AbstractScopeArtifactFilter.java
@@ -0,0 +1,107 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * Filter to only retain objects in the given artifactScope or better.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+abstract class AbstractScopeArtifactFilter
+ implements ArtifactFilter
+{
+
+ private boolean compileScope;
+
+ private boolean runtimeScope;
+
+ private boolean testScope;
+
+ private boolean providedScope;
+
+ private boolean systemScope;
+
+ void addScopeInternal( String scope )
+ {
+ if ( Artifact.SCOPE_COMPILE.equals( scope ) )
+ {
+ systemScope = true;
+ providedScope = true;
+ compileScope = true;
+ }
+ else if ( Artifact.SCOPE_RUNTIME.equals( scope ) )
+ {
+ compileScope = true;
+ runtimeScope = true;
+ }
+ else if ( Artifact.SCOPE_COMPILE_PLUS_RUNTIME.equals( scope ) )
+ {
+ systemScope = true;
+ providedScope = true;
+ compileScope = true;
+ runtimeScope = true;
+ }
+ else if ( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals( scope ) )
+ {
+ systemScope = true;
+ compileScope = true;
+ runtimeScope = true;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( scope ) )
+ {
+ systemScope = true;
+ providedScope = true;
+ compileScope = true;
+ runtimeScope = true;
+ testScope = true;
+ }
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ if ( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
+ {
+ return compileScope;
+ }
+ else if ( Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) )
+ {
+ return runtimeScope;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
+ {
+ return testScope;
+ }
+ else if ( Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) )
+ {
+ return providedScope;
+ }
+ else if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+ {
+ return systemScope;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilter.java
new file mode 100644
index 00000000..5c6689de
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilter.java
@@ -0,0 +1,99 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+
+/**
+ * Apply multiple filters.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class AndArtifactFilter
+ implements ArtifactFilter
+{
+ private Set<ArtifactFilter> filters;
+
+ public AndArtifactFilter()
+ {
+ this.filters = new LinkedHashSet<ArtifactFilter>();
+ }
+
+ public AndArtifactFilter( List<ArtifactFilter> filters )
+ {
+ this.filters = new LinkedHashSet<ArtifactFilter>( filters );
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ boolean include = true;
+ for ( Iterator<ArtifactFilter> i = filters.iterator(); i.hasNext() && include; )
+ {
+ ArtifactFilter filter = i.next();
+ if ( !filter.include( artifact ) )
+ {
+ include = false;
+ }
+ }
+ return include;
+ }
+
+ public void add( ArtifactFilter artifactFilter )
+ {
+ filters.add( artifactFilter );
+ }
+
+ public List<ArtifactFilter> getFilters()
+ {
+ return new ArrayList<ArtifactFilter>( filters );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = hash * 31 + filters.hashCode();
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof AndArtifactFilter ) )
+ {
+ return false;
+ }
+
+ AndArtifactFilter other = (AndArtifactFilter) obj;
+
+ return filters.equals( other.filters );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/CumulativeScopeArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/CumulativeScopeArtifactFilter.java
new file mode 100644
index 00000000..fb0afcfb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/CumulativeScopeArtifactFilter.java
@@ -0,0 +1,122 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.HashSet;
+import java.util.Set;
+
+/**
+ * Filter to only retain objects in the given scope or better. This implementation allows the accumulation of multiple
+ * scopes and their associated implied scopes, so that the user can filter apply a series of implication rules in a
+ * single step. This should be a more efficient implementation of multiple standard {@link ScopeArtifactFilter}
+ * instances ORed together.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @author jdcasey
+ */
+public class CumulativeScopeArtifactFilter
+ extends AbstractScopeArtifactFilter
+{
+
+ private Set<String> scopes;
+
+ /**
+ * Create a new filter with the specified scopes and their implied scopes enabled.
+ *
+ * @param scopes The scopes to enable, along with all implied scopes, may be {@code null}.
+ */
+ public CumulativeScopeArtifactFilter( Collection<String> scopes )
+ {
+ this.scopes = new HashSet<String>();
+
+ addScopes( scopes );
+ }
+
+ /**
+ * Creates a new filter that combines the specified filters.
+ *
+ * @param filters The filters to combine, may be {@code null}.
+ */
+ public CumulativeScopeArtifactFilter( CumulativeScopeArtifactFilter... filters )
+ {
+ this.scopes = new HashSet<String>();
+
+ if ( filters != null )
+ {
+ for ( CumulativeScopeArtifactFilter filter : filters )
+ {
+ addScopes( filter.getScopes() );
+ }
+ }
+ }
+
+ private void addScopes( Collection<String> scopes )
+ {
+ if ( scopes != null )
+ {
+ for ( String scope : scopes )
+ {
+ addScope( scope );
+ }
+ }
+ }
+
+ private void addScope( String scope )
+ {
+ this.scopes.add( scope );
+
+ addScopeInternal( scope );
+ }
+
+ public Set<String> getScopes()
+ {
+ return scopes;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+
+ hash = hash * 31 + scopes.hashCode();
+
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof CumulativeScopeArtifactFilter ) )
+ {
+ return false;
+ }
+
+ CumulativeScopeArtifactFilter that = (CumulativeScopeArtifactFilter) obj;
+
+ return scopes.equals( that.scopes );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java
new file mode 100644
index 00000000..b6ef02e5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExcludesArtifactFilter.java
@@ -0,0 +1,44 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * Filter to exclude from a list of artifact patterns.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @todo I think this is equiv. to exclusion set filter in maven-core
+ */
+public class ExcludesArtifactFilter
+ extends IncludesArtifactFilter
+{
+ public ExcludesArtifactFilter( List<String> patterns )
+ {
+ super( patterns );
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ return !super.include( artifact );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionSetFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionSetFilter.java
new file mode 100644
index 00000000..c3dc9812
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionSetFilter.java
@@ -0,0 +1,86 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ */
+public class ExclusionSetFilter
+ implements ArtifactFilter
+{
+ private Set<String> excludes;
+
+ public ExclusionSetFilter( String[] excludes )
+ {
+ this.excludes = new LinkedHashSet<String>( Arrays.asList( excludes ) );
+ }
+
+ public ExclusionSetFilter( Set<String> excludes )
+ {
+ this.excludes = excludes;
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ String id = artifact.getArtifactId();
+
+ if ( excludes.contains( id ) )
+ {
+ return false;
+ }
+
+ id = artifact.getGroupId() + ':' + id;
+
+ return !excludes.contains( id );
+
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = hash * 31 + excludes.hashCode();
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof ExclusionSetFilter ) )
+ {
+ return false;
+ }
+
+ ExclusionSetFilter other = (ExclusionSetFilter) obj;
+
+ return excludes.equals( other.excludes );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/IncludesArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/IncludesArtifactFilter.java
new file mode 100644
index 00000000..403e1251
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/IncludesArtifactFilter.java
@@ -0,0 +1,93 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+
+/**
+ * Filter to include from a list of artifact patterns.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class IncludesArtifactFilter
+ implements ArtifactFilter
+{
+ private final Set<String> patterns;
+
+ public IncludesArtifactFilter( List<String> patterns )
+ {
+ this.patterns = new LinkedHashSet<String>( patterns );
+ }
+
+ public boolean include( Artifact artifact )
+ {
+ String id = artifact.getGroupId() + ":" + artifact.getArtifactId();
+
+ boolean matched = false;
+ for ( Iterator<String> i = patterns.iterator(); i.hasNext() & !matched; )
+ {
+ // TODO: what about wildcards? Just specifying groups? versions?
+ if ( id.equals( i.next() ) )
+ {
+ matched = true;
+ }
+ }
+ return matched;
+ }
+
+ public List<String> getPatterns()
+ {
+ return new ArrayList<String>( patterns );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = hash * 31 + patterns.hashCode();
+
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ // make sure IncludesArtifactFilter is not equal ExcludesArtifactFilter!
+ if ( obj == null || getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ IncludesArtifactFilter other = (IncludesArtifactFilter) obj;
+
+ return patterns.equals( other.patterns );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
new file mode 100644
index 00000000..1d131b71
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilter.java
@@ -0,0 +1,78 @@
+package org.apache.maven.artifact.resolver.filter;
+
+/*
+ * 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.
+ */
+
+/**
+ * Filter to only retain objects in the given artifactScope or better.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ScopeArtifactFilter
+ extends AbstractScopeArtifactFilter
+{
+
+ private final String scope;
+
+ public ScopeArtifactFilter( String scope )
+ {
+ this.scope = scope;
+
+ addScopeInternal( scope );
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+
+ hash = hash * 31 + ( scope != null ? scope.hashCode() : 0 );
+
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof ScopeArtifactFilter ) )
+ {
+ return false;
+ }
+
+ ScopeArtifactFilter other = (ScopeArtifactFilter) obj;
+
+ return equals( scope, other.scope );
+ }
+
+ private static <T> boolean equals( T str1, T str2 )
+ {
+ return str1 != null ? str1.equals( str2 ) : str2 == null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java
new file mode 100644
index 00000000..f33bc328
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java
@@ -0,0 +1,785 @@
+package org.apache.maven.bridge;
+
+/*
+ * 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.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.Authentication;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.repository.Proxy;
+import org.apache.maven.repository.RepositorySystem;
+import org.apache.maven.settings.Mirror;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.AuthenticationContext;
+import org.eclipse.aether.repository.AuthenticationSelector;
+import org.eclipse.aether.repository.ProxySelector;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * @author Jason van Zyl
+ */
+@Component( role = MavenRepositorySystem.class, hint = "default" )
+public class MavenRepositorySystem
+{
+ @Requirement
+ private ArtifactHandlerManager artifactHandlerManager;
+
+ @Requirement( role = ArtifactRepositoryLayout.class )
+ private Map<String, ArtifactRepositoryLayout> layouts;
+
+ // DefaultProjectBuilder
+ public Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type )
+ {
+ return XcreateArtifact( groupId, artifactId, version, scope, type );
+ }
+
+ // DefaultProjectBuilder
+ public Artifact createProjectArtifact( String groupId, String artifactId, String metaVersionId )
+ {
+ return XcreateProjectArtifact( groupId, artifactId, metaVersionId );
+ }
+
+ // DefaultProjectBuilder
+ public Artifact createDependencyArtifact( Dependency d )
+ {
+ if ( d.getVersion() == null )
+ {
+ return null;
+ }
+
+ VersionRange versionRange;
+ try
+ {
+ versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ return null;
+ }
+
+ Artifact artifact =
+ XcreateDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange, d.getType(),
+ d.getClassifier(), d.getScope(), d.isOptional() );
+
+ if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) && d.getSystemPath() != null )
+ {
+ artifact.setFile( new File( d.getSystemPath() ) );
+ }
+
+ if ( !d.getExclusions().isEmpty() )
+ {
+ List<String> exclusions = new ArrayList<String>();
+
+ for ( Exclusion exclusion : d.getExclusions() )
+ {
+ exclusions.add( exclusion.getGroupId() + ':' + exclusion.getArtifactId() );
+ }
+
+ artifact.setDependencyFilter( new ExcludesArtifactFilter( exclusions ) );
+ }
+
+ return artifact;
+ }
+
+ // DefaultProjectBuilder
+ public Artifact createExtensionArtifact( String groupId, String artifactId, String version )
+ {
+ VersionRange versionRange;
+ try
+ {
+ versionRange = VersionRange.createFromVersionSpec( version );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ return null;
+ }
+
+ return XcreateExtensionArtifact( groupId, artifactId, versionRange );
+ }
+
+ // DefaultProjectBuilder
+ public Artifact createParentArtifact( String groupId, String artifactId, String version )
+ {
+ return XcreateParentArtifact( groupId, artifactId, version );
+ }
+
+ // DefaultProjectBuilder
+ public Artifact createPluginArtifact( Plugin plugin )
+ {
+ VersionRange versionRange;
+ try
+ {
+ String version = plugin.getVersion();
+ if ( StringUtils.isEmpty( version ) )
+ {
+ version = "RELEASE";
+ }
+ versionRange = VersionRange.createFromVersionSpec( version );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ return null;
+ }
+
+ return XcreatePluginArtifact( plugin.getGroupId(), plugin.getArtifactId(), versionRange );
+ }
+
+ public void injectMirror( List<ArtifactRepository> repositories, List<Mirror> mirrors )
+ {
+ if ( repositories != null && mirrors != null )
+ {
+ for ( ArtifactRepository repository : repositories )
+ {
+ Mirror mirror = getMirror( repository, mirrors );
+ injectMirror( repository, mirror );
+ }
+ }
+ }
+
+ private Mirror getMirror( RepositorySystemSession session, ArtifactRepository repository )
+ {
+ if ( session != null )
+ {
+ org.eclipse.aether.repository.MirrorSelector selector = session.getMirrorSelector();
+ if ( selector != null )
+ {
+ RemoteRepository repo = selector.getMirror( RepositoryUtils.toRepo( repository ) );
+ if ( repo != null )
+ {
+ Mirror mirror = new Mirror();
+ mirror.setId( repo.getId() );
+ mirror.setUrl( repo.getUrl() );
+ mirror.setLayout( repo.getContentType() );
+ return mirror;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void injectMirror( RepositorySystemSession session, List<ArtifactRepository> repositories )
+ {
+ if ( repositories != null && session != null )
+ {
+ for ( ArtifactRepository repository : repositories )
+ {
+ Mirror mirror = getMirror( session, repository );
+ injectMirror( repository, mirror );
+ }
+ }
+ }
+
+ private void injectMirror( ArtifactRepository repository, Mirror mirror )
+ {
+ if ( mirror != null )
+ {
+ ArtifactRepository original =
+ createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
+ repository.getSnapshots(), repository.getReleases() );
+
+ repository.setMirroredRepositories( Collections.singletonList( original ) );
+
+ repository.setId( mirror.getId() );
+ repository.setUrl( mirror.getUrl() );
+
+ if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
+ {
+ repository.setLayout( getLayout( mirror.getLayout() ) );
+ }
+ }
+ }
+
+ private Authentication getAuthentication( RepositorySystemSession session, ArtifactRepository repository )
+ {
+ if ( session != null )
+ {
+ AuthenticationSelector selector = session.getAuthenticationSelector();
+ if ( selector != null )
+ {
+ RemoteRepository repo = RepositoryUtils.toRepo( repository );
+ org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo );
+ if ( auth != null )
+ {
+ repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build();
+ AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo );
+ Authentication result =
+ new Authentication( authCtx.get( AuthenticationContext.USERNAME ),
+ authCtx.get( AuthenticationContext.PASSWORD ) );
+ result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) );
+ result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) );
+ authCtx.close();
+ return result;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void injectAuthentication( RepositorySystemSession session, List<ArtifactRepository> repositories )
+ {
+ if ( repositories != null && session != null )
+ {
+ for ( ArtifactRepository repository : repositories )
+ {
+ repository.setAuthentication( getAuthentication( session, repository ) );
+ }
+ }
+ }
+
+ private Proxy getProxy( RepositorySystemSession session, ArtifactRepository repository )
+ {
+ if ( session != null )
+ {
+ ProxySelector selector = session.getProxySelector();
+ if ( selector != null )
+ {
+ RemoteRepository repo = RepositoryUtils.toRepo( repository );
+ org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo );
+ if ( proxy != null )
+ {
+ Proxy p = new Proxy();
+ p.setHost( proxy.getHost() );
+ p.setProtocol( proxy.getType() );
+ p.setPort( proxy.getPort() );
+ if ( proxy.getAuthentication() != null )
+ {
+ repo = new RemoteRepository.Builder( repo ).setProxy( proxy ).build();
+ AuthenticationContext authCtx = AuthenticationContext.forProxy( session, repo );
+ p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) );
+ p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) );
+ p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) );
+ p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION ) );
+ authCtx.close();
+ }
+ return p;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void injectProxy( RepositorySystemSession session, List<ArtifactRepository> repositories )
+ {
+ if ( repositories != null && session != null )
+ {
+ for ( ArtifactRepository repository : repositories )
+ {
+ repository.setProxy( getProxy( session, repository ) );
+ }
+ }
+ }
+
+ private ArtifactRepositoryLayout getLayout( String id )
+ {
+ ArtifactRepositoryLayout layout = layouts.get( id );
+
+ return layout;
+ }
+
+
+ //
+ // Taken from LegacyRepositorySystem
+ //
+
+ public static org.apache.maven.model.Repository fromSettingsRepository( org.apache.maven.settings.Repository
+ settingsRepository )
+ {
+ org.apache.maven.model.Repository modelRepository = new org.apache.maven.model.Repository();
+ modelRepository.setId( settingsRepository.getId() );
+ modelRepository.setLayout( settingsRepository.getLayout() );
+ modelRepository.setName( settingsRepository.getName() );
+ modelRepository.setUrl( settingsRepository.getUrl() );
+ modelRepository.setReleases( fromSettingsRepositoryPolicy( settingsRepository.getReleases() ) );
+ modelRepository.setSnapshots( fromSettingsRepositoryPolicy( settingsRepository.getSnapshots() ) );
+ return modelRepository;
+ }
+
+ public static org.apache.maven.model.RepositoryPolicy fromSettingsRepositoryPolicy(
+ org.apache.maven.settings.RepositoryPolicy settingsRepositoryPolicy )
+ {
+ org.apache.maven.model.RepositoryPolicy modelRepositoryPolicy = new org.apache.maven.model.RepositoryPolicy();
+ if ( settingsRepositoryPolicy != null )
+ {
+ modelRepositoryPolicy.setEnabled( settingsRepositoryPolicy.isEnabled() );
+ modelRepositoryPolicy.setUpdatePolicy( settingsRepositoryPolicy.getUpdatePolicy() );
+ modelRepositoryPolicy.setChecksumPolicy( settingsRepositoryPolicy.getChecksumPolicy() );
+ }
+ return modelRepositoryPolicy;
+ }
+
+ public static ArtifactRepository buildArtifactRepository( org.apache.maven.settings.Repository repo )
+ throws InvalidRepositoryException
+ {
+ return buildArtifactRepository( fromSettingsRepository( repo ) );
+ }
+
+ public static ArtifactRepository buildArtifactRepository( org.apache.maven.model.Repository repo )
+ throws InvalidRepositoryException
+ {
+ if ( repo != null )
+ {
+ String id = repo.getId();
+
+ if ( StringUtils.isEmpty( id ) )
+ {
+ throw new InvalidRepositoryException( "Repository identifier missing", "" );
+ }
+
+ String url = repo.getUrl();
+
+ if ( StringUtils.isEmpty( url ) )
+ {
+ throw new InvalidRepositoryException( "URL missing for repository " + id, id );
+ }
+
+ ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
+
+ ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
+
+ ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
+
+ return createArtifactRepository( id, url, layout, snapshots, releases );
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( org.apache.maven.model.RepositoryPolicy
+ policy )
+ {
+ boolean enabled = true;
+
+ String updatePolicy = null;
+
+ String checksumPolicy = null;
+
+ if ( policy != null )
+ {
+ enabled = policy.isEnabled();
+
+ if ( policy.getUpdatePolicy() != null )
+ {
+ updatePolicy = policy.getUpdatePolicy();
+ }
+ if ( policy.getChecksumPolicy() != null )
+ {
+ checksumPolicy = policy.getChecksumPolicy();
+ }
+ }
+
+ return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy );
+ }
+
+ public ArtifactRepository createArtifactRepository( String id, String url, String layoutId,
+ ArtifactRepositoryPolicy snapshots,
+ ArtifactRepositoryPolicy releases )
+ throws Exception
+ {
+ ArtifactRepositoryLayout layout = layouts.get( layoutId );
+
+ checkLayout( id, layoutId, layout );
+
+ return createArtifactRepository( id, url, layout, snapshots, releases );
+ }
+
+ private void checkLayout( String repositoryId, String layoutId, ArtifactRepositoryLayout layout )
+ throws Exception
+ {
+ if ( layout == null )
+ {
+ throw new Exception( String.format( "Cannot find ArtifactRepositoryLayout instance for: %s %s", layoutId,
+ repositoryId ) );
+ }
+ }
+
+ public static ArtifactRepository createArtifactRepository( String id, String url,
+ ArtifactRepositoryLayout repositoryLayout,
+ ArtifactRepositoryPolicy snapshots,
+ ArtifactRepositoryPolicy releases )
+ {
+ if ( snapshots == null )
+ {
+ snapshots = new ArtifactRepositoryPolicy();
+ }
+
+ if ( releases == null )
+ {
+ releases = new ArtifactRepositoryPolicy();
+ }
+
+ ArtifactRepository repository;
+ if ( repositoryLayout instanceof ArtifactRepositoryLayout2 )
+ {
+ repository =
+ ( (ArtifactRepositoryLayout2) repositoryLayout ).newMavenArtifactRepository( id, url, snapshots,
+ releases );
+ }
+ else
+ {
+ repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
+ }
+
+ return repository;
+ }
+
+ // ArtifactFactory
+ private Artifact XcreateArtifact( String groupId, String artifactId, String version, String scope, String type )
+ {
+ return XcreateArtifact( groupId, artifactId, version, scope, type, null, null );
+ }
+
+ private Artifact XcreateDependencyArtifact( String groupId, String artifactId, VersionRange versionRange,
+ String type, String classifier, String scope, boolean optional )
+ {
+ return XcreateArtifact( groupId, artifactId, versionRange, type, classifier, scope, null, optional );
+ }
+
+ private Artifact XcreateProjectArtifact( String groupId, String artifactId, String version )
+ {
+ return XcreateProjectArtifact( groupId, artifactId, version, null );
+ }
+
+ private Artifact XcreateParentArtifact( String groupId, String artifactId, String version )
+ {
+ return XcreateProjectArtifact( groupId, artifactId, version );
+ }
+
+ private Artifact XcreatePluginArtifact( String groupId, String artifactId, VersionRange versionRange )
+ {
+ return XcreateArtifact( groupId, artifactId, versionRange, "maven-plugin", null, Artifact.SCOPE_RUNTIME, null );
+ }
+
+ private Artifact XcreateProjectArtifact( String groupId, String artifactId, String version, String scope )
+ {
+ return XcreateArtifact( groupId, artifactId, version, scope, "pom" );
+ }
+
+ private Artifact XcreateExtensionArtifact( String groupId, String artifactId, VersionRange versionRange )
+ {
+ return XcreateArtifact( groupId, artifactId, versionRange, "jar", null, Artifact.SCOPE_RUNTIME, null );
+ }
+
+ private Artifact XcreateArtifact( String groupId, String artifactId, String version, String scope, String type,
+ String classifier, String inheritedScope )
+ {
+ VersionRange versionRange = null;
+ if ( version != null )
+ {
+ versionRange = VersionRange.createFromVersion( version );
+ }
+ return XcreateArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope );
+ }
+
+ private Artifact XcreateArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope )
+ {
+ return XcreateArtifact( groupId, artifactId, versionRange, type, classifier, scope, inheritedScope, false );
+ }
+
+ private Artifact XcreateArtifact( String groupId, String artifactId, VersionRange versionRange, String type,
+ String classifier, String scope, String inheritedScope, boolean optional )
+ {
+ String desiredScope = Artifact.SCOPE_RUNTIME;
+
+ if ( inheritedScope == null )
+ {
+ desiredScope = scope;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( scope ) || Artifact.SCOPE_PROVIDED.equals( scope ) )
+ {
+ return null;
+ }
+ else if ( Artifact.SCOPE_COMPILE.equals( scope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
+ {
+ // added to retain compile artifactScope. Remove if you want compile inherited as runtime
+ desiredScope = Artifact.SCOPE_COMPILE;
+ }
+
+ if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
+ {
+ desiredScope = Artifact.SCOPE_TEST;
+ }
+
+ if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) )
+ {
+ desiredScope = Artifact.SCOPE_PROVIDED;
+ }
+
+ if ( Artifact.SCOPE_SYSTEM.equals( scope ) )
+ {
+ // system scopes come through unchanged...
+ desiredScope = Artifact.SCOPE_SYSTEM;
+ }
+
+ ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
+
+ return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler,
+ optional );
+ }
+
+ //
+ // Code taken from LegacyRepositorySystem
+ //
+
+ public ArtifactRepository createDefaultRemoteRepository( MavenExecutionRequest request )
+ throws Exception
+ {
+ return createRepository( RepositorySystem.DEFAULT_REMOTE_REPO_URL, RepositorySystem.DEFAULT_REMOTE_REPO_ID,
+ true, ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, false,
+ ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY,
+ ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
+ }
+
+ public ArtifactRepository createRepository( String url, String repositoryId, boolean releases,
+ String releaseUpdates, boolean snapshots, String snapshotUpdates,
+ String checksumPolicy ) throws Exception
+ {
+ ArtifactRepositoryPolicy snapshotsPolicy =
+ new ArtifactRepositoryPolicy( snapshots, snapshotUpdates, checksumPolicy );
+
+ ArtifactRepositoryPolicy releasesPolicy =
+ new ArtifactRepositoryPolicy( releases, releaseUpdates, checksumPolicy );
+
+ return createArtifactRepository( repositoryId, url, "default", snapshotsPolicy, releasesPolicy );
+ }
+
+ public Set<String> getRepoIds( List<ArtifactRepository> repositories )
+ {
+ Set<String> repoIds = new HashSet<String>();
+
+ if ( repositories != null )
+ {
+ for ( ArtifactRepository repository : repositories )
+ {
+ repoIds.add( repository.getId() );
+ }
+ }
+
+ return repoIds;
+ }
+
+
+ public ArtifactRepository createLocalRepository( MavenExecutionRequest request, File localRepository )
+ throws Exception
+ {
+ return createRepository( "file://" + localRepository.toURI().getRawPath(),
+ RepositorySystem.DEFAULT_LOCAL_REPO_ID, true,
+ ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true,
+ ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
+ ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
+ }
+
+ private static final String WILDCARD = "*";
+
+ private static final String EXTERNAL_WILDCARD = "external:*";
+
+ public static Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors )
+ {
+ String repoId = repository.getId();
+
+ if ( repoId != null && mirrors != null )
+ {
+ for ( Mirror mirror : mirrors )
+ {
+ if ( repoId.equals( mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
+ {
+ return mirror;
+ }
+ }
+
+ for ( Mirror mirror : mirrors )
+ {
+ if ( matchPattern( repository, mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
+ {
+ return mirror;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This method checks if the pattern matches the originalRepository. Valid patterns: * = everything external:* =
+ * everything not on the localhost and not file based. repo,repo1 = repo or repo1 *,!repo1 = everything except repo1
+ *
+ * @param originalRepository to compare for a match.
+ * @param pattern used for match. Currently only '*' is supported.
+ * @return true if the repository is a match to this pattern.
+ */
+ static boolean matchPattern( ArtifactRepository originalRepository, String pattern )
+ {
+ boolean result = false;
+ String originalId = originalRepository.getId();
+
+ // simple checks first to short circuit processing below.
+ if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) )
+ {
+ result = true;
+ }
+ else
+ {
+ // process the list
+ String[] repos = pattern.split( "," );
+ for ( String repo : repos )
+ {
+ // see if this is a negative match
+ if ( repo.length() > 1 && repo.startsWith( "!" ) )
+ {
+ if ( repo.substring( 1 ).equals( originalId ) )
+ {
+ // explicitly exclude. Set result and stop processing.
+ result = false;
+ break;
+ }
+ }
+ // check for exact match
+ else if ( repo.equals( originalId ) )
+ {
+ result = true;
+ break;
+ }
+ // check for external:*
+ else if ( EXTERNAL_WILDCARD.equals( repo ) && isExternalRepo( originalRepository ) )
+ {
+ result = true;
+ // don't stop processing in case a future segment explicitly excludes this repo
+ }
+ else if ( WILDCARD.equals( repo ) )
+ {
+ result = true;
+ // don't stop processing in case a future segment explicitly excludes this repo
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Checks the URL to see if this repository refers to an external repository
+ *
+ * @param originalRepository
+ * @return true if external.
+ */
+ static boolean isExternalRepo( ArtifactRepository originalRepository )
+ {
+ try
+ {
+ URL url = new URL( originalRepository.getUrl() );
+ return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" )
+ || url.getProtocol().equals( "file" ) );
+ }
+ catch ( MalformedURLException e )
+ {
+ // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it
+ return false;
+ }
+ }
+
+ static boolean matchesLayout( ArtifactRepository repository, Mirror mirror )
+ {
+ return matchesLayout( RepositoryUtils.getLayout( repository ), mirror.getMirrorOfLayouts() );
+ }
+
+ /**
+ * Checks whether the layouts configured for a mirror match with the layout of the repository.
+ *
+ * @param repoLayout The layout of the repository, may be {@code null}.
+ * @param mirrorLayout The layouts supported by the mirror, may be {@code null}.
+ * @return {@code true} if the layouts associated with the mirror match the layout of the original repository,
+ * {@code false} otherwise.
+ */
+ static boolean matchesLayout( String repoLayout, String mirrorLayout )
+ {
+ boolean result = false;
+
+ // simple checks first to short circuit processing below.
+ if ( StringUtils.isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) )
+ {
+ result = true;
+ }
+ else if ( mirrorLayout.equals( repoLayout ) )
+ {
+ result = true;
+ }
+ else
+ {
+ // process the list
+ String[] layouts = mirrorLayout.split( "," );
+ for ( String layout : layouts )
+ {
+ // see if this is a negative match
+ if ( layout.length() > 1 && layout.startsWith( "!" ) )
+ {
+ if ( layout.substring( 1 ).equals( repoLayout ) )
+ {
+ // explicitly exclude. Set result and stop processing.
+ result = false;
+ break;
+ }
+ }
+ // check for exact match
+ else if ( layout.equals( repoLayout ) )
+ {
+ result = true;
+ break;
+ }
+ else if ( WILDCARD.equals( layout ) )
+ {
+ result = true;
+ // don't stop processing in case a future segment explicitly excludes this repo
+ }
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ArtifactClassRealmConstituent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ArtifactClassRealmConstituent.java
new file mode 100644
index 00000000..562d6f47
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ArtifactClassRealmConstituent.java
@@ -0,0 +1,76 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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.eclipse.aether.artifact.Artifact;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class ArtifactClassRealmConstituent
+ implements ClassRealmConstituent
+{
+
+ private final Artifact artifact;
+
+ public ArtifactClassRealmConstituent( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ public String getGroupId()
+ {
+ return artifact.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return artifact.getArtifactId();
+ }
+
+ public String getType()
+ {
+ return artifact.getExtension();
+ }
+
+ public String getClassifier()
+ {
+ return artifact.getClassifier();
+ }
+
+ public String getVersion()
+ {
+ return artifact.getBaseVersion();
+ }
+
+ public File getFile()
+ {
+ return artifact.getFile();
+ }
+
+ @Override
+ public String toString()
+ {
+ return artifact.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmConstituent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmConstituent.java
new file mode 100644
index 00000000..f658eb43
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmConstituent.java
@@ -0,0 +1,74 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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;
+
+/**
+ * Describes a constituent of a class realm.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ClassRealmConstituent
+{
+
+ /**
+ * Gets the group id of the constituent's artifact.
+ *
+ * @return The group id, never {@code null}.
+ */
+ String getGroupId();
+
+ /**
+ * Gets the artifact id of the constituent's artifact.
+ *
+ * @return The artifact id, never {@code null}.
+ */
+ String getArtifactId();
+
+ /**
+ * Gets the type of the constituent's artifact.
+ *
+ * @return The type, never {@code null}.
+ */
+ String getType();
+
+ /**
+ * Gets the classifier of the constituent's artifact.
+ *
+ * @return The classifier or an empty string, never {@code null}.
+ */
+ String getClassifier();
+
+ /**
+ * Gets the version of the constituent's artifact.
+ *
+ * @return The version, never {@code null}.
+ */
+ String getVersion();
+
+ /**
+ * Gets the file of the constituent's artifact.
+ *
+ * @return The file, never {@code null}.
+ */
+ File getFile();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManager.java
new file mode 100644
index 00000000..e5d15143
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManager.java
@@ -0,0 +1,88 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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 java.util.Map;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * Manages the class realms used by Maven. <strong>Warning:</strong> This is an internal utility interface that is only
+ * public for technical reasons, it is not part of the public API. In particular, this interface can be changed or
+ * deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ClassRealmManager
+{
+
+ /**
+ * Gets the class realm hosting the Maven core.
+ *
+ * @return The class realm hosting the Maven core, never {@code null}.
+ */
+ ClassRealm getCoreRealm();
+
+ /**
+ * Gets the class realm exposing the Maven API. This is basically a restricted view on the Maven core realm.
+ *
+ * @return The class realm exposing the Maven API, never {@code null}.
+ */
+ ClassRealm getMavenApiRealm();
+
+ /**
+ * Creates a new class realm for the specified project and its build extensions.
+ *
+ * @param model The model of the project for which to create a realm, must not be {@code null}.
+ * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a
+ * missing file) will automatically be excluded from the realm.
+ * @return The new project realm, never {@code null}.
+ */
+ ClassRealm createProjectRealm( Model model, List<Artifact> artifacts );
+
+ /**
+ * Creates a new class realm for the specified build extension.
+ *
+ * @param extension The extension plugin for which to create a realm, must not be {@code null}.
+ * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a
+ * missing file) will automatically be excluded from the realm.
+ * @return The new extension realm, never {@code null}.
+ */
+ ClassRealm createExtensionRealm( Plugin extension, List<Artifact> artifacts );
+
+ /**
+ * Creates a new class realm for the specified plugin.
+ *
+ * @param plugin The plugin for which to create a realm, must not be {@code null}.
+ * @param parent The parent realm for the new realm, may be {@code null}.
+ * @param parentImports The packages/types to import from the parent realm, may be {@code null}.
+ * @param foreignImports The packages/types to import from foreign realms, may be {@code null}.
+ * @param artifacts The artifacts to add to the class realm, may be {@code null}. Unresolved artifacts (i.e. with a
+ * missing file) will automatically be excluded from the realm.
+ * @return The new plugin realm, never {@code null}.
+ */
+ ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> parentImports,
+ Map<String, ClassLoader> foreignImports, List<Artifact> artifacts );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManagerDelegate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManagerDelegate.java
new file mode 100644
index 00000000..b0229b97
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmManagerDelegate.java
@@ -0,0 +1,36 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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.classworlds.realm.ClassRealm;
+
+/**
+ * ClassRealmManagerDelegate is used to perform addition configuration of
+ * class realms created by ClassRealmManager.
+ *
+ * @author igor
+ */
+public interface ClassRealmManagerDelegate
+{
+
+ void setupRealm( ClassRealm classRealm, ClassRealmRequest request );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmRequest.java
new file mode 100644
index 00000000..9b62108f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/ClassRealmRequest.java
@@ -0,0 +1,100 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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 java.util.Map;
+
+/**
+ * Describes the requirements for a new class realm.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ClassRealmRequest
+{
+
+ /**
+ * The type of a class realm.
+ */
+ enum RealmType
+ {
+ /**
+ * The class realm for the public API of the Maven core.
+ */
+ Core,
+
+ /**
+ * A class realm for a project to aggregates its build extensions.
+ */
+ Project,
+
+ /**
+ * A class realm for a build extension.
+ */
+ Extension,
+
+ /**
+ * A class realm for a plugin.
+ */
+ Plugin,
+ }
+
+ /**
+ * Gets the type of the class realm.
+ *
+ * @return The type of the class realm, never {@code null}.
+ */
+ RealmType getType();
+
+ /**
+ * Gets the parent class realm (if any).
+ *
+ * @return The parent class realm or {@code null} if using the default parent.
+ */
+ ClassLoader getParent();
+
+ /**
+ * @deprecated Use {@link #getParentImports()} instead.
+ */
+ @Deprecated
+ List<String> getImports();
+
+ /**
+ * Gets the packages/types to import from the parent realm.
+ *
+ * @return The modifiable list of packages/types to import from the parent realm, never {@code null}.
+ */
+ List<String> getParentImports();
+
+ /**
+ * Gets the packages/types to import from foreign realms.
+ *
+ * @return The modifiable map of packages/types to import from foreign realms, never {@code null}.
+ */
+ Map<String, ClassLoader> getForeignImports();
+
+ /**
+ * Gets the constituents for the class realm.
+ *
+ * @return The modifiable list of constituents for the class realm, never {@code null}.
+ */
+ List<ClassRealmConstituent> getConstituents();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
new file mode 100644
index 00000000..69ee04a9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmManager.java
@@ -0,0 +1,416 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.classrealm.ClassRealmRequest.RealmType;
+import org.apache.maven.extension.internal.CoreExportsProvider;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.codehaus.plexus.MutablePlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.artifact.Artifact;
+
+/**
+ * Manages the class realms used by Maven. <strong>Warning:</strong> This is an internal utility class that is only
+ * public for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted
+ * without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+@Named
+@Singleton
+public class DefaultClassRealmManager
+ implements ClassRealmManager
+{
+ public static final String API_REALMID = "maven.api";
+
+ /**
+ * During normal command line build, ClassWorld is loaded by jvm system classloader, which only includes
+ * plexus-classworlds jar and possibly javaagent classes, see http://jira.codehaus.org/browse/MNG-4747.
+ * <p>
+ * Using ClassWorld to determine plugin/extensions realm parent classloaders gives m2e and integration test harness
+ * flexibility to load multiple version of maven into dedicated classloaders without assuming state of jvm system
+ * classloader.
+ */
+ private static final ClassLoader PARENT_CLASSLOADER = ClassWorld.class.getClassLoader();
+
+ private final Logger logger;
+
+ private final ClassWorld world;
+
+ private final ClassRealm containerRealm;
+
+ // this is a live injected collection
+ private final List<ClassRealmManagerDelegate> delegates;
+
+ private final ClassRealm mavenApiRealm;
+
+ /**
+ * Patterns of artifacts provided by maven core and exported via maven api realm. These artifacts are filtered from
+ * plugin and build extensions realms to avoid presence of duplicate and possibly conflicting classes on classpath.
+ */
+ private final Set<String> providedArtifacts;
+
+ @Inject
+ public DefaultClassRealmManager( Logger logger, PlexusContainer container,
+ List<ClassRealmManagerDelegate> delegates, CoreExportsProvider exports )
+ {
+ this.logger = logger;
+ this.world = ( (MutablePlexusContainer) container ).getClassWorld();
+ this.containerRealm = container.getContainerRealm();
+ this.delegates = delegates;
+
+ Map<String, ClassLoader> foreignImports = exports.get().getExportedPackages();
+
+ this.mavenApiRealm =
+ createRealm( API_REALMID, RealmType.Core, null /* parent */, null /* parentImports */,
+ foreignImports, null /* artifacts */ );
+
+ this.providedArtifacts = exports.get().getExportedArtifacts();
+ }
+
+ private ClassRealm newRealm( String id )
+ {
+ synchronized ( world )
+ {
+ String realmId = id;
+
+ Random random = new Random();
+
+ while ( true )
+ {
+ try
+ {
+ ClassRealm classRealm = world.newRealm( realmId, null );
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Created new class realm " + realmId );
+ }
+
+ return classRealm;
+ }
+ catch ( DuplicateRealmException e )
+ {
+ realmId = id + '-' + random.nextInt();
+ }
+ }
+ }
+ }
+
+ public ClassRealm getMavenApiRealm()
+ {
+ return mavenApiRealm;
+ }
+
+ /**
+ * Creates a new class realm with the specified parent and imports.
+ *
+ * @param baseRealmId The base id to use for the new realm, must not be {@code null}.
+ * @param type The type of the class realm, must not be {@code null}.
+ * @param parent The parent realm for the new realm, may be {@code null}.
+ * @param parentImports The packages/types to import from the parent realm, may be {@code null}.
+ * @param foreignImports The packages/types to import from foreign realms, may be {@code null}.
+ * @param artifacts The artifacts to add to the realm, may be {@code null}. Unresolved artifacts (i.e. with a
+ * missing file) will automatically be excluded from the realm.
+ * @return The created class realm, never {@code null}.
+ */
+ private ClassRealm createRealm( String baseRealmId, RealmType type, ClassLoader parent, List<String> parentImports,
+ Map<String, ClassLoader> foreignImports, List<Artifact> artifacts )
+ {
+ Set<String> artifactIds = new LinkedHashSet<String>();
+
+ List<ClassRealmConstituent> constituents = new ArrayList<ClassRealmConstituent>();
+
+ if ( artifacts != null )
+ {
+ for ( Artifact artifact : artifacts )
+ {
+ if ( !isProvidedArtifact( artifact ) )
+ {
+ artifactIds.add( getId( artifact ) );
+ if ( artifact.getFile() != null )
+ {
+ constituents.add( new ArtifactClassRealmConstituent( artifact ) );
+ }
+ }
+ }
+ }
+
+ if ( parentImports != null )
+ {
+ parentImports = new ArrayList<String>( parentImports );
+ }
+ else
+ {
+ parentImports = new ArrayList<String>();
+ }
+
+ if ( foreignImports != null )
+ {
+ foreignImports = new TreeMap<String, ClassLoader>( foreignImports );
+ }
+ else
+ {
+ foreignImports = new TreeMap<String, ClassLoader>();
+ }
+
+ ClassRealm classRealm = newRealm( baseRealmId );
+
+ if ( parent != null )
+ {
+ classRealm.setParentClassLoader( parent );
+ }
+
+ callDelegates( classRealm, type, parent, parentImports, foreignImports, constituents );
+
+ wireRealm( classRealm, parentImports, foreignImports );
+
+ Set<String> includedIds = populateRealm( classRealm, constituents );
+
+ if ( logger.isDebugEnabled() )
+ {
+ artifactIds.removeAll( includedIds );
+
+ for ( String id : artifactIds )
+ {
+ logger.debug( " Excluded: " + id );
+ }
+ }
+
+ return classRealm;
+ }
+
+ public ClassRealm getCoreRealm()
+ {
+ return containerRealm;
+ }
+
+ public ClassRealm createProjectRealm( Model model, List<Artifact> artifacts )
+ {
+ if ( model == null )
+ {
+ throw new IllegalArgumentException( "model missing" );
+ }
+
+ ClassLoader parent = getMavenApiRealm();
+
+ return createRealm( getKey( model ), RealmType.Project, parent, null, null, artifacts );
+ }
+
+ private static String getKey( Model model )
+ {
+ return "project>" + model.getGroupId() + ":" + model.getArtifactId() + ":" + model.getVersion();
+ }
+
+ public ClassRealm createExtensionRealm( Plugin plugin, List<Artifact> artifacts )
+ {
+ if ( plugin == null )
+ {
+ throw new IllegalArgumentException( "extension plugin missing" );
+ }
+
+ ClassLoader parent = PARENT_CLASSLOADER;
+
+ Map<String, ClassLoader> foreignImports =
+ Collections.<String, ClassLoader>singletonMap( "", getMavenApiRealm() );
+
+ return createRealm( getKey( plugin, true ), RealmType.Extension, parent, null, foreignImports, artifacts );
+ }
+
+ private boolean isProvidedArtifact( Artifact artifact )
+ {
+ return providedArtifacts.contains( artifact.getGroupId() + ":" + artifact.getArtifactId() );
+ }
+
+ public ClassRealm createPluginRealm( Plugin plugin, ClassLoader parent, List<String> parentImports,
+ Map<String, ClassLoader> foreignImports, List<Artifact> artifacts )
+ {
+ if ( plugin == null )
+ {
+ throw new IllegalArgumentException( "plugin missing" );
+ }
+
+ if ( parent == null )
+ {
+ parent = PARENT_CLASSLOADER;
+ }
+
+ return createRealm( getKey( plugin, false ), RealmType.Plugin, parent, parentImports, foreignImports,
+ artifacts );
+ }
+
+ private static String getKey( Plugin plugin, boolean extension )
+ {
+ String version = ArtifactUtils.toSnapshotVersion( plugin.getVersion() );
+ return ( extension ? "extension>" : "plugin>" ) + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":"
+ + version;
+ }
+
+ private static String getId( Artifact artifact )
+ {
+ return getId( artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(),
+ artifact.getClassifier(), artifact.getBaseVersion() );
+ }
+
+ private static String getId( ClassRealmConstituent constituent )
+ {
+ return getId( constituent.getGroupId(), constituent.getArtifactId(), constituent.getType(),
+ constituent.getClassifier(), constituent.getVersion() );
+ }
+
+ private static String getId( String gid, String aid, String type, String cls, String ver )
+ {
+ return gid + ':' + aid + ':' + type + ( StringUtils.isNotEmpty( cls ) ? ':' + cls : "" ) + ':' + ver;
+ }
+
+ private void callDelegates( ClassRealm classRealm, RealmType type, ClassLoader parent, List<String> parentImports,
+ Map<String, ClassLoader> foreignImports, List<ClassRealmConstituent> constituents )
+ {
+ List<ClassRealmManagerDelegate> delegates = new ArrayList<ClassRealmManagerDelegate>( this.delegates );
+
+ if ( !delegates.isEmpty() )
+ {
+ ClassRealmRequest request =
+ new DefaultClassRealmRequest( type, parent, parentImports, foreignImports, constituents );
+
+ for ( ClassRealmManagerDelegate delegate : delegates )
+ {
+ try
+ {
+ delegate.setupRealm( classRealm, request );
+ }
+ catch ( Exception e )
+ {
+ logger.error( delegate.getClass().getName() + " failed to setup class realm " + classRealm + ": "
+ + e.getMessage(), e );
+ }
+ }
+ }
+ }
+
+ private Set<String> populateRealm( ClassRealm classRealm, List<ClassRealmConstituent> constituents )
+ {
+ Set<String> includedIds = new LinkedHashSet<String>();
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Populating class realm " + classRealm.getId() );
+ }
+
+ for ( ClassRealmConstituent constituent : constituents )
+ {
+ File file = constituent.getFile();
+
+ String id = getId( constituent );
+ includedIds.add( id );
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( " Included: " + id );
+ }
+
+ try
+ {
+ classRealm.addURL( file.toURI().toURL() );
+ }
+ catch ( MalformedURLException e )
+ {
+ // Not going to happen
+ logger.error( e.getMessage(), e );
+ }
+ }
+
+ return includedIds;
+ }
+
+ private void wireRealm( ClassRealm classRealm, List<String> parentImports, Map<String, ClassLoader> foreignImports )
+ {
+ if ( foreignImports != null && !foreignImports.isEmpty() )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Importing foreign packages into class realm " + classRealm.getId() );
+ }
+
+ for ( Map.Entry<String, ClassLoader> entry : foreignImports.entrySet() )
+ {
+ ClassLoader importedRealm = entry.getValue();
+ String imp = entry.getKey();
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( " Imported: " + imp + " < " + getId( importedRealm ) );
+ }
+
+ classRealm.importFrom( importedRealm, imp );
+ }
+ }
+
+ if ( parentImports != null && !parentImports.isEmpty() )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Importing parent packages into class realm " + classRealm.getId() );
+ }
+
+ for ( String imp : parentImports )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( " Imported: " + imp + " < " + getId( classRealm.getParentClassLoader() ) );
+ }
+
+ classRealm.importFromParent( imp );
+ }
+ }
+ }
+
+ private String getId( ClassLoader classLoader )
+ {
+ if ( classLoader instanceof ClassRealm )
+ {
+ return ( (ClassRealm) classLoader ).getId();
+ }
+ return String.valueOf( classLoader );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmRequest.java
new file mode 100644
index 00000000..062b2cf3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/classrealm/DefaultClassRealmRequest.java
@@ -0,0 +1,82 @@
+package org.apache.maven.classrealm;
+
+/*
+ * 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 java.util.Map;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class DefaultClassRealmRequest
+ implements ClassRealmRequest
+{
+
+ private final RealmType type;
+
+ private final ClassLoader parent;
+
+ private final List<String> parentImports;
+
+ private final Map<String, ClassLoader> foreignImports;
+
+ private final List<ClassRealmConstituent> constituents;
+
+ public DefaultClassRealmRequest( RealmType type, ClassLoader parent, List<String> parentImports,
+ Map<String, ClassLoader> foreignImports, List<ClassRealmConstituent> constituents )
+ {
+ this.type = type;
+ this.parent = parent;
+ this.parentImports = parentImports;
+ this.foreignImports = foreignImports;
+ this.constituents = constituents;
+ }
+
+ public RealmType getType()
+ {
+ return type;
+ }
+
+ public ClassLoader getParent()
+ {
+ return parent;
+ }
+
+ public List<String> getImports()
+ {
+ return getParentImports();
+ }
+
+ public List<String> getParentImports()
+ {
+ return parentImports;
+ }
+
+ public Map<String, ClassLoader> getForeignImports()
+ {
+ return foreignImports;
+ }
+
+ public List<ClassRealmConstituent> getConstituents()
+ {
+ return constituents;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BasedirBeanConfigurationPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BasedirBeanConfigurationPathTranslator.java
new file mode 100644
index 00000000..9859f586
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BasedirBeanConfigurationPathTranslator.java
@@ -0,0 +1,71 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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;
+
+/**
+ * A path translator that resolves relative paths against a specific base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+public class BasedirBeanConfigurationPathTranslator
+ implements BeanConfigurationPathTranslator
+{
+
+ private final File basedir;
+
+ /**
+ * Creates a new path translator using the specified base directory.
+ *
+ * @param basedir The base directory to resolve relative paths against, may be {@code null} to disable path
+ * translation.
+ */
+ public BasedirBeanConfigurationPathTranslator( File basedir )
+ {
+ this.basedir = basedir;
+ }
+
+ public File translatePath( File path )
+ {
+ File result = path;
+
+ if ( path != null && basedir != null )
+ {
+ if ( path.isAbsolute() )
+ {
+ // path is already absolute, we're done
+ }
+ else if ( path.getPath().startsWith( File.separator ) )
+ {
+ // drive-relative Windows path, don't align with base dir but with drive root
+ result = path.getAbsoluteFile();
+ }
+ else
+ {
+ // an ordinary relative path, align with base dir
+ result = new File( new File( basedir, path.getPath() ).toURI().normalize() ).getAbsoluteFile();
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationException.java
new file mode 100644
index 00000000..3d10ed4a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationException.java
@@ -0,0 +1,41 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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.
+ */
+
+/**
+ * Thrown when a bean couldn't be configured.
+ *
+ * @author Benjamin Bentmann
+ */
+public class BeanConfigurationException
+ extends Exception
+{
+
+ public BeanConfigurationException( String message )
+ {
+ super( message );
+ }
+
+ public BeanConfigurationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationPathTranslator.java
new file mode 100644
index 00000000..39663391
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationPathTranslator.java
@@ -0,0 +1,41 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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;
+
+/**
+ * Postprocesses filesystem paths. For instance, a path translator might want to resolve relative paths given in the
+ * bean configuration against some base directory.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface BeanConfigurationPathTranslator
+{
+
+ /**
+ * Translates the specified path.
+ *
+ * @param path The path to translate, may be {@code null}.
+ * @return The translated path or {@code null} if none.
+ */
+ File translatePath( File path );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationRequest.java
new file mode 100644
index 00000000..d19aa204
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationRequest.java
@@ -0,0 +1,130 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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.
+ */
+
+/**
+ * A request to configure a bean from some configuration in the POM or similar.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface BeanConfigurationRequest
+{
+
+ /**
+ * Gets the bean to configure. Eventually, a valid request must have a bean set.
+ *
+ * @return The bean to configure, or {@code null} if none.
+ */
+ Object getBean();
+
+ /**
+ * Sets the bean to configure. Eventually, a valid request must have a bean set.
+ *
+ * @param bean The bean to configure, may be {@code null}.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setBean( Object bean );
+
+ /**
+ * Gets the configuration to unmarshal into the bean.
+ *
+ * @return The configuration to unmarshal into the bean or {@code null} if none.
+ */
+ Object getConfiguration();
+
+ /**
+ * Sets the configuration to unmarshal into the bean. The configuration should be taken from
+ * {@link org.apache.maven.model.ConfigurationContainer#getConfiguration()} or a similar source.
+ * Fully equivalent to {@code setConfiguration(configuration, null)}.
+ *
+ * @param configuration The configuration to unmarshal, may be {@code null}.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setConfiguration( Object configuration );
+
+ /**
+ * Sets the configuration to unmarshal into the bean. The configuration should be taken from
+ * {@link org.apache.maven.model.ConfigurationContainer#getConfiguration()} or a similar source.
+ * If {@code element} is not {@code null}, child configuration element with the specified name will
+ * be unmarshaled.
+ *
+ * @param configuration The configuration to unmarshal, may be {@code null}.
+ * @param element Configuration element name to unmarshal or {@code null} to unmarshal entire configuration.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setConfiguration( Object configuration, String element );
+
+ /**
+ * Returns configuration element name or {@code null}.
+ *
+ * @see #setConfiguration(Object, String)
+ *
+ * @return Configuration element name or {@code null}
+ */
+ String getConfigurationElement();
+
+ /**
+ * Gets the class loader from which to load any types referenced by the configuration. If unset, the class loader of
+ * the bean class will be used.
+ *
+ * @return The class loader to load referenced types from or {@code null} if unset.
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Sets the class loader from which to load any types referenced by the configuration. If unset, the class loader of
+ * the bean class will be used.
+ *
+ * @param classLoader The class loader to load referenced types from, may be {@code null}.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setClassLoader( ClassLoader classLoader );
+
+ /**
+ * Gets the optional preprocessor for configuration values.
+ *
+ * @return The preprocessor for configuration values or {@code null} if none.
+ */
+ BeanConfigurationValuePreprocessor getValuePreprocessor();
+
+ /**
+ * Sets the optional preprocessor for configuration values.
+ *
+ * @param valuePreprocessor The preprocessor for configuration values, may be {@code null} if unneeded.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setValuePreprocessor( BeanConfigurationValuePreprocessor valuePreprocessor );
+
+ /**
+ * Gets the optional path translator for configuration values unmarshalled to files.
+ *
+ * @return The path translator for files or {@code null} if none.
+ */
+ BeanConfigurationPathTranslator getPathTranslator();
+
+ /**
+ * Sets the optional path translator for configuration values unmarshalled to files.
+ *
+ * @param pathTranslator The path translator for files, may be {@code null} if unneeded.
+ * @return This request for chaining, never {@code null}.
+ */
+ BeanConfigurationRequest setPathTranslator( BeanConfigurationPathTranslator pathTranslator );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationValuePreprocessor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationValuePreprocessor.java
new file mode 100644
index 00000000..63f85173
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurationValuePreprocessor.java
@@ -0,0 +1,45 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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.
+ */
+
+/**
+ * Preprocesses a value from a bean configuration before the bean configurator unmarshals it into a bean property. A
+ * common use case for such preprocessing is the evaluation of variables within the configuration value.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface BeanConfigurationValuePreprocessor
+{
+
+ /**
+ * Preprocesses the specified bean configuration value. The optional type provided to this method is a hint (not a
+ * requirement) for the preprocessor to resolve the value to a compatible value or a (string) value than can be
+ * unmarshalled into that type. The preprocessor is not required to perform any type conversion but should rather
+ * filter out incompatible values from its result.
+ *
+ * @param value The configuration value to preprocess, must not be {@code null}.
+ * @param type The target type of the value, may be {@code null}.
+ * @return The processed configuration value or {@code null} if none.
+ * @throws BeanConfigurationException If an error occurred while preprocessing the value.
+ */
+ Object preprocessValue( String value, Class<?> type )
+ throws BeanConfigurationException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurator.java
new file mode 100644
index 00000000..36d23eca
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/BeanConfigurator.java
@@ -0,0 +1,44 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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.
+ */
+
+/**
+ * Unmarshals some textual configuration from the POM or similar into the properties of a bean. This component works
+ * similar to the way Maven configures plugins from the POM, i.e. some configuration like {@code <param>value</param>}
+ * is mapped to an equally named property of the bean and converted. The properties of the bean are supposed to either
+ * have a public setter or be backed by an equally named field (of any visibility).
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface BeanConfigurator
+{
+
+ /**
+ * Performs the specified bean configuration.
+ *
+ * @param request The configuration request that specifies the bean and the configuration to process, must not be
+ * {@code null}.
+ * @throws BeanConfigurationException If the bean configuration could not be successfully processed.
+ */
+ void configureBean( BeanConfigurationRequest request )
+ throws BeanConfigurationException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java
new file mode 100644
index 00000000..32def48f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/DefaultBeanConfigurationRequest.java
@@ -0,0 +1,195 @@
+package org.apache.maven.configuration;
+
+/*
+ * 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.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * A basic bean configuration request.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultBeanConfigurationRequest
+ implements BeanConfigurationRequest
+{
+
+ private Object bean;
+
+ private Object configuration;
+
+ private String configurationElement;
+
+ private ClassLoader classLoader;
+
+ private BeanConfigurationValuePreprocessor valuePreprocessor;
+
+ private BeanConfigurationPathTranslator pathTranslator;
+
+ public Object getBean()
+ {
+ return bean;
+ }
+
+ public DefaultBeanConfigurationRequest setBean( Object bean )
+ {
+ this.bean = bean;
+ return this;
+ }
+
+ public Object getConfiguration()
+ {
+ return configuration;
+ }
+
+ public String getConfigurationElement()
+ {
+ return configurationElement;
+ }
+
+ public DefaultBeanConfigurationRequest setConfiguration( Object configuration )
+ {
+ return setConfiguration( configuration, null );
+ }
+
+ public DefaultBeanConfigurationRequest setConfiguration( Object configuration, String element )
+ {
+ this.configuration = configuration;
+ this.configurationElement = element;
+ return this;
+ }
+
+ /**
+ * Sets the configuration to the configuration taken from the specified build plugin in the POM. First, the build
+ * plugins will be searched for the specified plugin, if that fails, the plugin management section will be searched.
+ *
+ * @param model The POM to extract the plugin configuration from, may be {@code null}.
+ * @param pluginGroupId The group id of the plugin whose configuration should be used, must not be {@code null} or
+ * empty.
+ * @param pluginArtifactId The artifact id of the plugin whose configuration should be used, must not be
+ * {@code null} or empty.
+ * @param pluginExecutionId The id of a plugin execution whose configuration should be used, may be {@code null} or
+ * empty to use the general plugin configuration.
+ * @return This request for chaining, never {@code null}.
+ */
+ public DefaultBeanConfigurationRequest setConfiguration( Model model, String pluginGroupId,
+ String pluginArtifactId, String pluginExecutionId )
+ {
+ Plugin plugin = findPlugin( model, pluginGroupId, pluginArtifactId );
+ if ( plugin != null )
+ {
+ if ( StringUtils.isNotEmpty( pluginExecutionId ) )
+ {
+ for ( PluginExecution execution : plugin.getExecutions() )
+ {
+ if ( pluginExecutionId.equals( execution.getId() ) )
+ {
+ setConfiguration( execution.getConfiguration() );
+ break;
+ }
+ }
+ }
+ else
+ {
+ setConfiguration( plugin.getConfiguration() );
+ }
+ }
+ return this;
+ }
+
+ private Plugin findPlugin( Model model, String groupId, String artifactId )
+ {
+ if ( StringUtils.isEmpty( groupId ) )
+ {
+ throw new IllegalArgumentException( "group id for plugin has not been specified" );
+ }
+ if ( StringUtils.isEmpty( artifactId ) )
+ {
+ throw new IllegalArgumentException( "artifact id for plugin has not been specified" );
+ }
+
+ if ( model != null )
+ {
+ Build build = model.getBuild();
+ if ( build != null )
+ {
+ for ( Plugin plugin : build.getPlugins() )
+ {
+ if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
+ {
+ return plugin;
+ }
+ }
+
+ PluginManagement mngt = build.getPluginManagement();
+ if ( mngt != null )
+ {
+ for ( Plugin plugin : mngt.getPlugins() )
+ {
+ if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
+ {
+ return plugin;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+
+ public DefaultBeanConfigurationRequest setClassLoader( ClassLoader classLoader )
+ {
+ this.classLoader = classLoader;
+ return this;
+ }
+
+ public BeanConfigurationValuePreprocessor getValuePreprocessor()
+ {
+ return valuePreprocessor;
+ }
+
+ public DefaultBeanConfigurationRequest setValuePreprocessor( BeanConfigurationValuePreprocessor valuePreprocessor )
+ {
+ this.valuePreprocessor = valuePreprocessor;
+ return this;
+ }
+
+ public BeanConfigurationPathTranslator getPathTranslator()
+ {
+ return pathTranslator;
+ }
+
+ public DefaultBeanConfigurationRequest setPathTranslator( BeanConfigurationPathTranslator pathTranslator )
+ {
+ this.pathTranslator = pathTranslator;
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java
new file mode 100644
index 00000000..3d3def62
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java
@@ -0,0 +1,160 @@
+package org.apache.maven.configuration.internal;
+
+/*
+ * 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.configuration.BeanConfigurationException;
+import org.apache.maven.configuration.BeanConfigurationPathTranslator;
+import org.apache.maven.configuration.BeanConfigurationRequest;
+import org.apache.maven.configuration.BeanConfigurationValuePreprocessor;
+import org.apache.maven.configuration.BeanConfigurator;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
+import org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter;
+import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup;
+import org.codehaus.plexus.component.configurator.converters.lookup.DefaultConverterLookup;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.configurator.expression.TypeAwareExpressionEvaluator;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * <strong>Warning:</strong> This is an internal class that is only public for technical reasons, it is not part of the
+ * public API. In particular, this class can be changed or deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = BeanConfigurator.class )
+public class DefaultBeanConfigurator
+ implements BeanConfigurator
+{
+
+ private final ConverterLookup converterLookup = new DefaultConverterLookup();
+
+ public void configureBean( BeanConfigurationRequest request )
+ throws BeanConfigurationException
+ {
+ if ( request == null )
+ {
+ throw new IllegalArgumentException( "bean configuration request not specified" );
+ }
+
+ if ( request.getBean() == null )
+ {
+ throw new IllegalArgumentException( "bean to be configured not specified" );
+ }
+
+ Object configuration = request.getConfiguration();
+ if ( configuration == null )
+ {
+ return;
+ }
+
+ PlexusConfiguration plexusConfig;
+ if ( configuration instanceof PlexusConfiguration )
+ {
+ plexusConfig = (PlexusConfiguration) configuration;
+ }
+ else if ( configuration instanceof Xpp3Dom )
+ {
+ plexusConfig = new XmlPlexusConfiguration( (Xpp3Dom) configuration );
+ }
+ else
+ {
+ throw new BeanConfigurationException( "unsupported bean configuration source ("
+ + configuration.getClass().getName() + ")" );
+ }
+
+ if ( request.getConfigurationElement() != null )
+ {
+ plexusConfig = plexusConfig.getChild( request.getConfigurationElement() );
+ }
+
+ ClassLoader classLoader = request.getClassLoader();
+ if ( classLoader == null )
+ {
+ classLoader = request.getBean().getClass().getClassLoader();
+ }
+
+ BeanExpressionEvaluator evaluator = new BeanExpressionEvaluator( request );
+
+ ObjectWithFieldsConverter converter = new ObjectWithFieldsConverter();
+
+ try
+ {
+ converter.processConfiguration( converterLookup, request.getBean(), classLoader, plexusConfig, evaluator );
+ }
+ catch ( ComponentConfigurationException e )
+ {
+ throw new BeanConfigurationException( e.getMessage(), e );
+ }
+ }
+
+ static class BeanExpressionEvaluator
+ implements TypeAwareExpressionEvaluator
+ {
+
+ private final BeanConfigurationValuePreprocessor preprocessor;
+
+ private final BeanConfigurationPathTranslator translator;
+
+ public BeanExpressionEvaluator( BeanConfigurationRequest request )
+ {
+ preprocessor = request.getValuePreprocessor();
+ translator = request.getPathTranslator();
+ }
+
+ public Object evaluate( String expression, Class<?> type )
+ throws ExpressionEvaluationException
+ {
+ if ( preprocessor != null )
+ {
+ try
+ {
+ return preprocessor.preprocessValue( expression, type );
+ }
+ catch ( BeanConfigurationException e )
+ {
+ throw new ExpressionEvaluationException( e.getMessage(), e );
+ }
+ }
+ return expression;
+ }
+
+ public Object evaluate( String expression )
+ throws ExpressionEvaluationException
+ {
+ return evaluate( expression, null );
+ }
+
+ public File alignToBaseDirectory( File file )
+ {
+ if ( translator != null )
+ {
+ return translator.translatePath( file );
+ }
+ return file;
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/AbstractEventSpy.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/AbstractEventSpy.java
new file mode 100644
index 00000000..09132275
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/AbstractEventSpy.java
@@ -0,0 +1,45 @@
+package org.apache.maven.eventspy;
+
+/*
+ * 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.
+ */
+
+/**
+ * A skeleton eventspy that does nothing other than helping implementors.
+ * @since 3.0.2
+ */
+public abstract class AbstractEventSpy
+ implements EventSpy
+{
+
+ public void init( Context context )
+ throws Exception
+ {
+ }
+
+ public void onEvent( Object event )
+ throws Exception
+ {
+ }
+
+ public void close()
+ throws Exception
+ {
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/EventSpy.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/EventSpy.java
new file mode 100644
index 00000000..4284fce9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/EventSpy.java
@@ -0,0 +1,77 @@
+package org.apache.maven.eventspy;
+
+/*
+ * 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.Map;
+
+/**
+ * A core extension to monitor Maven's execution. Typically, such an extension gets loaded into Maven by specifying the
+ * system property {@code maven.ext.class.path} on the command line. As soon as dependency injection is setup, Maven
+ * looks up all implementators of this interface and calls their {@link #init(Context)} method. <em>Note:</em>
+ * Implementors are strongly advised to inherit from {@link AbstractEventSpy} instead of directly implementing this
+ * interface.
+ * @since 3.0.2
+ */
+public interface EventSpy
+{
+
+ interface Context
+ {
+
+ /**
+ * Gets key-value pairs providing information about the Maven runtime.
+ *
+ * @return The key-value pairs, never {@code null}.
+ */
+ Map<String, Object> getData();
+
+ }
+
+ /**
+ * Initializes the spy.
+ *
+ * @param context The event spy context, never {@code null}.
+ */
+ void init( Context context )
+ throws Exception;
+
+ /**
+ * Notifies the spy of some build event/operation.
+ *
+ * @param event The event, never {@code null}.
+ * @see org.apache.maven.settings.building.SettingsBuildingRequest
+ * @see org.apache.maven.settings.building.SettingsBuildingResult
+ * @see org.apache.maven.execution.MavenExecutionRequest
+ * @see org.apache.maven.execution.MavenExecutionResult
+ * @see org.apache.maven.project.DependencyResolutionRequest
+ * @see org.apache.maven.project.DependencyResolutionResult
+ * @see org.apache.maven.execution.ExecutionEvent
+ * @see org.eclipse.aether.RepositoryEvent
+ */
+ void onEvent( Object event )
+ throws Exception;
+
+ /**
+ * Notifies the spy of Maven's termination, allowing it to free any resources allocated by it.
+ */
+ void close()
+ throws Exception;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyDispatcher.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyDispatcher.java
new file mode 100644
index 00000000..d44642d1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyDispatcher.java
@@ -0,0 +1,158 @@
+package org.apache.maven.eventspy.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.eventspy.EventSpy;
+import org.apache.maven.execution.ExecutionListener;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.RepositoryListener;
+
+/**
+ * Dispatches callbacks to all registered eventspies.
+ * @since 3.0.2
+ */
+@Component( role = EventSpyDispatcher.class )
+public class EventSpyDispatcher
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement( role = EventSpy.class )
+ private List<EventSpy> eventSpies;
+
+ public void setEventSpies( List<EventSpy> eventSpies )
+ {
+ // make copy to get rid of needless overhead for dynamic lookups
+ this.eventSpies = new ArrayList<EventSpy>( eventSpies );
+ }
+
+ public List<EventSpy> getEventSpies()
+ {
+ return eventSpies;
+ }
+
+ public ExecutionListener chainListener( ExecutionListener listener )
+ {
+ if ( eventSpies.isEmpty() )
+ {
+ return listener;
+ }
+ return new EventSpyExecutionListener( this, listener );
+ }
+
+ public RepositoryListener chainListener( RepositoryListener listener )
+ {
+ if ( eventSpies.isEmpty() )
+ {
+ return listener;
+ }
+ return new EventSpyRepositoryListener( this, listener );
+ }
+
+ public void init( EventSpy.Context context )
+ {
+ if ( eventSpies.isEmpty() )
+ {
+ return;
+ }
+ for ( EventSpy eventSpy : eventSpies )
+ {
+ try
+ {
+ eventSpy.init( context );
+ }
+ catch ( Exception e )
+ {
+ logError( "initialize", e, eventSpy );
+ }
+ catch ( LinkageError e )
+ {
+ logError( "initialize", e, eventSpy );
+ }
+ }
+ }
+
+ public void onEvent( Object event )
+ {
+ if ( eventSpies.isEmpty() )
+ {
+ return;
+ }
+ for ( EventSpy eventSpy : eventSpies )
+ {
+ try
+ {
+ eventSpy.onEvent( event );
+ }
+ catch ( Exception e )
+ {
+ logError( "notify", e, eventSpy );
+ }
+ catch ( LinkageError e )
+ {
+ logError( "notify", e, eventSpy );
+ }
+ }
+ }
+
+ public void close()
+ {
+ if ( eventSpies.isEmpty() )
+ {
+ return;
+ }
+ for ( EventSpy eventSpy : eventSpies )
+ {
+ try
+ {
+ eventSpy.close();
+ }
+ catch ( Exception e )
+ {
+ logError( "close", e, eventSpy );
+ }
+ catch ( LinkageError e )
+ {
+ logError( "close", e, eventSpy );
+ }
+ }
+ }
+
+ private void logError( String action, Throwable e, EventSpy spy )
+ {
+ String msg = "Failed to " + action + " spy " + spy.getClass().getName() + ": " + e.getMessage();
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.warn( msg, e );
+ }
+ else
+ {
+ logger.warn( msg );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyExecutionListener.java
new file mode 100644
index 00000000..6b25da58
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyExecutionListener.java
@@ -0,0 +1,163 @@
+package org.apache.maven.eventspy.internal;
+
+/*
+ * 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.execution.AbstractExecutionListener;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.ExecutionListener;
+
+/**
+ * Forwards execution events to eventspies.
+ * @since 3.0.2
+ */
+class EventSpyExecutionListener
+ extends AbstractExecutionListener
+{
+
+ private final EventSpyDispatcher dispatcher;
+
+ private final ExecutionListener delegate;
+
+ public EventSpyExecutionListener( EventSpyDispatcher dispatcher, ExecutionListener delegate )
+ {
+ this.dispatcher = dispatcher;
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void projectDiscoveryStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.projectDiscoveryStarted( event );
+ }
+
+ @Override
+ public void sessionStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.sessionStarted( event );
+ }
+
+ @Override
+ public void sessionEnded( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.sessionEnded( event );
+ }
+
+ @Override
+ public void projectSkipped( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.projectSkipped( event );
+ }
+
+ @Override
+ public void projectStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.projectStarted( event );
+ }
+
+ @Override
+ public void projectSucceeded( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.projectSucceeded( event );
+ }
+
+ @Override
+ public void projectFailed( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.projectFailed( event );
+ }
+
+ @Override
+ public void forkStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkStarted( event );
+ }
+
+ @Override
+ public void forkSucceeded( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkSucceeded( event );
+ }
+
+ @Override
+ public void forkFailed( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkFailed( event );
+ }
+
+ @Override
+ public void mojoSkipped( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.mojoSkipped( event );
+ }
+
+ @Override
+ public void mojoStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.mojoStarted( event );
+ }
+
+ @Override
+ public void mojoSucceeded( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.mojoSucceeded( event );
+ }
+
+ @Override
+ public void mojoFailed( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.mojoFailed( event );
+ }
+
+ @Override
+ public void forkedProjectStarted( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkedProjectStarted( event );
+ }
+
+ @Override
+ public void forkedProjectSucceeded( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkedProjectSucceeded( event );
+ }
+
+ @Override
+ public void forkedProjectFailed( ExecutionEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.forkedProjectFailed( event );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyRepositoryListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyRepositoryListener.java
new file mode 100644
index 00000000..60d4cd1c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/eventspy/internal/EventSpyRepositoryListener.java
@@ -0,0 +1,176 @@
+package org.apache.maven.eventspy.internal;
+
+/*
+ * 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.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryListener;
+
+/**
+ * Forwards repository events to eventspies.
+ * @since 3.0.2
+ */
+class EventSpyRepositoryListener
+ extends AbstractRepositoryListener
+{
+ private final EventSpyDispatcher dispatcher;
+
+ private final RepositoryListener delegate;
+
+ public EventSpyRepositoryListener( EventSpyDispatcher dispatcher, RepositoryListener delegate )
+ {
+ this.dispatcher = dispatcher;
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void artifactDeployed( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDeployed( event );
+ }
+
+ @Override
+ public void artifactDeploying( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDeploying( event );
+ }
+
+ @Override
+ public void artifactDescriptorInvalid( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDescriptorInvalid( event );
+ }
+
+ @Override
+ public void artifactDescriptorMissing( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDescriptorMissing( event );
+ }
+
+ @Override
+ public void artifactInstalled( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactInstalled( event );
+ }
+
+ @Override
+ public void artifactInstalling( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactInstalling( event );
+ }
+
+ @Override
+ public void artifactResolved( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactResolved( event );
+ }
+
+ @Override
+ public void artifactResolving( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactResolving( event );
+ }
+
+ @Override
+ public void metadataDeployed( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataDeployed( event );
+ }
+
+ @Override
+ public void metadataDeploying( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataDeploying( event );
+ }
+
+ @Override
+ public void metadataInstalled( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataInstalled( event );
+ }
+
+ @Override
+ public void metadataInstalling( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataInstalling( event );
+ }
+
+ @Override
+ public void metadataInvalid( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataInvalid( event );
+ }
+
+ @Override
+ public void metadataResolved( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataResolved( event );
+ }
+
+ @Override
+ public void metadataResolving( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataResolving( event );
+ }
+
+ @Override
+ public void artifactDownloaded( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDownloaded( event );
+ }
+
+ @Override
+ public void artifactDownloading( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.artifactDownloading( event );
+ }
+
+ @Override
+ public void metadataDownloaded( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataDownloaded( event );
+ }
+
+ @Override
+ public void metadataDownloading( RepositoryEvent event )
+ {
+ dispatcher.onEvent( event );
+ delegate.metadataDownloading( event );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
new file mode 100644
index 00000000..6df72c81
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
@@ -0,0 +1,336 @@
+package org.apache.maven.exception;
+
+/*
+ * 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.net.ConnectException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProblemUtils;
+import org.apache.maven.plugin.AbstractMojoExecutionException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.PluginContainerException;
+import org.apache.maven.plugin.PluginExecutionException;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+
+/*
+
+- test projects for each of these
+- how to categorize the problems so that the id of the problem can be match to a page with descriptive help and the test
+ project
+- nice little sample projects that could be run in the core as well as integration tests
+
+All Possible Errors
+- invalid lifecycle phase (maybe same as bad CLI param, though you were talking about embedder too)
+- <module> specified is not found
+- malformed settings
+- malformed POM
+- local repository not writable
+- remote repositories not available
+- artifact metadata missing
+- extension metadata missing
+- extension artifact missing
+- artifact metadata retrieval problem
+- version range violation
+- circular dependency
+- artifact missing
+- artifact retrieval exception
+- md5 checksum doesn't match for local artifact, need to redownload this
+- POM doesn't exist for a goal that requires one
+- parent POM missing (in both the repository + relative path)
+- component not found
+
+Plugins:
+- plugin metadata missing
+- plugin metadata retrieval problem
+- plugin artifact missing
+- plugin artifact retrieval problem
+- plugin dependency metadata missing
+- plugin dependency metadata retrieval problem
+- plugin configuration problem
+- plugin execution failure due to something that is know to possibly go wrong (like compilation failure)
+- plugin execution error due to something that is not expected to go wrong (the compiler executable missing)
+- asking to use a plugin for which you do not have a version defined - tools to easily select versions
+- goal not found in a plugin (probably could list the ones that are)
+
+ */
+
+// PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+// CycleDetectedInPluginGraphException;
+
+@Component( role = ExceptionHandler.class )
+public class DefaultExceptionHandler
+ implements ExceptionHandler
+{
+
+ public ExceptionSummary handleException( Throwable exception )
+ {
+ return handle( "", exception );
+ }
+
+ private ExceptionSummary handle( String message, Throwable exception )
+ {
+ String reference = getReference( exception );
+
+ List<ExceptionSummary> children = null;
+
+ if ( exception instanceof ProjectBuildingException )
+ {
+ List<ProjectBuildingResult> results = ( (ProjectBuildingException) exception ).getResults();
+
+ children = new ArrayList<ExceptionSummary>();
+
+ for ( ProjectBuildingResult result : results )
+ {
+ ExceptionSummary child = handle( result );
+ if ( child != null )
+ {
+ children.add( child );
+ }
+ }
+
+ message = "The build could not read " + children.size() + " project" + ( children.size() == 1 ? "" : "s" );
+ }
+ else
+ {
+ message = getMessage( message, exception );
+ }
+
+ return new ExceptionSummary( exception, message, reference, children );
+ }
+
+ private ExceptionSummary handle( ProjectBuildingResult result )
+ {
+ List<ExceptionSummary> children = new ArrayList<ExceptionSummary>();
+
+ for ( ModelProblem problem : result.getProblems() )
+ {
+ ExceptionSummary child = handle( problem, result.getProjectId() );
+ if ( child != null )
+ {
+ children.add( child );
+ }
+ }
+
+ if ( children.isEmpty() )
+ {
+ return null;
+ }
+
+ String message =
+ "\nThe project " + result.getProjectId() + " (" + result.getPomFile() + ") has "
+ + children.size() + " error" + ( children.size() == 1 ? "" : "s" );
+
+ return new ExceptionSummary( null, message, null, children );
+ }
+
+ private ExceptionSummary handle( ModelProblem problem, String projectId )
+ {
+ if ( ModelProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 )
+ {
+ String message = problem.getMessage();
+
+ String location = ModelProblemUtils.formatLocation( problem, projectId );
+
+ if ( StringUtils.isNotEmpty( location ) )
+ {
+ message += " @ " + location;
+ }
+
+ return handle( message, problem.getException() );
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private String getReference( Throwable exception )
+ {
+ String reference = "";
+
+ if ( exception != null )
+ {
+ if ( exception instanceof MojoExecutionException )
+ {
+ reference = MojoExecutionException.class.getSimpleName();
+
+ Throwable cause = exception.getCause();
+ if ( cause instanceof IOException )
+ {
+ cause = cause.getCause();
+ if ( cause instanceof ConnectException )
+ {
+ reference = ConnectException.class.getSimpleName();
+ }
+ }
+ }
+ else if ( exception instanceof MojoFailureException )
+ {
+ reference = MojoFailureException.class.getSimpleName();
+ }
+ else if ( exception instanceof LinkageError )
+ {
+ reference = LinkageError.class.getSimpleName();
+ }
+ else if ( exception instanceof PluginExecutionException )
+ {
+ Throwable cause = exception.getCause();
+
+ if ( cause instanceof PluginContainerException )
+ {
+ Throwable cause2 = cause.getCause();
+
+ if ( cause2 instanceof NoClassDefFoundError
+ && cause2.getMessage().contains( "org/sonatype/aether/" ) )
+ {
+ reference = "AetherClassNotFound";
+ }
+ }
+
+ if ( StringUtils.isEmpty( reference ) )
+ {
+ reference = getReference( cause );
+ }
+
+ if ( StringUtils.isEmpty( reference ) )
+ {
+ reference = exception.getClass().getSimpleName();
+ }
+ }
+ else if ( exception instanceof LifecycleExecutionException )
+ {
+ reference = getReference( exception.getCause() );
+ }
+ else if ( isNoteworthyException( exception ) )
+ {
+ reference = exception.getClass().getSimpleName();
+ }
+ }
+
+ if ( StringUtils.isNotEmpty( reference ) && !reference.startsWith( "http:" ) )
+ {
+ reference = "http://cwiki.apache.org/confluence/display/MAVEN/" + reference;
+ }
+
+ return reference;
+ }
+
+ private boolean isNoteworthyException( Throwable exception )
+ {
+ if ( exception == null )
+ {
+ return false;
+ }
+ else if ( exception instanceof Error )
+ {
+ return true;
+ }
+ else if ( exception instanceof RuntimeException )
+ {
+ return false;
+ }
+ else if ( exception.getClass().getName().startsWith( "java" ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private String getMessage( String message, Throwable exception )
+ {
+ String fullMessage = ( message != null ) ? message : "";
+
+ for ( Throwable t = exception; t != null; t = t.getCause() )
+ {
+ String exceptionMessage = t.getMessage();
+
+ if ( t instanceof AbstractMojoExecutionException )
+ {
+ String longMessage = ( (AbstractMojoExecutionException) t ).getLongMessage();
+ if ( StringUtils.isNotEmpty( longMessage ) )
+ {
+ if ( StringUtils.isEmpty( exceptionMessage ) || longMessage.contains( exceptionMessage ) )
+ {
+ exceptionMessage = longMessage;
+ }
+ else if ( !exceptionMessage.contains( longMessage ) )
+ {
+ exceptionMessage = join( exceptionMessage, '\n' + longMessage );
+ }
+ }
+ }
+
+ if ( StringUtils.isEmpty( exceptionMessage ) )
+ {
+ exceptionMessage = t.getClass().getSimpleName();
+ }
+
+ if ( t instanceof UnknownHostException && !fullMessage.contains( "host" ) )
+ {
+ fullMessage = join( fullMessage, "Unknown host " + exceptionMessage );
+ }
+ else if ( !fullMessage.contains( exceptionMessage ) )
+ {
+ fullMessage = join( fullMessage, exceptionMessage );
+ }
+ }
+
+ return fullMessage.trim();
+ }
+
+ private String join( String message1, String message2 )
+ {
+ String message = "";
+
+ if ( StringUtils.isNotEmpty( message1 ) )
+ {
+ message = message1.trim();
+ }
+
+ if ( StringUtils.isNotEmpty( message2 ) )
+ {
+ if ( StringUtils.isNotEmpty( message ) )
+ {
+ if ( message.endsWith( "." ) || message.endsWith( "!" ) || message.endsWith( ":" ) )
+ {
+ message += " ";
+ }
+ else
+ {
+ message += ": ";
+ }
+ }
+
+ message += message2;
+ }
+
+ return message;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
new file mode 100644
index 00000000..47865f67
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionHandler.java
@@ -0,0 +1,30 @@
+package org.apache.maven.exception;
+
+/*
+ * 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.
+ */
+
+/**
+ * Transform an exception into useful end-user message.
+ *
+ * @since 3.0-alpha-3
+ */
+public interface ExceptionHandler
+{
+ ExceptionSummary handleException( Throwable e );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
new file mode 100644
index 00000000..dcc376a4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
@@ -0,0 +1,79 @@
+package org.apache.maven.exception;
+
+/*
+ * 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.List;
+
+/**
+ * Provide a summary of the exception, containing:<ul>
+ * <li>the exception itself,</li>
+ * <li>useful end-user message,</li>
+ * <li>useful reference to a solution, or set of solutions: this is usually a wiki page url in
+ * <a href="http://cwiki.apache.org/confluence/display/MAVEN/">http://cwiki.apache.org/confluence/display/MAVEN/</a>,
+ * </li>
+ * <li>child exception summaries.</li>
+ * </ul>
+ */
+public class ExceptionSummary
+{
+
+ private Throwable exception;
+
+ private String message;
+
+ private String reference;
+
+ private List<ExceptionSummary> children;
+
+ public ExceptionSummary( Throwable exception, String message, String reference )
+ {
+ this( exception, message, reference, null );
+ }
+
+ public ExceptionSummary( Throwable exception, String message, String reference, List<ExceptionSummary> children )
+ {
+ this.exception = exception;
+ this.message = ( message != null ) ? message : "";
+ this.reference = ( reference != null ) ? reference : "";
+ this.children = ( children != null ) ? children : Collections.<ExceptionSummary>emptyList();
+ }
+
+ public Throwable getException()
+ {
+ return exception;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public String getReference()
+ {
+ return reference;
+ }
+
+ public List<ExceptionSummary> getChildren()
+ {
+ return children;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java
new file mode 100644
index 00000000..89665007
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/AbstractExecutionListener.java
@@ -0,0 +1,116 @@
+package org.apache.maven.execution;
+
+/*
+ * 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 execution listeners. The methods of this class are empty.
+ *
+ * @author Benjamin Bentmann
+ */
+public class AbstractExecutionListener
+ implements ExecutionListener
+{
+
+ public void projectDiscoveryStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void sessionStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void sessionEnded( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void projectSkipped( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void projectStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void projectSucceeded( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void projectFailed( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkSucceeded( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkFailed( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void mojoSkipped( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void mojoStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void mojoSucceeded( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void mojoFailed( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkedProjectStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkedProjectSucceeded( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void forkedProjectFailed( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java
new file mode 100644
index 00000000..bf8f62ba
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java
@@ -0,0 +1,61 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.project.MavenProject;
+
+/**
+ * Summarizes the result of a failed project build in the reactor.
+ *
+ * @author Benjamin Bentmann
+ */
+public class BuildFailure
+ extends BuildSummary
+{
+
+ /**
+ * The cause of the build failure.
+ */
+ private final Throwable cause;
+
+ /**
+ * Creates a new build summary for the specified project.
+ *
+ * @param project The project being summarized, must not be {@code null}.
+ * @param time The build time of the project in milliseconds.
+ * @param cause The cause of the build failure, may be {@code null}.
+ */
+ public BuildFailure( MavenProject project, long time, Throwable cause )
+ {
+ super( project, time );
+ this.cause = cause;
+ }
+
+ /**
+ * Gets the cause of the build failure.
+ *
+ * @return The cause of the build failure or {@code null} if unknown.
+ */
+ public Throwable getCause()
+ {
+ return cause;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSuccess.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSuccess.java
new file mode 100644
index 00000000..3d0e8bd7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSuccess.java
@@ -0,0 +1,44 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.project.MavenProject;
+
+/**
+ * Summarizes the result of a successful project build in the reactor.
+ *
+ * @author Benjamin Bentmann
+ */
+public class BuildSuccess
+ extends BuildSummary
+{
+
+ /**
+ * Creates a new build summary for the specified project.
+ *
+ * @param project The project being summarized, must not be {@code null}.
+ * @param time The build time of the project in milliseconds.
+ */
+ public BuildSuccess( MavenProject project, long time )
+ {
+ super( project, time );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSummary.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSummary.java
new file mode 100644
index 00000000..ec23f721
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/BuildSummary.java
@@ -0,0 +1,78 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.project.MavenProject;
+
+/**
+ * Summarizes the result of a project build in the reactor.
+ *
+ * @author Benjamin Bentmann
+ */
+public abstract class BuildSummary
+{
+
+ /**
+ * The project being summarized.
+ */
+ private final MavenProject project;
+
+ /**
+ * The build time of the project in milliseconds.
+ */
+ private final long time;
+
+ /**
+ * Creates a new build summary for the specified project.
+ *
+ * @param project The project being summarized, must not be {@code null}.
+ * @param time The build time of the project in milliseconds.
+ */
+ protected BuildSummary( MavenProject project, long time )
+ {
+ if ( project == null )
+ {
+ throw new IllegalArgumentException( "project missing" );
+ }
+ this.project = project;
+ this.time = time;
+ }
+
+ /**
+ * Gets the project being summarized.
+ *
+ * @return The project being summarized, never {@code null}.
+ */
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ /**
+ * Gets the build time of the project in milliseconds.
+ *
+ * @return The build time of the project in milliseconds.
+ */
+ public long getTime()
+ {
+ return time;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
new file mode 100644
index 00000000..e5509dca
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
@@ -0,0 +1,1299 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.eventspy.internal.EventSpyDispatcher;
+import org.apache.maven.model.Profile;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.eclipse.aether.DefaultRepositoryCache;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.transfer.TransferListener;
+
+import com.google.common.collect.Maps;
+
+/**
+ * @author Jason van Zyl
+ */
+public class DefaultMavenExecutionRequest
+ implements MavenExecutionRequest
+{
+
+ private RepositoryCache repositoryCache = new DefaultRepositoryCache();
+
+ private WorkspaceReader workspaceReader;
+
+ private ArtifactRepository localRepository;
+
+ private EventSpyDispatcher eventSpyDispatcher;
+
+ private File localRepositoryPath;
+
+ private boolean offline = false;
+
+ private boolean interactiveMode = true;
+
+ private boolean cacheTransferError;
+
+ private boolean cacheNotFound;
+
+ private List<Proxy> proxies;
+
+ private List<Server> servers;
+
+ private List<Mirror> mirrors;
+
+ private List<Profile> profiles;
+
+ private List<String> pluginGroups;
+
+ private boolean isProjectPresent = true;
+
+ // ----------------------------------------------------------------------------
+ // We need to allow per execution user and global settings as the embedder
+ // might be running in a mode where its executing many threads with totally
+ // different settings.
+ // ----------------------------------------------------------------------------
+
+ private File userSettingsFile;
+
+ private File globalSettingsFile;
+
+ private File userToolchainsFile;
+
+ private File globalToolchainsFile;
+
+ // ----------------------------------------------------------------------------
+ // Request
+ // ----------------------------------------------------------------------------
+
+ private File multiModuleProjectDirectory;
+
+ private File basedir;
+
+ private List<String> goals;
+
+ private boolean useReactor = false;
+
+ private boolean recursive = true;
+
+ private File pom;
+
+ private String reactorFailureBehavior = REACTOR_FAIL_FAST;
+
+ private List<String> selectedProjects;
+
+ private List<String> excludedProjects;
+
+ private String resumeFrom;
+
+ private String makeBehavior;
+
+ private Properties systemProperties;
+
+ private Properties userProperties;
+
+ private Date startTime;
+
+ private boolean showErrors = false;
+
+ private List<String> activeProfiles;
+
+ private List<String> inactiveProfiles;
+
+ private TransferListener transferListener;
+
+ private int loggingLevel = LOGGING_LEVEL_INFO;
+
+ private String globalChecksumPolicy;
+
+ private boolean updateSnapshots = false;
+
+ private List<ArtifactRepository> remoteRepositories;
+
+ private List<ArtifactRepository> pluginArtifactRepositories;
+
+ private ExecutionListener executionListener;
+
+ private int degreeOfConcurrency = 1;
+
+ private String builderId = "singlethreaded";
+
+ private Map<String, List<ToolchainModel>> toolchains;
+
+ /**
+ * Suppress SNAPSHOT updates.
+ *
+ * @issue MNG-2681
+ */
+ private boolean noSnapshotUpdates;
+
+ private boolean useLegacyLocalRepositoryManager = false;
+
+ private Map<String, Object> data;
+
+ public DefaultMavenExecutionRequest()
+ {
+ }
+
+ public static MavenExecutionRequest copy( MavenExecutionRequest original )
+ {
+ DefaultMavenExecutionRequest copy = new DefaultMavenExecutionRequest();
+ copy.setLocalRepository( original.getLocalRepository() );
+ copy.setLocalRepositoryPath( original.getLocalRepositoryPath() );
+ copy.setOffline( original.isOffline() );
+ copy.setInteractiveMode( original.isInteractiveMode() );
+ copy.setCacheNotFound( original.isCacheNotFound() );
+ copy.setCacheTransferError( original.isCacheTransferError() );
+ copy.setProxies( original.getProxies() );
+ copy.setServers( original.getServers() );
+ copy.setMirrors( original.getMirrors() );
+ copy.setProfiles( original.getProfiles() );
+ copy.setPluginGroups( original.getPluginGroups() );
+ copy.setProjectPresent( original.isProjectPresent() );
+ copy.setUserSettingsFile( original.getUserSettingsFile() );
+ copy.setGlobalSettingsFile( original.getGlobalSettingsFile() );
+ copy.setUserToolchainsFile( original.getUserToolchainsFile() );
+ copy.setGlobalToolchainsFile( original.getGlobalToolchainsFile() );
+ copy.setBaseDirectory( ( original.getBaseDirectory() != null ) ? new File( original.getBaseDirectory() )
+ : null );
+ copy.setGoals( original.getGoals() );
+ copy.setRecursive( original.isRecursive() );
+ copy.setPom( original.getPom() );
+ copy.setSystemProperties( original.getSystemProperties() );
+ copy.setUserProperties( original.getUserProperties() );
+ copy.setShowErrors( original.isShowErrors() );
+ copy.setActiveProfiles( original.getActiveProfiles() );
+ copy.setInactiveProfiles( original.getInactiveProfiles() );
+ copy.setTransferListener( original.getTransferListener() );
+ copy.setLoggingLevel( original.getLoggingLevel() );
+ copy.setGlobalChecksumPolicy( original.getGlobalChecksumPolicy() );
+ copy.setUpdateSnapshots( original.isUpdateSnapshots() );
+ copy.setRemoteRepositories( original.getRemoteRepositories() );
+ copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
+ copy.setRepositoryCache( original.getRepositoryCache() );
+ copy.setWorkspaceReader( original.getWorkspaceReader() );
+ copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
+ copy.setExecutionListener( original.getExecutionListener() );
+ copy.setUseLegacyLocalRepository( original.isUseLegacyLocalRepository() );
+ copy.setBuilderId( original.getBuilderId() );
+ return copy;
+ }
+
+ @Override
+ public String getBaseDirectory()
+ {
+ if ( basedir == null )
+ {
+ return null;
+ }
+
+ return basedir.getAbsolutePath();
+ }
+
+ @Override
+ public ArtifactRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ @Override
+ public File getLocalRepositoryPath()
+ {
+ return localRepositoryPath;
+ }
+
+ @Override
+ public List<String> getGoals()
+ {
+ if ( goals == null )
+ {
+ goals = new ArrayList<String>();
+ }
+ return goals;
+ }
+
+ @Override
+ public Properties getSystemProperties()
+ {
+ if ( systemProperties == null )
+ {
+ systemProperties = new Properties();
+ }
+
+ return systemProperties;
+ }
+
+ @Override
+ public Properties getUserProperties()
+ {
+ if ( userProperties == null )
+ {
+ userProperties = new Properties();
+ }
+
+ return userProperties;
+ }
+
+ @Override
+ public File getPom()
+ {
+ return pom;
+ }
+
+ @Override
+ public String getReactorFailureBehavior()
+ {
+ return reactorFailureBehavior;
+ }
+
+ @Override
+ public List<String> getSelectedProjects()
+ {
+ if ( selectedProjects == null )
+ {
+ selectedProjects = new ArrayList<String>();
+ }
+
+ return selectedProjects;
+ }
+
+ @Override
+ public List<String> getExcludedProjects()
+ {
+ if ( excludedProjects == null )
+ {
+ excludedProjects = new ArrayList<String>();
+ }
+
+ return excludedProjects;
+ }
+
+ @Override
+ public String getResumeFrom()
+ {
+ return resumeFrom;
+ }
+
+ @Override
+ public String getMakeBehavior()
+ {
+ return makeBehavior;
+ }
+
+ @Override
+ public Date getStartTime()
+ {
+ return startTime;
+ }
+
+ @Override
+ public boolean isShowErrors()
+ {
+ return showErrors;
+ }
+
+ @Override
+ public boolean isInteractiveMode()
+ {
+ return interactiveMode;
+ }
+
+ @Override
+ public MavenExecutionRequest setActiveProfiles( List<String> activeProfiles )
+ {
+ if ( activeProfiles != null )
+ {
+ this.activeProfiles = new ArrayList<String>( activeProfiles );
+ }
+ else
+ {
+ this.activeProfiles = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setInactiveProfiles( List<String> inactiveProfiles )
+ {
+ if ( inactiveProfiles != null )
+ {
+ this.inactiveProfiles = new ArrayList<String>( inactiveProfiles );
+ }
+ else
+ {
+ this.inactiveProfiles = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
+ {
+ if ( remoteRepositories != null )
+ {
+ this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
+ }
+ else
+ {
+ this.remoteRepositories = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
+ {
+ if ( pluginArtifactRepositories != null )
+ {
+ this.pluginArtifactRepositories = new ArrayList<ArtifactRepository>( pluginArtifactRepositories );
+ }
+ else
+ {
+ this.pluginArtifactRepositories = null;
+ }
+
+ return this;
+ }
+
+ public void setProjectBuildingConfiguration( ProjectBuildingRequest projectBuildingConfiguration )
+ {
+ this.projectBuildingRequest = projectBuildingConfiguration;
+ }
+
+ @Override
+ public List<String> getActiveProfiles()
+ {
+ if ( activeProfiles == null )
+ {
+ activeProfiles = new ArrayList<String>();
+ }
+ return activeProfiles;
+ }
+
+ @Override
+ public List<String> getInactiveProfiles()
+ {
+ if ( inactiveProfiles == null )
+ {
+ inactiveProfiles = new ArrayList<String>();
+ }
+ return inactiveProfiles;
+ }
+
+ @Override
+ public TransferListener getTransferListener()
+ {
+ return transferListener;
+ }
+
+ @Override
+ public int getLoggingLevel()
+ {
+ return loggingLevel;
+ }
+
+ @Override
+ public boolean isOffline()
+ {
+ return offline;
+ }
+
+ @Override
+ public boolean isUpdateSnapshots()
+ {
+ return updateSnapshots;
+ }
+
+ @Override
+ public boolean isNoSnapshotUpdates()
+ {
+ return noSnapshotUpdates;
+ }
+
+ @Override
+ public String getGlobalChecksumPolicy()
+ {
+ return globalChecksumPolicy;
+ }
+
+ @Override
+ public boolean isRecursive()
+ {
+ return recursive;
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ @Override
+ public MavenExecutionRequest setBaseDirectory( File basedir )
+ {
+ this.basedir = basedir;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setStartTime( Date startTime )
+ {
+ this.startTime = startTime;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setShowErrors( boolean showErrors )
+ {
+ this.showErrors = showErrors;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setGoals( List<String> goals )
+ {
+ if ( goals != null )
+ {
+ this.goals = new ArrayList<String>( goals );
+ }
+ else
+ {
+ this.goals = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setLocalRepository( ArtifactRepository localRepository )
+ {
+ this.localRepository = localRepository;
+
+ if ( localRepository != null )
+ {
+ setLocalRepositoryPath( new File( localRepository.getBasedir() ).getAbsoluteFile() );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setLocalRepositoryPath( File localRepository )
+ {
+ localRepositoryPath = localRepository;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setLocalRepositoryPath( String localRepository )
+ {
+ localRepositoryPath = ( localRepository != null ) ? new File( localRepository ) : null;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setSystemProperties( Properties properties )
+ {
+ if ( properties != null )
+ {
+ this.systemProperties = new Properties();
+ this.systemProperties.putAll( properties );
+ }
+ else
+ {
+ this.systemProperties = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setUserProperties( Properties userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = new Properties();
+ this.userProperties.putAll( userProperties );
+ }
+ else
+ {
+ this.userProperties = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setReactorFailureBehavior( String failureBehavior )
+ {
+ reactorFailureBehavior = failureBehavior;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setSelectedProjects( List<String> selectedProjects )
+ {
+ if ( selectedProjects != null )
+ {
+ this.selectedProjects = new ArrayList<String>( selectedProjects );
+ }
+ else
+ {
+ this.selectedProjects = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setExcludedProjects( List<String> excludedProjects )
+ {
+ if ( excludedProjects != null )
+ {
+ this.excludedProjects = new ArrayList<String>( excludedProjects );
+ }
+ else
+ {
+ this.excludedProjects = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setResumeFrom( String project )
+ {
+ this.resumeFrom = project;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setMakeBehavior( String makeBehavior )
+ {
+ this.makeBehavior = makeBehavior;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addActiveProfile( String profile )
+ {
+ if ( !getActiveProfiles().contains( profile ) )
+ {
+ getActiveProfiles().add( profile );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addInactiveProfile( String profile )
+ {
+ if ( !getInactiveProfiles().contains( profile ) )
+ {
+ getInactiveProfiles().add( profile );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addActiveProfiles( List<String> profiles )
+ {
+ for ( String profile : profiles )
+ {
+ addActiveProfile( profile );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addInactiveProfiles( List<String> profiles )
+ {
+ for ( String profile : profiles )
+ {
+ addInactiveProfile( profile );
+ }
+
+ return this;
+ }
+
+ public MavenExecutionRequest setUseReactor( boolean reactorActive )
+ {
+ useReactor = reactorActive;
+
+ return this;
+ }
+
+ public boolean useReactor()
+ {
+ return useReactor;
+ }
+
+ /** @deprecated use {@link #setPom(File)} */
+ @Deprecated
+ public MavenExecutionRequest setPomFile( String pomFilename )
+ {
+ if ( pomFilename != null )
+ {
+ pom = new File( pomFilename );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setPom( File pom )
+ {
+ this.pom = pom;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setInteractiveMode( boolean interactive )
+ {
+ interactiveMode = interactive;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setTransferListener( TransferListener transferListener )
+ {
+ this.transferListener = transferListener;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setLoggingLevel( int loggingLevel )
+ {
+ this.loggingLevel = loggingLevel;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setOffline( boolean offline )
+ {
+ this.offline = offline;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots )
+ {
+ this.updateSnapshots = updateSnapshots;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates )
+ {
+ this.noSnapshotUpdates = noSnapshotUpdates;
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy )
+ {
+ this.globalChecksumPolicy = globalChecksumPolicy;
+
+ return this;
+ }
+
+ // ----------------------------------------------------------------------------
+ // Settings equivalents
+ // ----------------------------------------------------------------------------
+
+ @Override
+ public List<Proxy> getProxies()
+ {
+ if ( proxies == null )
+ {
+ proxies = new ArrayList<Proxy>();
+ }
+ return proxies;
+ }
+
+ @Override
+ public MavenExecutionRequest setProxies( List<Proxy> proxies )
+ {
+ if ( proxies != null )
+ {
+ this.proxies = new ArrayList<Proxy>( proxies );
+ }
+ else
+ {
+ this.proxies = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addProxy( Proxy proxy )
+ {
+ if ( proxy == null )
+ {
+ throw new IllegalArgumentException( "proxy missing" );
+ }
+
+ for ( Proxy p : getProxies() )
+ {
+ if ( p.getId() != null && p.getId().equals( proxy.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getProxies().add( proxy );
+
+ return this;
+ }
+
+ @Override
+ public List<Server> getServers()
+ {
+ if ( servers == null )
+ {
+ servers = new ArrayList<Server>();
+ }
+ return servers;
+ }
+
+ @Override
+ public MavenExecutionRequest setServers( List<Server> servers )
+ {
+ if ( servers != null )
+ {
+ this.servers = new ArrayList<Server>( servers );
+ }
+ else
+ {
+ this.servers = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addServer( Server server )
+ {
+ if ( server == null )
+ {
+ throw new IllegalArgumentException( "server missing" );
+ }
+
+ for ( Server p : getServers() )
+ {
+ if ( p.getId() != null && p.getId().equals( server.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getServers().add( server );
+
+ return this;
+ }
+
+ @Override
+ public List<Mirror> getMirrors()
+ {
+ if ( mirrors == null )
+ {
+ mirrors = new ArrayList<Mirror>();
+ }
+ return mirrors;
+ }
+
+ @Override
+ public MavenExecutionRequest setMirrors( List<Mirror> mirrors )
+ {
+ if ( mirrors != null )
+ {
+ this.mirrors = new ArrayList<Mirror>( mirrors );
+ }
+ else
+ {
+ this.mirrors = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addMirror( Mirror mirror )
+ {
+ if ( mirror == null )
+ {
+ throw new IllegalArgumentException( "mirror missing" );
+ }
+
+ for ( Mirror p : getMirrors() )
+ {
+ if ( p.getId() != null && p.getId().equals( mirror.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getMirrors().add( mirror );
+
+ return this;
+ }
+
+ @Override
+ public List<Profile> getProfiles()
+ {
+ if ( profiles == null )
+ {
+ profiles = new ArrayList<Profile>();
+ }
+ return profiles;
+ }
+
+ @Override
+ public MavenExecutionRequest setProfiles( List<Profile> profiles )
+ {
+ if ( profiles != null )
+ {
+ this.profiles = new ArrayList<Profile>( profiles );
+ }
+ else
+ {
+ this.profiles = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public List<String> getPluginGroups()
+ {
+ if ( pluginGroups == null )
+ {
+ pluginGroups = new ArrayList<String>();
+ }
+
+ return pluginGroups;
+ }
+
+ @Override
+ public MavenExecutionRequest setPluginGroups( List<String> pluginGroups )
+ {
+ if ( pluginGroups != null )
+ {
+ this.pluginGroups = new ArrayList<String>( pluginGroups );
+ }
+ else
+ {
+ this.pluginGroups = null;
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addPluginGroup( String pluginGroup )
+ {
+ if ( !getPluginGroups().contains( pluginGroup ) )
+ {
+ getPluginGroups().add( pluginGroup );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addPluginGroups( List<String> pluginGroups )
+ {
+ for ( String pluginGroup : pluginGroups )
+ {
+ addPluginGroup( pluginGroup );
+ }
+
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setRecursive( boolean recursive )
+ {
+ this.recursive = recursive;
+
+ return this;
+ }
+
+ // calculated from request attributes.
+ private ProjectBuildingRequest projectBuildingRequest;
+
+ @Override
+ public boolean isProjectPresent()
+ {
+ return isProjectPresent;
+ }
+
+ @Override
+ public MavenExecutionRequest setProjectPresent( boolean projectPresent )
+ {
+ isProjectPresent = projectPresent;
+
+ return this;
+ }
+
+ // Settings files
+
+ @Override
+ public File getUserSettingsFile()
+ {
+ return userSettingsFile;
+ }
+
+ @Override
+ public MavenExecutionRequest setUserSettingsFile( File userSettingsFile )
+ {
+ this.userSettingsFile = userSettingsFile;
+
+ return this;
+ }
+
+ @Override
+ public File getGlobalSettingsFile()
+ {
+ return globalSettingsFile;
+ }
+
+ @Override
+ public MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile )
+ {
+ this.globalSettingsFile = globalSettingsFile;
+
+ return this;
+ }
+
+ @Override
+ public File getUserToolchainsFile()
+ {
+ return userToolchainsFile;
+ }
+
+ @Override
+ public MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile )
+ {
+ this.userToolchainsFile = userToolchainsFile;
+
+ return this;
+ }
+
+ @Override
+ public File getGlobalToolchainsFile()
+ {
+ return globalToolchainsFile;
+ }
+
+ @Override
+ public MavenExecutionRequest setGlobalToolchainsFile( File globalToolchainsFile )
+ {
+ this.globalToolchainsFile = globalToolchainsFile;
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest addRemoteRepository( ArtifactRepository repository )
+ {
+ for ( ArtifactRepository repo : getRemoteRepositories() )
+ {
+ if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getRemoteRepositories().add( repository );
+
+ return this;
+ }
+
+ @Override
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ if ( remoteRepositories == null )
+ {
+ remoteRepositories = new ArrayList<ArtifactRepository>();
+ }
+ return remoteRepositories;
+ }
+
+ @Override
+ public MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository )
+ {
+ for ( ArtifactRepository repo : getPluginArtifactRepositories() )
+ {
+ if ( repo.getId() != null && repo.getId().equals( repository.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getPluginArtifactRepositories().add( repository );
+
+ return this;
+ }
+
+ @Override
+ public List<ArtifactRepository> getPluginArtifactRepositories()
+ {
+ if ( pluginArtifactRepositories == null )
+ {
+ pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
+ }
+ return pluginArtifactRepositories;
+ }
+
+ // TODO: this does not belong here.
+ @Override
+ public ProjectBuildingRequest getProjectBuildingRequest()
+ {
+ if ( projectBuildingRequest == null )
+ {
+ projectBuildingRequest = new DefaultProjectBuildingRequest();
+ projectBuildingRequest.setLocalRepository( getLocalRepository() );
+ projectBuildingRequest.setSystemProperties( getSystemProperties() );
+ projectBuildingRequest.setUserProperties( getUserProperties() );
+ projectBuildingRequest.setRemoteRepositories( getRemoteRepositories() );
+ projectBuildingRequest.setPluginArtifactRepositories( getPluginArtifactRepositories() );
+ projectBuildingRequest.setActiveProfileIds( getActiveProfiles() );
+ projectBuildingRequest.setInactiveProfileIds( getInactiveProfiles() );
+ projectBuildingRequest.setProfiles( getProfiles() );
+ projectBuildingRequest.setProcessPlugins( true );
+ projectBuildingRequest.setBuildStartTime( getStartTime() );
+ }
+
+ return projectBuildingRequest;
+ }
+
+ @Override
+ public MavenExecutionRequest addProfile( Profile profile )
+ {
+ if ( profile == null )
+ {
+ throw new IllegalArgumentException( "profile missing" );
+ }
+
+ for ( Profile p : getProfiles() )
+ {
+ if ( p.getId() != null && p.getId().equals( profile.getId() ) )
+ {
+ return this;
+ }
+ }
+
+ getProfiles().add( profile );
+
+ return this;
+ }
+
+ @Override
+ public RepositoryCache getRepositoryCache()
+ {
+ return repositoryCache;
+ }
+
+ @Override
+ public MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache )
+ {
+ this.repositoryCache = repositoryCache;
+
+ return this;
+ }
+
+ @Override
+ public ExecutionListener getExecutionListener()
+ {
+ return executionListener;
+ }
+
+ @Override
+ public MavenExecutionRequest setExecutionListener( ExecutionListener executionListener )
+ {
+ this.executionListener = executionListener;
+
+ return this;
+ }
+
+ @Override
+ public void setDegreeOfConcurrency( final int degreeOfConcurrency )
+ {
+ this.degreeOfConcurrency = degreeOfConcurrency;
+ }
+
+ @Override
+ public int getDegreeOfConcurrency()
+ {
+ return degreeOfConcurrency;
+ }
+
+ @Override
+ public WorkspaceReader getWorkspaceReader()
+ {
+ return workspaceReader;
+ }
+
+ @Override
+ public MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader )
+ {
+ this.workspaceReader = workspaceReader;
+ return this;
+ }
+
+ @Override
+ public boolean isCacheTransferError()
+ {
+ return cacheTransferError;
+ }
+
+ @Override
+ public MavenExecutionRequest setCacheTransferError( boolean cacheTransferError )
+ {
+ this.cacheTransferError = cacheTransferError;
+ return this;
+ }
+
+ @Override
+ public boolean isCacheNotFound()
+ {
+ return cacheNotFound;
+ }
+
+ @Override
+ public MavenExecutionRequest setCacheNotFound( boolean cacheNotFound )
+ {
+ this.cacheNotFound = cacheNotFound;
+ return this;
+ }
+
+ @Override
+ public boolean isUseLegacyLocalRepository()
+ {
+ return this.useLegacyLocalRepositoryManager;
+ }
+
+ @Override
+ public MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepositoryManager )
+ {
+ this.useLegacyLocalRepositoryManager = useLegacyLocalRepositoryManager;
+ return this;
+ }
+
+ @Override
+ public MavenExecutionRequest setBuilderId( String builderId )
+ {
+ this.builderId = builderId;
+ return this;
+ }
+
+ @Override
+ public String getBuilderId()
+ {
+ return builderId;
+ }
+
+ @Override
+ public Map<String, List<ToolchainModel>> getToolchains()
+ {
+ if ( toolchains == null )
+ {
+ toolchains = new HashMap<String, List<ToolchainModel>>();
+ }
+ return toolchains;
+ }
+
+ @Override
+ public MavenExecutionRequest setToolchains( Map<String, List<ToolchainModel>> toolchains )
+ {
+ this.toolchains = toolchains;
+ return this;
+ }
+
+ @Override
+ public void setMultiModuleProjectDirectory( File directory )
+ {
+ this.multiModuleProjectDirectory = directory;
+ }
+
+ @Override
+ public File getMultiModuleProjectDirectory()
+ {
+ return multiModuleProjectDirectory;
+ }
+
+ @Override
+ public MavenExecutionRequest setEventSpyDispatcher( EventSpyDispatcher eventSpyDispatcher )
+ {
+ this.eventSpyDispatcher = eventSpyDispatcher;
+ return this;
+ }
+
+ @Override
+ public EventSpyDispatcher getEventSpyDispatcher()
+ {
+ return eventSpyDispatcher;
+ }
+
+ @Override
+ public Map<String, Object> getData()
+ {
+ if ( data == null )
+ {
+ data = Maps.newHashMap();
+ }
+
+ return data;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
new file mode 100644
index 00000000..7568fdee
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
@@ -0,0 +1,318 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.bridge.MavenRepositorySystem;
+import org.apache.maven.repository.RepositorySystem;
+//
+// All of this needs to go away and be couched in terms of the execution request
+//
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Repository;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.SettingsUtils;
+//
+// Settings in core
+//
+import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.util.StringUtils;
+
+@Named
+public class DefaultMavenExecutionRequestPopulator
+ implements MavenExecutionRequestPopulator
+{
+
+ private final MavenRepositorySystem repositorySystem;
+
+ @Inject
+ public DefaultMavenExecutionRequestPopulator( MavenRepositorySystem repositorySystem )
+ {
+ this.repositorySystem = repositorySystem;
+ }
+
+
+ @Override
+ public MavenExecutionRequest populateFromToolchains( MavenExecutionRequest request, PersistedToolchains toolchains )
+ throws MavenExecutionRequestPopulationException
+ {
+ if ( toolchains != null )
+ {
+ Map<String, List<ToolchainModel>> groupedToolchains = new HashMap<String, List<ToolchainModel>>( 2 );
+
+ for ( ToolchainModel model : toolchains.getToolchains() )
+ {
+ if ( !groupedToolchains.containsKey( model.getType() ) )
+ {
+ groupedToolchains.put( model.getType(), new ArrayList<ToolchainModel>() );
+ }
+
+ groupedToolchains.get( model.getType() ).add( model );
+ }
+
+ request.setToolchains( groupedToolchains );
+ }
+ return request;
+ }
+
+ @Override
+ public MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException
+ {
+ baseDirectory( request );
+
+ localRepository( request );
+
+ populateDefaultPluginGroups( request );
+
+ injectDefaultRepositories( request );
+
+ injectDefaultPluginRepositories( request );
+
+ return request;
+ }
+
+ //
+ //
+ //
+
+ private void populateDefaultPluginGroups( MavenExecutionRequest request )
+ {
+ request.addPluginGroup( "org.apache.maven.plugins" );
+ request.addPluginGroup( "org.codehaus.mojo" );
+ }
+
+ private void injectDefaultRepositories( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException
+ {
+ Set<String> definedRepositories = repositorySystem.getRepoIds( request.getRemoteRepositories() );
+
+ if ( !definedRepositories.contains( RepositorySystem.DEFAULT_REMOTE_REPO_ID ) )
+ {
+ try
+ {
+ request.addRemoteRepository( repositorySystem.createDefaultRemoteRepository( request ) );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenExecutionRequestPopulationException( "Cannot create default remote repository.", e );
+ }
+ }
+ }
+
+ private void injectDefaultPluginRepositories( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException
+ {
+ Set<String> definedRepositories = repositorySystem.getRepoIds( request.getPluginArtifactRepositories() );
+
+ if ( !definedRepositories.contains( RepositorySystem.DEFAULT_REMOTE_REPO_ID ) )
+ {
+ try
+ {
+ request.addPluginArtifactRepository( repositorySystem.createDefaultRemoteRepository( request ) );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenExecutionRequestPopulationException( "Cannot create default remote repository.", e );
+ }
+ }
+ }
+
+ private void localRepository( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException
+ {
+ // ------------------------------------------------------------------------
+ // Local Repository
+ //
+ // 1. Use a value has been passed in via the configuration
+ // 2. Use value in the resultant settings
+ // 3. Use default value
+ // ------------------------------------------------------------------------
+
+ if ( request.getLocalRepository() == null )
+ {
+ request.setLocalRepository( createLocalRepository( request ) );
+ }
+
+ if ( request.getLocalRepositoryPath() == null )
+ {
+ request.setLocalRepositoryPath( new File( request.getLocalRepository().getBasedir() ).getAbsoluteFile() );
+ }
+ }
+
+ // ------------------------------------------------------------------------
+ // Artifact Transfer Mechanism
+ // ------------------------------------------------------------------------
+
+ private ArtifactRepository createLocalRepository( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException
+ {
+ String localRepositoryPath = null;
+
+ if ( request.getLocalRepositoryPath() != null )
+ {
+ localRepositoryPath = request.getLocalRepositoryPath().getAbsolutePath();
+ }
+
+ if ( StringUtils.isEmpty( localRepositoryPath ) )
+ {
+ localRepositoryPath = RepositorySystem.defaultUserLocalRepository.getAbsolutePath();
+ }
+
+ try
+ {
+ return repositorySystem.createLocalRepository( request, new File( localRepositoryPath ) );
+ }
+ catch ( Exception e )
+ {
+ throw new MavenExecutionRequestPopulationException( "Cannot create local repository.", e );
+ }
+ }
+
+ private void baseDirectory( MavenExecutionRequest request )
+ {
+ if ( request.getBaseDirectory() == null && request.getPom() != null )
+ {
+ request.setBaseDirectory( request.getPom().getAbsoluteFile().getParentFile() );
+ }
+ }
+
+ /*if_not[MAVEN4]*/
+
+ @Override
+ @Deprecated
+ public MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
+ throws MavenExecutionRequestPopulationException
+ {
+ if ( settings == null )
+ {
+ return request;
+ }
+
+ request.setOffline( settings.isOffline() );
+
+ request.setInteractiveMode( settings.isInteractiveMode() );
+
+ request.setPluginGroups( settings.getPluginGroups() );
+
+ request.setLocalRepositoryPath( settings.getLocalRepository() );
+
+ for ( Server server : settings.getServers() )
+ {
+ server = server.clone();
+
+ request.addServer( server );
+ }
+
+ // <proxies>
+ // <proxy>
+ // <active>true</active>
+ // <protocol>http</protocol>
+ // <host>proxy.somewhere.com</host>
+ // <port>8080</port>
+ // <username>proxyuser</username>
+ // <password>somepassword</password>
+ // <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
+ // </proxy>
+ // </proxies>
+
+ for ( Proxy proxy : settings.getProxies() )
+ {
+ if ( !proxy.isActive() )
+ {
+ continue;
+ }
+
+ proxy = proxy.clone();
+
+ request.addProxy( proxy );
+ }
+
+ // <mirrors>
+ // <mirror>
+ // <id>nexus</id>
+ // <mirrorOf>*</mirrorOf>
+ // <url>http://repository.sonatype.org/content/groups/public</url>
+ // </mirror>
+ // </mirrors>
+
+ for ( Mirror mirror : settings.getMirrors() )
+ {
+ mirror = mirror.clone();
+
+ request.addMirror( mirror );
+ }
+
+ request.setActiveProfiles( settings.getActiveProfiles() );
+
+ for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
+ {
+ request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
+
+ if ( settings.getActiveProfiles().contains( rawProfile.getId() ) )
+ {
+ List<Repository> remoteRepositories = rawProfile.getRepositories();
+ for ( Repository remoteRepository : remoteRepositories )
+ {
+ try
+ {
+ request.addRemoteRepository( repositorySystem.buildArtifactRepository( remoteRepository ) );
+ }
+ catch ( InvalidRepositoryException e )
+ {
+ // do nothing for now
+ }
+ }
+
+ List<Repository> pluginRepositories = rawProfile.getPluginRepositories();
+ for ( Repository pluginRepo : pluginRepositories )
+ {
+ try
+ {
+ request.addPluginArtifactRepository( repositorySystem.buildArtifactRepository( pluginRepo ) );
+ }
+ catch ( InvalidRepositoryException e )
+ {
+ // do nothing for now
+ }
+ }
+ }
+ }
+
+ return request;
+ }
+
+ /*end[MAVEN4]*/
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
new file mode 100644
index 00000000..a8967eda
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
@@ -0,0 +1,109 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.maven.project.DependencyResolutionResult;
+import org.apache.maven.project.MavenProject;
+
+/** @author Jason van Zyl */
+public class DefaultMavenExecutionResult
+ implements MavenExecutionResult
+{
+ private MavenProject project;
+
+ private List<MavenProject> topologicallySortedProjects = Collections.emptyList();
+
+ private DependencyResolutionResult dependencyResolutionResult;
+
+ private final List<Throwable> exceptions = new CopyOnWriteArrayList<Throwable>();
+
+ private final Map<MavenProject, BuildSummary> buildSummaries =
+ Collections.synchronizedMap( new IdentityHashMap<MavenProject, BuildSummary>() );
+
+ public MavenExecutionResult setProject( MavenProject project )
+ {
+ this.project = project;
+
+ return this;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public MavenExecutionResult setTopologicallySortedProjects( List<MavenProject> topologicallySortedProjects )
+ {
+ this.topologicallySortedProjects = topologicallySortedProjects;
+
+ return this;
+ }
+
+ public List<MavenProject> getTopologicallySortedProjects()
+ {
+ return null == topologicallySortedProjects ? Collections.<MavenProject>emptyList()
+ : topologicallySortedProjects;
+ }
+
+ public DependencyResolutionResult getDependencyResolutionResult()
+ {
+ return dependencyResolutionResult;
+ }
+
+ public MavenExecutionResult setDependencyResolutionResult( DependencyResolutionResult dependencyResolutionResult )
+ {
+ this.dependencyResolutionResult = dependencyResolutionResult;
+
+ return this;
+ }
+
+ public List<Throwable> getExceptions()
+ {
+ return exceptions;
+ }
+
+ public MavenExecutionResult addException( Throwable t )
+ {
+ exceptions.add( t );
+
+ return this;
+ }
+
+ public boolean hasExceptions()
+ {
+ return !getExceptions().isEmpty();
+ }
+
+ public BuildSummary getBuildSummary( MavenProject project )
+ {
+ return buildSummaries.get( project );
+ }
+
+ public void addBuildSummary( BuildSummary summary )
+ {
+ buildSummaries.put( summary.getProject(), summary );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java
new file mode 100644
index 00000000..0ee7f57a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java
@@ -0,0 +1,92 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Holds data relevant for an execution event.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ExecutionEvent
+{
+
+ /**
+ * The possible types of execution events.
+ */
+ enum Type
+ {
+ ProjectDiscoveryStarted,
+ SessionStarted,
+ SessionEnded,
+ ProjectSkipped,
+ ProjectStarted,
+ ProjectSucceeded,
+ ProjectFailed,
+ MojoSkipped,
+ MojoStarted,
+ MojoSucceeded,
+ MojoFailed,
+ ForkStarted,
+ ForkSucceeded,
+ ForkFailed,
+ ForkedProjectStarted,
+ ForkedProjectSucceeded,
+ ForkedProjectFailed,
+ }
+
+ /**
+ * Gets the type of the event.
+ *
+ * @return The type of the event, never {@code null}.
+ */
+ Type getType();
+
+ /**
+ * Gets the session from which this event originates.
+ *
+ * @return The current session, never {@code null}.
+ */
+ MavenSession getSession();
+
+ /**
+ * Gets the current project (if any).
+ *
+ * @return The current project or {@code null} if not applicable.
+ */
+ MavenProject getProject();
+
+ /**
+ * Gets the current mojo execution (if any).
+ *
+ * @return The current mojo execution or {@code null} if not applicable.
+ */
+ MojoExecution getMojoExecution();
+
+ /**
+ * Gets the exception that caused the event (if any).
+ *
+ * @return The exception or {@code null} if none.
+ */
+ Exception getException();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java
new file mode 100644
index 00000000..ad3f345a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java
@@ -0,0 +1,66 @@
+package org.apache.maven.execution;
+
+/*
+ * 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 Maven fires during a build. <strong>Warning:</strong> This interface might be extended in future
+ * Maven versions to support further events. Hence it is strongly recommended to derive custom listeners from
+ * {@link AbstractExecutionListener} in order to avoid interoperability problems.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ExecutionListener
+{
+
+ void projectDiscoveryStarted( ExecutionEvent event );
+
+ void sessionStarted( ExecutionEvent event );
+
+ void sessionEnded( ExecutionEvent event );
+
+ void projectSkipped( ExecutionEvent event );
+
+ void projectStarted( ExecutionEvent event );
+
+ void projectSucceeded( ExecutionEvent event );
+
+ void projectFailed( ExecutionEvent event );
+
+ void mojoSkipped( ExecutionEvent event );
+
+ void mojoStarted( ExecutionEvent event );
+
+ void mojoSucceeded( ExecutionEvent event );
+
+ void mojoFailed( ExecutionEvent event );
+
+ void forkStarted( ExecutionEvent event );
+
+ void forkSucceeded( ExecutionEvent event );
+
+ void forkFailed( ExecutionEvent event );
+
+ void forkedProjectStarted( ExecutionEvent event );
+
+ void forkedProjectSucceeded( ExecutionEvent event );
+
+ void forkedProjectFailed( ExecutionEvent event );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
new file mode 100644
index 00000000..53f84c50
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -0,0 +1,443 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.Map;
+import java.util.Properties;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.eventspy.internal.EventSpyDispatcher;
+import org.apache.maven.model.Profile;
+import org.apache.maven.project.ProjectBuildingRequest;
+//
+// These settings values need to be removed and pushed down into a provider of configuration information
+//
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+//
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.RepositoryCache;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.transfer.TransferListener;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface MavenExecutionRequest
+{
+ // ----------------------------------------------------------------------
+ // Logging
+ // ----------------------------------------------------------------------
+
+ int LOGGING_LEVEL_DEBUG = Logger.LEVEL_DEBUG;
+
+ int LOGGING_LEVEL_INFO = Logger.LEVEL_INFO;
+
+ int LOGGING_LEVEL_WARN = Logger.LEVEL_WARN;
+
+ int LOGGING_LEVEL_ERROR = Logger.LEVEL_ERROR;
+
+ int LOGGING_LEVEL_FATAL = Logger.LEVEL_FATAL;
+
+ int LOGGING_LEVEL_DISABLED = Logger.LEVEL_DISABLED;
+
+ // ----------------------------------------------------------------------
+ // Reactor Failure Mode
+ // ----------------------------------------------------------------------
+
+ String REACTOR_FAIL_FAST = "FAIL_FAST";
+
+ String REACTOR_FAIL_AT_END = "FAIL_AT_END";
+
+ String REACTOR_FAIL_NEVER = "FAIL_NEVER";
+
+ // ----------------------------------------------------------------------
+ // Reactor Make Mode
+ // ----------------------------------------------------------------------
+
+ String REACTOR_MAKE_UPSTREAM = "make-upstream";
+
+ String REACTOR_MAKE_DOWNSTREAM = "make-downstream";
+
+ String REACTOR_MAKE_BOTH = "make-both";
+
+ // ----------------------------------------------------------------------
+ // Artifact repository policies
+ // ----------------------------------------------------------------------
+
+ String CHECKSUM_POLICY_FAIL = ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL;
+
+ String CHECKSUM_POLICY_WARN = ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN;
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ // Base directory
+ MavenExecutionRequest setBaseDirectory( File basedir );
+
+ String getBaseDirectory();
+
+ // Timing (remove this)
+ MavenExecutionRequest setStartTime( Date start );
+
+ Date getStartTime();
+
+ // Goals
+ MavenExecutionRequest setGoals( List<String> goals );
+
+ List<String> getGoals();
+
+ // Properties
+
+ /**
+ * 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}.
+ */
+ MavenExecutionRequest setSystemProperties( Properties systemProperties );
+
+ /**
+ * 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 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}.
+ */
+ MavenExecutionRequest setUserProperties( Properties userProperties );
+
+ /**
+ * 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();
+
+ // Reactor
+ MavenExecutionRequest setReactorFailureBehavior( String failureBehavior );
+
+ String getReactorFailureBehavior();
+
+ MavenExecutionRequest setSelectedProjects( List<String> projects );
+
+ List<String> getSelectedProjects();
+
+ /**
+ * @param projects the projects to exclude
+ * @return this MavenExecutionRequest
+ * @since 3.2
+ */
+ MavenExecutionRequest setExcludedProjects( List<String> projects );
+
+ /**
+ * @return the excluded projects, never {@code null}
+ * @since 3.2
+ */
+ List<String> getExcludedProjects();
+
+ MavenExecutionRequest setResumeFrom( String project );
+
+ String getResumeFrom();
+
+ MavenExecutionRequest setMakeBehavior( String makeBehavior );
+
+ String getMakeBehavior();
+
+ /**
+ * Set's the parallel degree of concurrency used by the build.
+ *
+ * @param degreeOfConcurrency
+ */
+ void setDegreeOfConcurrency( int degreeOfConcurrency );
+
+ /**
+ * @return the degree of concurrency for the build.
+ */
+ int getDegreeOfConcurrency();
+
+ // Recursive (really to just process the top-level POM)
+ MavenExecutionRequest setRecursive( boolean recursive );
+
+ boolean isRecursive();
+
+ MavenExecutionRequest setPom( File pom );
+
+ File getPom();
+
+ // Errors
+ MavenExecutionRequest setShowErrors( boolean showErrors );
+
+ boolean isShowErrors();
+
+ // Transfer listeners
+ MavenExecutionRequest setTransferListener( TransferListener transferListener );
+
+ TransferListener getTransferListener();
+
+ // Logging
+ MavenExecutionRequest setLoggingLevel( int loggingLevel );
+
+ int getLoggingLevel();
+
+ // Update snapshots
+ MavenExecutionRequest setUpdateSnapshots( boolean updateSnapshots );
+
+ boolean isUpdateSnapshots();
+
+ MavenExecutionRequest setNoSnapshotUpdates( boolean noSnapshotUpdates );
+
+ boolean isNoSnapshotUpdates();
+
+ // Checksum policy
+ MavenExecutionRequest setGlobalChecksumPolicy( String globalChecksumPolicy );
+
+ String getGlobalChecksumPolicy();
+
+ // Local repository
+ MavenExecutionRequest setLocalRepositoryPath( String localRepository );
+
+ MavenExecutionRequest setLocalRepositoryPath( File localRepository );
+
+ File getLocalRepositoryPath();
+
+ MavenExecutionRequest setLocalRepository( ArtifactRepository repository );
+
+ ArtifactRepository getLocalRepository();
+
+ // Interactive
+ MavenExecutionRequest setInteractiveMode( boolean interactive );
+
+ boolean isInteractiveMode();
+
+ // Offline
+ MavenExecutionRequest setOffline( boolean offline );
+
+ boolean isOffline();
+
+ boolean isCacheTransferError();
+
+ MavenExecutionRequest setCacheTransferError( boolean cacheTransferError );
+
+ boolean isCacheNotFound();
+
+ MavenExecutionRequest setCacheNotFound( boolean cacheNotFound );
+
+ // Profiles
+ List<Profile> getProfiles();
+
+ MavenExecutionRequest addProfile( Profile profile );
+
+ MavenExecutionRequest setProfiles( List<Profile> profiles );
+
+ MavenExecutionRequest addActiveProfile( String profile );
+
+ MavenExecutionRequest addActiveProfiles( List<String> profiles );
+
+ MavenExecutionRequest setActiveProfiles( List<String> profiles );
+
+ List<String> getActiveProfiles();
+
+ MavenExecutionRequest addInactiveProfile( String profile );
+
+ MavenExecutionRequest addInactiveProfiles( List<String> profiles );
+
+ MavenExecutionRequest setInactiveProfiles( List<String> profiles );
+
+ List<String> getInactiveProfiles();
+
+ // Proxies
+ List<Proxy> getProxies();
+
+ MavenExecutionRequest setProxies( List<Proxy> proxies );
+
+ MavenExecutionRequest addProxy( Proxy proxy );
+
+ // Servers
+ List<Server> getServers();
+
+ MavenExecutionRequest setServers( List<Server> servers );
+
+ MavenExecutionRequest addServer( Server server );
+
+ // Mirrors
+ List<Mirror> getMirrors();
+
+ MavenExecutionRequest setMirrors( List<Mirror> mirrors );
+
+ MavenExecutionRequest addMirror( Mirror mirror );
+
+ // Plugin groups
+ List<String> getPluginGroups();
+
+ MavenExecutionRequest setPluginGroups( List<String> pluginGroups );
+
+ MavenExecutionRequest addPluginGroup( String pluginGroup );
+
+ MavenExecutionRequest addPluginGroups( List<String> pluginGroups );
+
+ boolean isProjectPresent();
+
+ MavenExecutionRequest setProjectPresent( boolean isProjectPresent );
+
+ File getUserSettingsFile();
+
+ MavenExecutionRequest setUserSettingsFile( File userSettingsFile );
+
+ File getGlobalSettingsFile();
+
+ MavenExecutionRequest setGlobalSettingsFile( File globalSettingsFile );
+
+ MavenExecutionRequest addRemoteRepository( ArtifactRepository repository );
+
+ MavenExecutionRequest addPluginArtifactRepository( ArtifactRepository repository );
+
+ /**
+ * Set a new list of remote repositories to use the execution request. This is necessary if you perform
+ * transformations on the remote repositories being used. For example if you replace existing repositories with
+ * mirrors then it's easier to just replace the whole list with a new list of transformed repositories.
+ *
+ * @param repositories
+ * @return This request, never {@code null}.
+ */
+ MavenExecutionRequest setRemoteRepositories( List<ArtifactRepository> repositories );
+
+ List<ArtifactRepository> getRemoteRepositories();
+
+ MavenExecutionRequest setPluginArtifactRepositories( List<ArtifactRepository> repositories );
+
+ List<ArtifactRepository> getPluginArtifactRepositories();
+
+ MavenExecutionRequest setRepositoryCache( RepositoryCache repositoryCache );
+
+ RepositoryCache getRepositoryCache();
+
+ WorkspaceReader getWorkspaceReader();
+
+ MavenExecutionRequest setWorkspaceReader( WorkspaceReader workspaceReader );
+
+ File getUserToolchainsFile();
+
+ MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
+
+ /**
+ *
+ *
+ * @return the global toolchains file
+ * @since 3.3.0
+ */
+ File getGlobalToolchainsFile();
+
+ /**
+ *
+ * @param globalToolchainsFile the global toolchains file
+ * @return this request
+ * @since 3.3.0
+ */
+ MavenExecutionRequest setGlobalToolchainsFile( File globalToolchainsFile );
+
+ ExecutionListener getExecutionListener();
+
+ MavenExecutionRequest setExecutionListener( ExecutionListener executionListener );
+
+ ProjectBuildingRequest getProjectBuildingRequest();
+
+ /**
+ * @since 3.1
+ */
+ boolean isUseLegacyLocalRepository();
+
+ /**
+ * @since 3.1
+ */
+ MavenExecutionRequest setUseLegacyLocalRepository( boolean useLegacyLocalRepository );
+
+ /**
+ * Controls the {@link Builder} used by Maven by specification of the builder's id.
+ *
+ * @since 3.2.0
+ */
+ MavenExecutionRequest setBuilderId( String builderId );
+
+ /**
+ * Controls the {@link Builder} used by Maven by specification of the builders id.
+ *
+ * @since 3.2.0
+ */
+ String getBuilderId();
+
+ /**
+ *
+ * @param toolchains all toolchains grouped by type
+ * @return this request
+ * @since 3.3.0
+ */
+ MavenExecutionRequest setToolchains( Map<String, List<ToolchainModel>> toolchains );
+
+ /**
+ *
+ * @return all toolchains grouped by type, never {@code null}
+ * @since 3.3.0
+ */
+ Map<String, List<ToolchainModel>> getToolchains();
+
+ /**
+ * @since 3.3.0
+ */
+ void setMultiModuleProjectDirectory( File file );
+
+ /**
+ * @since 3.3.0
+ */
+ File getMultiModuleProjectDirectory();
+
+ /**
+ * @since 3.3.0
+ */
+ MavenExecutionRequest setEventSpyDispatcher( EventSpyDispatcher eventSpyDispatcher );
+
+ /**
+ * @since 3.3.0
+ */
+ EventSpyDispatcher getEventSpyDispatcher();
+
+ /**
+ * @since 3.3.0
+ */
+ Map<String, Object> getData();
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulationException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulationException.java
new file mode 100644
index 00000000..ddd6ad22
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulationException.java
@@ -0,0 +1,43 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Jason van Zyl
+ */
+public class MavenExecutionRequestPopulationException
+ extends Exception
+{
+ public MavenExecutionRequestPopulationException( String message )
+ {
+ super( message );
+ }
+
+ public MavenExecutionRequestPopulationException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public MavenExecutionRequestPopulationException( String message,
+ Throwable cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulator.java
new file mode 100644
index 00000000..4f254f7a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequestPopulator.java
@@ -0,0 +1,74 @@
+package org.apache.maven.execution;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.settings.Settings;
+import org.apache.maven.toolchain.model.PersistedToolchains;
+
+/**
+ * Assists in populating an execution request for invocation of Maven.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface MavenExecutionRequestPopulator
+{
+ /**
+ * Copies the values from the given toolchains into the specified execution request. This method will replace any
+ * existing values in the execution request that are controlled by the toolchains. Hence, it is expected that this
+ * method is called on a new/empty execution request before the caller mutates it to fit its needs.
+ *
+ * @param request The execution request to populate, must not be {@code null}.
+ * @param toolchains The toolchains to copy into the execution request, may be {@code null}.
+ * @return The populated execution request, never {@code null}.
+ * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
+ * @since 3.3.0
+ */
+ MavenExecutionRequest populateFromToolchains( MavenExecutionRequest request, PersistedToolchains toolchains )
+ throws MavenExecutionRequestPopulationException;
+
+ /**
+ * Injects default values like plugin groups or repositories into the specified execution request.
+ *
+ * @param request The execution request to populate, must not be {@code null}.
+ * @return The populated execution request, never {@code null}.
+ * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
+ */
+ MavenExecutionRequest populateDefaults( MavenExecutionRequest request )
+ throws MavenExecutionRequestPopulationException;
+
+ /*if_not[MAVEN4]*/
+
+ /**
+ * Copies the values from the given settings into the specified execution request. This method will replace any
+ * existing values in the execution request that are controlled by the settings. Hence, it is expected that this
+ * method is called on a new/empty execution request before the caller mutates it to fit its needs.
+ *
+ * @param request The execution request to populate, must not be {@code null}.
+ * @param settings The settings to copy into the execution request, may be {@code null}.
+ * @return The populated execution request, never {@code null}.
+ * @throws MavenExecutionRequestPopulationException If the execution request could not be populated.
+ */
+ @Deprecated
+ MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
+ throws MavenExecutionRequestPopulationException;
+
+ /*end[MAVEN4]*/
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
new file mode 100644
index 00000000..cb95fb1f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
@@ -0,0 +1,70 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.project.DependencyResolutionResult;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface MavenExecutionResult
+{
+ MavenExecutionResult setProject( MavenProject project );
+ MavenProject getProject();
+
+ MavenExecutionResult setTopologicallySortedProjects( List<MavenProject> projects );
+
+ /**
+ * @return the sorted list, or an empty list if there are no projects.
+ */
+ List<MavenProject> getTopologicallySortedProjects();
+
+ MavenExecutionResult setDependencyResolutionResult( DependencyResolutionResult result );
+ DependencyResolutionResult getDependencyResolutionResult();
+
+ // for each exception
+ // - knowing what artifacts are missing
+ // - project building exception
+ // - invalid project model exception: list of markers
+ // - xmlpull parser exception
+ List<Throwable> getExceptions();
+
+ MavenExecutionResult addException( Throwable e );
+
+ boolean hasExceptions();
+
+ /**
+ * Gets the build summary for the specified project.
+ *
+ * @param project The project to get the build summary for, must not be {@code null}.
+ * @return The build summary for the project or {@code null} if the project has not been built (yet).
+ */
+ BuildSummary getBuildSummary( MavenProject project );
+
+ /**
+ * Add the specified build summary.
+ *
+ * @param summary The build summary to add, must not be {@code null}.
+ */
+ void addBuildSummary( BuildSummary summary );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
new file mode 100644
index 00000000..235691ac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
@@ -0,0 +1,438 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryCache;
+import org.apache.maven.monitor.event.EventDispatcher;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * @author Jason van Zyl
+ */
+public class MavenSession
+ implements Cloneable
+{
+ private MavenExecutionRequest request;
+
+ private MavenExecutionResult result;
+
+ private RepositorySystemSession repositorySession;
+
+ private Properties executionProperties;
+
+ private MavenProject currentProject;
+
+ /**
+ * These projects have already been topologically sorted in the {@link org.apache.maven.Maven} component before
+ * being passed into the session. This is also the potentially constrained set of projects by using --projects
+ * on the command line.
+ */
+ private List<MavenProject> projects;
+
+ /**
+ * The full set of projects before any potential constraining by --projects. Useful in the case where you want to
+ * build a smaller set of projects but perform other operations in the context of your reactor.
+ */
+ private List<MavenProject> allProjects;
+
+ private MavenProject topLevelProject;
+
+ private ProjectDependencyGraph projectDependencyGraph;
+
+ private boolean parallel;
+
+ private final Map<String, Map<String, Map<String, Object>>> pluginContextsByProjectAndPluginKey =
+ new ConcurrentHashMap<String, Map<String, Map<String, Object>>>();
+
+
+ public void setProjects( List<MavenProject> projects )
+ {
+ if ( !projects.isEmpty() )
+ {
+ this.currentProject = projects.get( 0 );
+ this.topLevelProject = currentProject;
+ for ( MavenProject project : projects )
+ {
+ if ( project.isExecutionRoot() )
+ {
+ topLevelProject = project;
+ break;
+ }
+ }
+ }
+ else
+ {
+ this.currentProject = null;
+ this.topLevelProject = null;
+ }
+ this.projects = projects;
+ }
+
+ public ArtifactRepository getLocalRepository()
+ {
+ return request.getLocalRepository();
+ }
+
+ public List<String> getGoals()
+ {
+ return request.getGoals();
+ }
+
+ /**
+ * 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}.
+ */
+ public Properties getUserProperties()
+ {
+ return request.getUserProperties();
+ }
+
+ /**
+ * 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}.
+ */
+ public Properties getSystemProperties()
+ {
+ return request.getSystemProperties();
+ }
+
+ public Settings getSettings()
+ {
+ return settings;
+ }
+
+ public List<MavenProject> getProjects()
+ {
+ return projects;
+ }
+
+ public String getExecutionRootDirectory()
+ {
+ return request.getBaseDirectory();
+ }
+
+ public MavenExecutionRequest getRequest()
+ {
+ return request;
+ }
+
+ public void setCurrentProject( MavenProject currentProject )
+ {
+ this.currentProject = currentProject;
+ }
+
+ public MavenProject getCurrentProject()
+ {
+ return currentProject;
+ }
+
+ public ProjectBuildingRequest getProjectBuildingRequest()
+ {
+ return request.getProjectBuildingRequest().setRepositorySession( getRepositorySession() );
+ }
+
+ public List<String> getPluginGroups()
+ {
+ return request.getPluginGroups();
+ }
+
+ public boolean isOffline()
+ {
+ return request.isOffline();
+ }
+
+ public MavenProject getTopLevelProject()
+ {
+ return topLevelProject;
+ }
+
+ public MavenExecutionResult getResult()
+ {
+ return result;
+ }
+
+ // Backward compat
+
+ public Map<String, Object> getPluginContext( PluginDescriptor plugin, MavenProject project )
+ {
+ String projectKey = project.getId();
+
+ Map<String, Map<String, Object>> pluginContextsByKey = pluginContextsByProjectAndPluginKey.get( projectKey );
+
+ if ( pluginContextsByKey == null )
+ {
+ pluginContextsByKey = new ConcurrentHashMap<String, Map<String, Object>>();
+
+ pluginContextsByProjectAndPluginKey.put( projectKey, pluginContextsByKey );
+ }
+
+ String pluginKey = plugin.getPluginLookupKey();
+
+ Map<String, Object> pluginContext = pluginContextsByKey.get( pluginKey );
+
+ if ( pluginContext == null )
+ {
+ pluginContext = new ConcurrentHashMap<String, Object>();
+
+ pluginContextsByKey.put( pluginKey, pluginContext );
+ }
+
+ return pluginContext;
+ }
+
+ public ProjectDependencyGraph getProjectDependencyGraph()
+ {
+ return projectDependencyGraph;
+ }
+
+ public void setProjectDependencyGraph( ProjectDependencyGraph projectDependencyGraph )
+ {
+ this.projectDependencyGraph = projectDependencyGraph;
+ }
+
+ public String getReactorFailureBehavior()
+ {
+ return request.getReactorFailureBehavior();
+ }
+
+ @Override
+ public MavenSession clone()
+ {
+ try
+ {
+ return (MavenSession) super.clone();
+ }
+ catch ( CloneNotSupportedException e )
+ {
+ throw new RuntimeException( "Bug", e );
+ }
+ }
+
+ public Date getStartTime()
+ {
+ return request.getStartTime();
+ }
+
+ public boolean isParallel()
+ {
+ return parallel;
+ }
+
+ public void setParallel( boolean parallel )
+ {
+ this.parallel = parallel;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ return repositorySession;
+ }
+
+ private Map<String, MavenProject> projectMap;
+
+ public void setProjectMap( Map<String, MavenProject> projectMap )
+ {
+ this.projectMap = projectMap;
+ }
+
+ /** This is a provisional method and may be removed */
+ public List<MavenProject> getAllProjects()
+ {
+ return allProjects;
+ }
+
+ /** This is a provisional method and may be removed */
+ public void setAllProjects( List<MavenProject> allProjects )
+ {
+ this.allProjects = allProjects;
+ }
+
+ /*if_not[MAVEN4]*/
+
+ //
+ // Deprecated
+ //
+
+ private PlexusContainer container;
+
+ private final Settings settings;
+
+ @Deprecated
+ /** @deprecated This appears to only be used in the ReactorReader and we can do any processing required there */
+ public Map<String, MavenProject> getProjectMap()
+ {
+ return projectMap;
+ }
+
+ @Deprecated
+ public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession,
+ MavenExecutionRequest request, MavenExecutionResult result )
+ {
+ this.container = container;
+ this.request = request;
+ this.result = result;
+ this.settings = new SettingsAdapter( request );
+ this.repositorySession = repositorySession;
+ }
+
+ @Deprecated
+ public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
+ MavenProject project )
+ {
+ this( container, request, result, Arrays.asList( new MavenProject[]{project} ) );
+ }
+
+ @Deprecated
+ public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
+ EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
+ String executionRootDir, Properties executionProperties, Date startTime )
+ {
+ this( container, settings, localRepository, eventDispatcher, unused, goals, executionRootDir,
+ executionProperties, null, startTime );
+ }
+
+ @Deprecated
+ public MavenSession( PlexusContainer container, Settings settings, ArtifactRepository localRepository,
+ EventDispatcher eventDispatcher, ReactorManager unused, List<String> goals,
+ String executionRootDir, Properties executionProperties, Properties userProperties,
+ Date startTime )
+ {
+ this.container = container;
+ this.settings = settings;
+ this.executionProperties = executionProperties;
+ this.request = new DefaultMavenExecutionRequest();
+ this.request.setUserProperties( userProperties );
+ this.request.setLocalRepository( localRepository );
+ this.request.setGoals( goals );
+ this.request.setBaseDirectory( ( executionRootDir != null ) ? new File( executionRootDir ) : null );
+ this.request.setStartTime( startTime );
+ }
+
+ @Deprecated
+ public MavenSession( PlexusContainer container, MavenExecutionRequest request, MavenExecutionResult result,
+ List<MavenProject> projects )
+ {
+ this.container = container;
+ this.request = request;
+ this.result = result;
+ this.settings = new SettingsAdapter( request );
+ setProjects( projects );
+ }
+
+ @Deprecated
+ public List<MavenProject> getSortedProjects()
+ {
+ return getProjects();
+ }
+
+ @Deprecated
+ //
+ // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave
+ // this here, possibly indefinitely.
+ //
+ public RepositoryCache getRepositoryCache()
+ {
+ return null;
+ }
+
+ @Deprecated
+ public EventDispatcher getEventDispatcher()
+ {
+ return null;
+ }
+
+ @Deprecated
+ public boolean isUsingPOMsFromFilesystem()
+ {
+ return request.isProjectPresent();
+ }
+
+ /**
+ * @deprecated Use either {@link #getUserProperties()} or {@link #getSystemProperties()}.
+ */
+ @Deprecated
+ public Properties getExecutionProperties()
+ {
+ if ( executionProperties == null )
+ {
+ executionProperties = new Properties();
+ executionProperties.putAll( request.getSystemProperties() );
+ executionProperties.putAll( request.getUserProperties() );
+ }
+
+ return executionProperties;
+ }
+
+ @Deprecated
+ public PlexusContainer getContainer()
+ {
+ return container;
+ }
+
+ @Deprecated
+ public Object lookup( String role )
+ throws ComponentLookupException
+ {
+ return container.lookup( role );
+ }
+
+ @Deprecated
+ public Object lookup( String role, String roleHint )
+ throws ComponentLookupException
+ {
+ return container.lookup( role, roleHint );
+ }
+
+ @Deprecated
+ public List<Object> lookupList( String role )
+ throws ComponentLookupException
+ {
+ return container.lookupList( role );
+ }
+
+ @Deprecated
+ public Map<String, Object> lookupMap( String role )
+ throws ComponentLookupException
+ {
+ return container.lookupMap( role );
+ }
+
+ /*end[MAVEN4]*/
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionEvent.java
new file mode 100644
index 00000000..a8d293d1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionEvent.java
@@ -0,0 +1,86 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Encapsulates parameters of MojoExecutionListener callback methods and is meant to provide API evolution path should
+ * it become necessary to introduce new parameters in the existing callbacks in the future.
+ *
+ * @see MojoExecutionListener
+ * @see org.apache.maven.execution.scope.WeakMojoExecutionListener
+ * @since 3.1.2
+ * @provisional This class is part of work in progress and can be changed or removed without notice.
+ */
+public class MojoExecutionEvent
+{
+ private final MavenSession session;
+
+ private final MavenProject project;
+
+ private final MojoExecution mojoExecution;
+
+ private final Mojo mojo;
+
+ private final Throwable cause;
+
+ public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo )
+ {
+ this( session, project, mojoExecution, mojo, null );
+ }
+
+ public MojoExecutionEvent( MavenSession session, MavenProject project, MojoExecution mojoExecution, Mojo mojo,
+ Throwable cause )
+ {
+ this.session = session;
+ this.project = project;
+ this.mojoExecution = mojoExecution;
+ this.mojo = mojo;
+ this.cause = cause;
+ }
+
+ public MavenSession getSession()
+ {
+ return session;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public MojoExecution getExecution()
+ {
+ return mojoExecution;
+ }
+
+ public Mojo getMojo()
+ {
+ return mojo;
+ }
+
+ public Throwable getCause()
+ {
+ return cause;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java
new file mode 100644
index 00000000..c2fb7a18
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/MojoExecutionListener.java
@@ -0,0 +1,40 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.plugin.MojoExecutionException;
+
+/**
+ * Extension point that allows build extensions observe and possibly veto mojo executions.
+ *
+ * @see org.apache.maven.execution.scope.WeakMojoExecutionListener
+ * @since 3.1.2
+ * @provisional This interface is part of work in progress and can be changed or removed without notice.
+ */
+public interface MojoExecutionListener
+{
+ void beforeMojoExecution( MojoExecutionEvent event )
+ throws MojoExecutionException;
+
+ void afterMojoExecutionSuccess( MojoExecutionEvent event )
+ throws MojoExecutionException;
+
+ void afterExecutionFailure( MojoExecutionEvent event );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java
new file mode 100644
index 00000000..1db277db
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectDependencyGraph.java
@@ -0,0 +1,64 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.project.MavenProject;
+
+/**
+ * Describes the inter-dependencies between projects in the reactor.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProjectDependencyGraph
+{
+
+ /**
+ * Gets all projects in their intended build order, i.e. after topologically sorting the projects according to their
+ * inter-dependencies.
+ *
+ * @return The projects in the build order, never {@code null}.
+ */
+ List<MavenProject> getSortedProjects();
+
+ /**
+ * Gets the downstream projects of the specified project. A downstream project is a project that directly or
+ * indirectly depends on the given project.
+ *
+ * @param project The project whose downstream projects should be retrieved, must not be {@code null}.
+ * @param transitive A flag whether to retrieve all direct and indirect downstream projects or just the immediate
+ * downstream projects.
+ * @return The downstream projects in the build order, never {@code null}.
+ */
+ List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive );
+
+ /**
+ * Gets the upstream projects of the specified project. An upstream project is a project that directly or indirectly
+ * is a prerequisite of the given project.
+ *
+ * @param project The project whose upstream projects should be retrieved, must not be {@code null}.
+ * @param transitive A flag whether to retrieve all direct and indirect upstream projects or just the immediate
+ * upstream projects.
+ * @return The upstream projects in the build order, never {@code null}.
+ */
+ List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionEvent.java
new file mode 100644
index 00000000..fb71078f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionEvent.java
@@ -0,0 +1,90 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Encapsulates parameters of ProjectExecutionListener callback methods and is meant to provide API evolution path
+ * should it become necessary to introduce new parameters in the existing callbacks in the future.
+ *
+ * @see ProjectExecutionListener
+ * @since 3.1.2
+ * @provisional This class is part of work in progress and can be changed or removed without notice.
+ */
+public class ProjectExecutionEvent
+{
+
+ private final MavenSession session;
+
+ private final MavenProject project;
+
+ private final List<MojoExecution> executionPlan;
+
+ private final Throwable cause;
+
+ public ProjectExecutionEvent( MavenSession session, MavenProject project )
+ {
+ this( session, project, null, null );
+ }
+
+ public ProjectExecutionEvent( MavenSession session, MavenProject project, List<MojoExecution> executionPlan )
+ {
+ this( session, project, executionPlan, null );
+ }
+
+ public ProjectExecutionEvent( MavenSession session, MavenProject project, Throwable cause )
+ {
+ this( session, project, null, cause );
+ }
+
+ public ProjectExecutionEvent( MavenSession session, MavenProject project, List<MojoExecution> executionPlan,
+ Throwable cause )
+ {
+ this.session = session;
+ this.project = project;
+ this.executionPlan = executionPlan;
+ this.cause = cause;
+ }
+
+ public MavenSession getSession()
+ {
+ return session;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public List<MojoExecution> getExecutionPlan()
+ {
+ return executionPlan;
+ }
+
+ public Throwable getCause()
+ {
+ return cause;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java
new file mode 100644
index 00000000..d7e89183
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ProjectExecutionListener.java
@@ -0,0 +1,44 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.lifecycle.LifecycleExecutionException;
+
+/**
+ * Extension point that allows build extensions observe and possibly veto project build execution.
+ *
+ * @see ExecutionListener
+ * @see MojoExecutionListener
+ * @since 3.1.2
+ * @provisional This interface is part of work in progress and can be changed or removed without notice.
+ */
+public interface ProjectExecutionListener
+{
+ void beforeProjectExecution( ProjectExecutionEvent event )
+ throws LifecycleExecutionException;
+
+ void beforeProjectLifecycleExecution( ProjectExecutionEvent event )
+ throws LifecycleExecutionException;
+
+ void afterProjectExecutionSuccess( ProjectExecutionEvent event )
+ throws LifecycleExecutionException;
+
+ void afterProjectExecutionFailure( ProjectExecutionEvent event );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java
new file mode 100644
index 00000000..1b99a3be
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java
@@ -0,0 +1,199 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.artifact.ArtifactUtils;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectSorter;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Deprecated
+public class ReactorManager
+{
+ public static final String FAIL_FAST = "fail-fast";
+
+ public static final String FAIL_AT_END = "fail-at-end";
+
+ public static final String FAIL_NEVER = "fail-never";
+
+ public static final String MAKE_MODE = "make";
+
+ public static final String MAKE_DEPENDENTS_MODE = "make-dependents";
+
+ // make projects that depend on me, and projects that I depend on
+ public static final String MAKE_BOTH_MODE = "make-both";
+
+ private List<String> blackList = new ArrayList<String>();
+
+ private Map<String, BuildFailure> buildFailuresByProject = new HashMap<String, BuildFailure>();
+
+ private Map pluginContextsByProjectAndPluginKey = new HashMap();
+
+ private String failureBehavior = FAIL_FAST;
+
+ private final ProjectSorter sorter;
+
+ private Map<String, BuildSuccess> buildSuccessesByProject = new HashMap<String, BuildSuccess>();
+
+ public ReactorManager( List<MavenProject> projects )
+ throws CycleDetectedException, DuplicateProjectException
+ {
+ this.sorter = new ProjectSorter( projects );
+ }
+
+ public Map getPluginContext( PluginDescriptor plugin, MavenProject project )
+ {
+ Map pluginContextsByKey = (Map) pluginContextsByProjectAndPluginKey.get( project.getId() );
+
+ if ( pluginContextsByKey == null )
+ {
+ pluginContextsByKey = new HashMap();
+ pluginContextsByProjectAndPluginKey.put( project.getId(), pluginContextsByKey );
+ }
+
+ Map pluginContext = (Map) pluginContextsByKey.get( plugin.getPluginLookupKey() );
+
+ if ( pluginContext == null )
+ {
+ pluginContext = new HashMap();
+ pluginContextsByKey.put( plugin.getPluginLookupKey(), pluginContext );
+ }
+
+ return pluginContext;
+ }
+
+ public void setFailureBehavior( String failureBehavior )
+ {
+ if ( failureBehavior == null )
+ {
+ this.failureBehavior = FAIL_FAST; // default
+ return;
+ }
+ if ( FAIL_FAST.equals( failureBehavior ) || FAIL_AT_END.equals( failureBehavior )
+ || FAIL_NEVER.equals( failureBehavior ) )
+ {
+ this.failureBehavior = failureBehavior;
+ }
+ else
+ {
+ throw new IllegalArgumentException( "Invalid failure behavior (must be one of: \'" + FAIL_FAST + "\', \'"
+ + FAIL_AT_END + "\', \'" + FAIL_NEVER + "\')." );
+ }
+ }
+
+ public String getFailureBehavior()
+ {
+ return failureBehavior;
+ }
+
+ public void blackList( MavenProject project )
+ {
+ blackList( getProjectKey( project ) );
+ }
+
+ private void blackList( String id )
+ {
+ if ( !blackList.contains( id ) )
+ {
+ blackList.add( id );
+
+ List<String> dependents = sorter.getDependents( id );
+
+ if ( dependents != null && !dependents.isEmpty() )
+ {
+ for ( String dependentId : dependents )
+ {
+ if ( !buildSuccessesByProject.containsKey( dependentId )
+ && !buildFailuresByProject.containsKey( dependentId ) )
+ {
+ blackList( dependentId );
+ }
+ }
+ }
+ }
+ }
+
+ public boolean isBlackListed( MavenProject project )
+ {
+ return blackList.contains( getProjectKey( project ) );
+ }
+
+ private static String getProjectKey( MavenProject project )
+ {
+ return ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+ }
+
+ public void registerBuildFailure( MavenProject project, Exception error, String task, long time )
+ {
+ buildFailuresByProject.put( getProjectKey( project ), new BuildFailure( project, time, error ) );
+ }
+
+ public boolean hasBuildFailures()
+ {
+ return !buildFailuresByProject.isEmpty();
+ }
+
+ public boolean hasBuildFailure( MavenProject project )
+ {
+ return buildFailuresByProject.containsKey( getProjectKey( project ) );
+ }
+
+ public boolean hasMultipleProjects()
+ {
+ return sorter.hasMultipleProjects();
+ }
+
+ public List<MavenProject> getSortedProjects()
+ {
+ return sorter.getSortedProjects();
+ }
+
+ public boolean hasBuildSuccess( MavenProject project )
+ {
+ return buildSuccessesByProject.containsKey( getProjectKey( project ) );
+ }
+
+ public void registerBuildSuccess( MavenProject project, long time )
+ {
+ buildSuccessesByProject.put( getProjectKey( project ), new BuildSuccess( project, time ) );
+ }
+
+ public BuildFailure getBuildFailure( MavenProject project )
+ {
+ return (BuildFailure) buildFailuresByProject.get( getProjectKey( project ) );
+ }
+
+ public BuildSuccess getBuildSuccess( MavenProject project )
+ {
+ return (BuildSuccess) buildSuccessesByProject.get( getProjectKey( project ) );
+ }
+
+ public boolean executedMultipleProjects()
+ {
+ return buildFailuresByProject.size() + buildSuccessesByProject.size() > 1;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/SettingsAdapter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/SettingsAdapter.java
new file mode 100644
index 00000000..000607ff
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/SettingsAdapter.java
@@ -0,0 +1,126 @@
+package org.apache.maven.execution;
+
+/*
+ * 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.settings.Mirror;
+import org.apache.maven.settings.Profile;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.RuntimeInfo;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.SettingsUtils;
+
+/**
+ * Adapt a {@link MavenExecutionRequest} to a {@link Settings} object for use in the Maven core.
+ * We want to make sure that what is ask for in the execution request overrides what is in the settings.
+ * The CLI feeds into an execution request so if a particular value is present in the execution request
+ * then we will take that over the value coming from the user settings.
+ *
+ * @author Jason van Zyl
+ */
+class SettingsAdapter
+ extends Settings
+{
+
+ private MavenExecutionRequest request;
+
+ private RuntimeInfo runtimeInfo;
+
+ public SettingsAdapter( MavenExecutionRequest request )
+ {
+ this.request = request;
+
+ /*
+ * NOTE: Plugins like maven-release-plugin query the path to the settings.xml to pass it into a forked Maven and
+ * the CLI will fail when called with a non-existing settings, so be sure to only point at actual files. Having
+ * a null file should be harmless as this case matches general Maven 2.x behavior...
+ */
+ File userSettings = request.getUserSettingsFile();
+ this.runtimeInfo = new RuntimeInfo( ( userSettings != null && userSettings.isFile() ) ? userSettings : null );
+ }
+
+ @Override
+ public String getLocalRepository()
+ {
+ if ( request.getLocalRepositoryPath() != null )
+ {
+ return request.getLocalRepositoryPath().getAbsolutePath();
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean isInteractiveMode()
+ {
+ return request.isInteractiveMode();
+ }
+
+ @Override
+ public boolean isOffline()
+ {
+ return request.isOffline();
+ }
+
+ @Override
+ public List<Proxy> getProxies()
+ {
+ return request.getProxies();
+ }
+
+ @Override
+ public List<Server> getServers()
+ {
+ return request.getServers();
+ }
+
+ @Override
+ public List<Mirror> getMirrors()
+ {
+ return request.getMirrors();
+ }
+
+ @Override
+ public List<Profile> getProfiles()
+ {
+ List<Profile> result = new ArrayList<Profile>();
+ for ( org.apache.maven.model.Profile profile : request.getProfiles() )
+ {
+ result.add( SettingsUtils.convertToSettingsProfile( profile ) );
+ }
+ return result;
+ }
+
+ @Override
+ public List<String> getActiveProfiles()
+ {
+ return request.getActiveProfiles();
+ }
+
+ @Override
+ public List<String> getPluginGroups()
+ {
+ return request.getPluginGroups();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/MojoExecutionScoped.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/MojoExecutionScoped.java
new file mode 100644
index 00000000..0dcbd16f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/MojoExecutionScoped.java
@@ -0,0 +1,42 @@
+package org.apache.maven.execution.scope;
+
+/*
+ * 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 java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import com.google.inject.ScopeAnnotation;
+
+/**
+ * Indicates that annotated component should be instantiated before mojo execution starts and discarded after mojo
+ * execution completes.
+ *
+ * @author igor
+ * @since 3.1.2
+ */
+@Target( { TYPE } )
+@Retention( RUNTIME )
+@ScopeAnnotation
+public @interface MojoExecutionScoped
+{
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java
new file mode 100644
index 00000000..94e7c104
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/WeakMojoExecutionListener.java
@@ -0,0 +1,44 @@
+package org.apache.maven.execution.scope;
+
+/*
+ * 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.execution.MojoExecutionEvent;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Extension point that allows build extensions observe and possibly veto mojo executions.
+ * <p>
+ * Unlike {@link MojoExecutionListener}, this extension point does not trigger instantiation of the component, hence
+ * "weak" class name prefix. Only applies to mojo execution scoped components.
+ *
+ * @see org.apache.maven.execution.MojoExecutionListener
+ * @since 3.1.2
+ * @provisional This interface is part of work in progress and can be changed or removed without notice.
+ */
+public interface WeakMojoExecutionListener
+{
+ void beforeMojoExecution( MojoExecutionEvent event )
+ throws MojoExecutionException;
+
+ void afterMojoExecutionSuccess( MojoExecutionEvent event )
+ throws MojoExecutionException;
+
+ void afterExecutionFailure( MojoExecutionEvent event );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScope.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScope.java
new file mode 100644
index 00000000..8a98daf0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScope.java
@@ -0,0 +1,190 @@
+package org.apache.maven.execution.scope.internal;
+
+/*
+ * 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.IdentityHashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.maven.execution.MojoExecutionEvent;
+import org.apache.maven.execution.MojoExecutionListener;
+import org.apache.maven.execution.scope.WeakMojoExecutionListener;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import com.google.common.collect.Maps;
+import com.google.inject.Key;
+import com.google.inject.OutOfScopeException;
+import com.google.inject.Provider;
+import com.google.inject.Scope;
+import com.google.inject.util.Providers;
+
+public class MojoExecutionScope
+ implements Scope, MojoExecutionListener
+{
+ private static final Provider<Object> SEEDED_KEY_PROVIDER = new Provider<Object>()
+ {
+ public Object get()
+ {
+ throw new IllegalStateException();
+ }
+ };
+
+ private static final class ScopeState
+ {
+ public final Map<Key<?>, Provider<?>> seeded = Maps.newHashMap();
+
+ public final Map<Key<?>, Object> provided = Maps.newHashMap();
+ }
+
+ private final ThreadLocal<LinkedList<ScopeState>> values = new ThreadLocal<LinkedList<ScopeState>>();
+
+ public MojoExecutionScope()
+ {
+ }
+
+ public void enter()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null )
+ {
+ stack = new LinkedList<ScopeState>();
+ values.set( stack );
+ }
+ stack.addFirst( new ScopeState() );
+ }
+
+ private ScopeState getScopeState()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new IllegalStateException();
+ }
+ return stack.getFirst();
+ }
+
+ public void exit()
+ throws MojoExecutionException
+ {
+ final LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new IllegalStateException();
+ }
+ stack.removeFirst();
+ if ( stack.isEmpty() )
+ {
+ values.remove();
+ }
+ }
+
+ public <T> void seed( Class<T> clazz, Provider<T> value )
+ {
+ getScopeState().seeded.put( Key.get( clazz ), value );
+ }
+
+ public <T> void seed( Class<T> clazz, final T value )
+ {
+ getScopeState().seeded.put( Key.get( clazz ), Providers.of( value ) );
+ }
+
+ public <T> Provider<T> scope( final Key<T> key, final Provider<T> unscoped )
+ {
+ return new Provider<T>()
+ {
+ @SuppressWarnings( "unchecked" )
+ public T get()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new OutOfScopeException( "Cannot access " + key + " outside of a scoping block" );
+ }
+
+ ScopeState state = stack.getFirst();
+
+ Provider<?> seeded = state.seeded.get( key );
+
+ if ( seeded != null )
+ {
+ return (T) seeded.get();
+ }
+
+ T provided = (T) state.provided.get( key );
+ if ( provided == null && unscoped != null )
+ {
+ provided = unscoped.get();
+ state.provided.put( key, provided );
+ }
+
+ return provided;
+ }
+ };
+ }
+
+ @SuppressWarnings( { "unchecked" } )
+ public static <T> Provider<T> seededKeyProvider()
+ {
+ return (Provider<T>) SEEDED_KEY_PROVIDER;
+ }
+
+ public void beforeMojoExecution( MojoExecutionEvent event )
+ throws MojoExecutionException
+ {
+ for ( WeakMojoExecutionListener provided : getProvidedListeners() )
+ {
+ provided.beforeMojoExecution( event );
+ }
+ }
+
+ public void afterMojoExecutionSuccess( MojoExecutionEvent event )
+ throws MojoExecutionException
+ {
+ for ( WeakMojoExecutionListener provided : getProvidedListeners() )
+ {
+ provided.afterMojoExecutionSuccess( event );
+ }
+ }
+
+ public void afterExecutionFailure( MojoExecutionEvent event )
+ {
+ for ( WeakMojoExecutionListener provided : getProvidedListeners() )
+ {
+ provided.afterExecutionFailure( event );
+ }
+ }
+
+ private Collection<WeakMojoExecutionListener> getProvidedListeners()
+ {
+ // the same instance can be provided multiple times under different Key's
+ // deduplicate instances to avoid redundant beforeXXX/afterXXX callbacks
+ IdentityHashMap<WeakMojoExecutionListener, Object> listeners =
+ new IdentityHashMap<WeakMojoExecutionListener, Object>();
+ for ( Object provided : getScopeState().provided.values() )
+ {
+ if ( provided instanceof WeakMojoExecutionListener )
+ {
+ listeners.put( (WeakMojoExecutionListener) provided, null );
+ }
+ }
+ return listeners.keySet();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeCoreModule.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeCoreModule.java
new file mode 100644
index 00000000..8208c3c3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeCoreModule.java
@@ -0,0 +1,45 @@
+package org.apache.maven.execution.scope.internal;
+
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.execution.MojoExecutionListener;
+
+@Named
+public class MojoExecutionScopeCoreModule
+ extends MojoExecutionScopeModule
+{
+
+ @Inject
+ public MojoExecutionScopeCoreModule()
+ {
+ super( new MojoExecutionScope() );
+ }
+
+ @Override
+ protected void configure()
+ {
+ super.configure();
+ bind( MojoExecutionListener.class ).toInstance( scope );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java
new file mode 100644
index 00000000..229a3c56
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java
@@ -0,0 +1,56 @@
+package org.apache.maven.execution.scope.internal;
+
+/*
+ * 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.execution.scope.MojoExecutionScoped;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import com.google.inject.AbstractModule;
+
+public class MojoExecutionScopeModule
+ extends AbstractModule
+{
+ protected final MojoExecutionScope scope;
+
+ public MojoExecutionScopeModule( PlexusContainer container )
+ throws ComponentLookupException
+ {
+ this( container.lookup( MojoExecutionScope.class ) );
+ }
+
+ protected MojoExecutionScopeModule( MojoExecutionScope scope )
+ {
+ this.scope = scope;
+ }
+
+ @Override
+ protected void configure()
+ {
+ bindScope( MojoExecutionScoped.class, scope );
+ bind( MojoExecutionScope.class ).toInstance( scope );
+
+ bind( MavenProject.class ).toProvider( MojoExecutionScope.<MavenProject>seededKeyProvider() ).in( scope );
+ bind( MojoExecution.class ).toProvider( MojoExecutionScope.<MojoExecution>seededKeyProvider() ).in( scope );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExports.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExports.java
new file mode 100644
index 00000000..c4265b31
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExports.java
@@ -0,0 +1,75 @@
+package org.apache.maven.extension.internal;
+
+/*
+ * 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.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Provides information about artifacts (identified by groupId:artifactId string key) and classpath elements exported by
+ * Maven core itself and loaded Maven core extensions.
+ *
+ * @since 3.3.0
+ */
+public class CoreExports
+{
+ private final Set<String> artifacts;
+
+ private final Map<String, ClassLoader> packages;
+
+ public CoreExports( CoreExtensionEntry entry )
+ {
+ this( entry.getClassRealm(), entry.getExportedArtifacts(), entry.getExportedPackages() );
+ }
+
+ public CoreExports( ClassRealm realm, Set<String> exportedArtifacts, Set<String> exportedPackages )
+ {
+ Map<String, ClassLoader> packages = new LinkedHashMap<String, ClassLoader>();
+ for ( String pkg : exportedPackages )
+ {
+ packages.put( pkg, realm );
+ }
+ this.artifacts = ImmutableSet.copyOf( exportedArtifacts );
+ this.packages = ImmutableMap.copyOf( packages );
+ }
+
+ /**
+ * Returns artifacts exported by Maven core and core extensions. Artifacts are identified by their
+ * groupId:artifactId string key.
+ */
+ public Set<String> getExportedArtifacts()
+ {
+ return artifacts;
+ }
+
+ /**
+ * Returns packages exported by Maven core and core extensions.
+ */
+ public Map<String, ClassLoader> getExportedPackages()
+ {
+ return packages;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExportsProvider.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExportsProvider.java
new file mode 100644
index 00000000..e7e4534c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExportsProvider.java
@@ -0,0 +1,53 @@
+package org.apache.maven.extension.internal;
+
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.codehaus.plexus.PlexusContainer;
+import org.eclipse.sisu.Nullable;
+
+@Named
+@Singleton
+public class CoreExportsProvider
+{
+
+ private final CoreExports exports;
+
+ @Inject
+ public CoreExportsProvider( PlexusContainer container, @Nullable CoreExports exports )
+ {
+ if ( exports == null )
+ {
+ this.exports = new CoreExports( CoreExtensionEntry.discoverFrom( container.getContainerRealm() ) );
+ }
+ else
+ {
+ this.exports = exports;
+ }
+ }
+
+ public CoreExports get()
+ {
+ return exports;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExtensionEntry.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExtensionEntry.java
new file mode 100644
index 00000000..edadeb2d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/extension/internal/CoreExtensionEntry.java
@@ -0,0 +1,141 @@
+package org.apache.maven.extension.internal;
+
+/*
+ * 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.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.maven.project.ExtensionDescriptor;
+import org.apache.maven.project.ExtensionDescriptorBuilder;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.util.IOUtil;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Provides information about artifacts (identified by groupId:artifactId string key) and classpath elements exported by
+ * Maven core itself or a Maven core extension.
+ *
+ * @since 3.3.0
+ */
+public class CoreExtensionEntry
+{
+ private final ClassRealm realm;
+
+ private final Set<String> artifacts;
+
+ private final Set<String> packages;
+
+ public CoreExtensionEntry( ClassRealm realm, Collection<String> artifacts, Collection<String> packages )
+ {
+ this.realm = realm;
+ this.artifacts = ImmutableSet.copyOf( artifacts );
+ this.packages = ImmutableSet.copyOf( packages );
+ }
+
+ /**
+ * Returns ClassLoader used to load extension classes.
+ */
+ public ClassRealm getClassRealm()
+ {
+ return realm;
+ }
+
+ /**
+ * Returns artifacts exported by the extension, identified by groupId:artifactId string key.
+ */
+ public Set<String> getExportedArtifacts()
+ {
+ return artifacts;
+ }
+
+ /**
+ * Returns classpath elements exported by the extension.
+ */
+ public Set<String> getExportedPackages()
+ {
+ return packages;
+ }
+
+ private static final ExtensionDescriptorBuilder builder = new ExtensionDescriptorBuilder();
+
+ public static CoreExtensionEntry discoverFrom( ClassRealm loader )
+ {
+ Set<String> artifacts = new LinkedHashSet<String>();
+ Set<String> packages = new LinkedHashSet<String>();
+
+ try
+ {
+ Enumeration<URL> urls = loader.getResources( builder.getExtensionDescriptorLocation() );
+ while ( urls.hasMoreElements() )
+ {
+ InputStream is = urls.nextElement().openStream();
+ try
+ {
+ ExtensionDescriptor descriptor = builder.build( is );
+ artifacts.addAll( descriptor.getExportedArtifacts() );
+ packages.addAll( descriptor.getExportedPackages() );
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ }
+ catch ( IOException ignored )
+ {
+ // exports descriptors are entirely optional
+ }
+
+ return new CoreExtensionEntry( loader, artifacts, packages );
+ }
+
+ public static CoreExtensionEntry discoverFrom( ClassRealm loader, Collection<File> classpath )
+ {
+ Set<String> artifacts = new LinkedHashSet<String>();
+ Set<String> packages = new LinkedHashSet<String>();
+
+ try
+ {
+ for ( File entry : classpath )
+ {
+ ExtensionDescriptor descriptor = builder.build( entry );
+ if ( descriptor != null )
+ {
+ artifacts.addAll( descriptor.getExportedArtifacts() );
+ packages.addAll( descriptor.getExportedPackages() );
+ }
+ }
+ }
+ catch ( IOException ignored )
+ {
+ // exports descriptors are entirely optional
+ }
+
+ return new CoreExtensionEntry( loader, artifacts, packages );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
new file mode 100644
index 00000000..c8367463
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultGraphBuilder.java
@@ -0,0 +1,488 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.DefaultMaven;
+import org.apache.maven.MavenExecutionException;
+import org.apache.maven.ProjectCycleException;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.building.DefaultModelProblem;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProblemUtils;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.model.building.UrlModelSource;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+
+import com.google.common.collect.Lists;
+
+@Component( role = GraphBuilder.class, hint = GraphBuilder.HINT )
+public class DefaultGraphBuilder
+ implements GraphBuilder
+{
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ protected ProjectBuilder projectBuilder;
+
+ @Override
+ public Result<ProjectDependencyGraph> build( MavenSession session )
+ {
+ if ( session.getProjectDependencyGraph() != null )
+ {
+ return dependencyGraph( session, session.getProjects(), false );
+ }
+
+ List<MavenProject> projects = session.getProjects();
+
+ if ( projects == null )
+ {
+ try
+ {
+ projects = getProjectsForMavenReactor( session );
+ }
+ catch ( ProjectBuildingException e )
+ {
+ return Result.error( Lists.newArrayList( new DefaultModelProblem( null, null, null, null, 0, 0, e ) ) );
+ }
+
+ validateProjects( projects );
+
+ return dependencyGraph( session, projects, true );
+ }
+ else
+ {
+ return dependencyGraph( session, projects, false );
+ }
+ }
+
+ private Result<ProjectDependencyGraph> dependencyGraph( MavenSession session, List<MavenProject> projects,
+ boolean applyMakeBehaviour )
+ {
+ MavenExecutionRequest request = session.getRequest();
+
+ ProjectDependencyGraph projectDependencyGraph = null;
+
+ try
+ {
+ projectDependencyGraph = new DefaultProjectDependencyGraph( projects );
+
+ if ( applyMakeBehaviour )
+ {
+ List<MavenProject> activeProjects = projectDependencyGraph.getSortedProjects();
+
+ activeProjects = trimSelectedProjects( activeProjects, projectDependencyGraph, request );
+ activeProjects = trimExcludedProjects( activeProjects, request );
+ activeProjects = trimResumedProjects( activeProjects, request );
+
+ if ( activeProjects.size() != projectDependencyGraph.getSortedProjects().size() )
+ {
+ projectDependencyGraph =
+ new FilteredProjectDependencyGraph( projectDependencyGraph, activeProjects );
+ }
+ }
+ }
+ catch ( CycleDetectedException e )
+ {
+ String message = "The projects in the reactor contain a cyclic reference: " + e.getMessage();
+ ProjectCycleException error = new ProjectCycleException( message, e );
+ return Result.error( Lists.newArrayList( new DefaultModelProblem( null, null, null, null, 0, 0, error ) ) );
+ }
+ catch ( org.apache.maven.project.DuplicateProjectException e )
+ {
+ return Result.error( Lists.newArrayList( new DefaultModelProblem( null, null, null, null, 0, 0, e ) ) );
+ }
+ catch ( MavenExecutionException e )
+ {
+ return Result.error( Lists.newArrayList( new DefaultModelProblem( null, null, null, null, 0, 0, e ) ) );
+ }
+
+ session.setProjects( projectDependencyGraph.getSortedProjects() );
+ session.setProjectDependencyGraph( projectDependencyGraph );
+
+ return Result.success( projectDependencyGraph );
+ }
+
+ private List<MavenProject> trimSelectedProjects( List<MavenProject> projects, ProjectDependencyGraph graph,
+ MavenExecutionRequest request )
+ throws MavenExecutionException
+ {
+ List<MavenProject> result = projects;
+
+ if ( !request.getSelectedProjects().isEmpty() )
+ {
+ File reactorDirectory = null;
+ if ( request.getBaseDirectory() != null )
+ {
+ reactorDirectory = new File( request.getBaseDirectory() );
+ }
+
+ Collection<MavenProject> selectedProjects = new LinkedHashSet<MavenProject>( projects.size() );
+
+ for ( String selector : request.getSelectedProjects() )
+ {
+ MavenProject selectedProject = null;
+
+ for ( MavenProject project : projects )
+ {
+ if ( isMatchingProject( project, selector, reactorDirectory ) )
+ {
+ selectedProject = project;
+ break;
+ }
+ }
+
+ if ( selectedProject != null )
+ {
+ selectedProjects.add( selectedProject );
+ }
+ else
+ {
+ throw new MavenExecutionException( "Could not find the selected project in the reactor: "
+ + selector, request.getPom() );
+ }
+ }
+
+ boolean makeUpstream = false;
+ boolean makeDownstream = false;
+
+ if ( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals( request.getMakeBehavior() ) )
+ {
+ makeUpstream = true;
+ }
+ else if ( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals( request.getMakeBehavior() ) )
+ {
+ makeDownstream = true;
+ }
+ else if ( MavenExecutionRequest.REACTOR_MAKE_BOTH.equals( request.getMakeBehavior() ) )
+ {
+ makeUpstream = true;
+ makeDownstream = true;
+ }
+ else if ( StringUtils.isNotEmpty( request.getMakeBehavior() ) )
+ {
+ throw new MavenExecutionException( "Invalid reactor make behavior: " + request.getMakeBehavior(),
+ request.getPom() );
+ }
+
+ if ( makeUpstream || makeDownstream )
+ {
+ for ( MavenProject selectedProject : new ArrayList<MavenProject>( selectedProjects ) )
+ {
+ if ( makeUpstream )
+ {
+ selectedProjects.addAll( graph.getUpstreamProjects( selectedProject, true ) );
+ }
+ if ( makeDownstream )
+ {
+ selectedProjects.addAll( graph.getDownstreamProjects( selectedProject, true ) );
+ }
+ }
+ }
+
+ result = new ArrayList<MavenProject>( selectedProjects.size() );
+
+ for ( MavenProject project : projects )
+ {
+ if ( selectedProjects.contains( project ) )
+ {
+ result.add( project );
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private List<MavenProject> trimExcludedProjects( List<MavenProject> projects, MavenExecutionRequest request )
+ throws MavenExecutionException
+ {
+ List<MavenProject> result = projects;
+
+ if ( !request.getExcludedProjects().isEmpty() )
+ {
+ File reactorDirectory = null;
+
+ if ( request.getBaseDirectory() != null )
+ {
+ reactorDirectory = new File( request.getBaseDirectory() );
+ }
+
+ Collection<MavenProject> excludedProjects = new LinkedHashSet<MavenProject>( projects.size() );
+
+ for ( String selector : request.getExcludedProjects() )
+ {
+ MavenProject excludedProject = null;
+
+ for ( MavenProject project : projects )
+ {
+ if ( isMatchingProject( project, selector, reactorDirectory ) )
+ {
+ excludedProject = project;
+ break;
+ }
+ }
+
+ if ( excludedProject != null )
+ {
+ excludedProjects.add( excludedProject );
+ }
+ else
+ {
+ throw new MavenExecutionException( "Could not find the selected project in the reactor: "
+ + selector, request.getPom() );
+ }
+ }
+
+ result = new ArrayList<MavenProject>( projects.size() );
+ for ( MavenProject project : projects )
+ {
+ if ( !excludedProjects.contains( project ) )
+ {
+ result.add( project );
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private List<MavenProject> trimResumedProjects( List<MavenProject> projects, MavenExecutionRequest request )
+ throws MavenExecutionException
+ {
+ List<MavenProject> result = projects;
+
+ if ( StringUtils.isNotEmpty( request.getResumeFrom() ) )
+ {
+ File reactorDirectory = null;
+ if ( request.getBaseDirectory() != null )
+ {
+ reactorDirectory = new File( request.getBaseDirectory() );
+ }
+
+ String selector = request.getResumeFrom();
+
+ result = new ArrayList<MavenProject>( projects.size() );
+
+ boolean resumed = false;
+
+ for ( MavenProject project : projects )
+ {
+ if ( !resumed && isMatchingProject( project, selector, reactorDirectory ) )
+ {
+ resumed = true;
+ }
+
+ if ( resumed )
+ {
+ result.add( project );
+ }
+ }
+
+ if ( !resumed )
+ {
+ throw new MavenExecutionException( "Could not find project to resume reactor build from: " + selector
+ + " vs " + projects, request.getPom() );
+ }
+ }
+
+ return result;
+ }
+
+ private boolean isMatchingProject( MavenProject project, String selector, File reactorDirectory )
+ {
+ // [groupId]:artifactId
+ if ( selector.indexOf( ':' ) >= 0 )
+ {
+ String id = ':' + project.getArtifactId();
+
+ if ( id.equals( selector ) )
+ {
+ return true;
+ }
+
+ id = project.getGroupId() + id;
+
+ if ( id.equals( selector ) )
+ {
+ return true;
+ }
+ }
+
+ // relative path, e.g. "sub", "../sub" or "."
+ else if ( reactorDirectory != null )
+ {
+ File selectedProject = new File( new File( reactorDirectory, selector ).toURI().normalize() );
+
+ if ( selectedProject.isFile() )
+ {
+ return selectedProject.equals( project.getFile() );
+ }
+ else if ( selectedProject.isDirectory() )
+ {
+ return selectedProject.equals( project.getBasedir() );
+ }
+ }
+
+ return false;
+ }
+
+ private MavenExecutionResult addExceptionToResult( MavenExecutionResult result, Throwable e )
+ {
+ if ( !result.getExceptions().contains( e ) )
+ {
+ result.addException( e );
+ }
+
+ return result;
+ }
+
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Project collection
+ //
+ // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ private List<MavenProject> getProjectsForMavenReactor( MavenSession session )
+ throws ProjectBuildingException
+ {
+ MavenExecutionRequest request = session.getRequest();
+
+ request.getProjectBuildingRequest().setRepositorySession( session.getRepositorySession() );
+
+ List<MavenProject> projects = new ArrayList<MavenProject>();
+
+ // We have no POM file.
+ //
+ if ( request.getPom() == null )
+ {
+ ModelSource modelSource = new UrlModelSource( DefaultMaven.class.getResource( "project/standalone.xml" ) );
+ MavenProject project = projectBuilder.build( modelSource, request.getProjectBuildingRequest() )
+ .getProject();
+ project.setExecutionRoot( true );
+ projects.add( project );
+ request.setProjectPresent( false );
+ return projects;
+ }
+
+ List<File> files = Arrays.asList( request.getPom().getAbsoluteFile() );
+ collectProjects( projects, files, request );
+ return projects;
+ }
+
+ private void collectProjects( List<MavenProject> projects, List<File> files, MavenExecutionRequest request )
+ throws ProjectBuildingException
+ {
+ ProjectBuildingRequest projectBuildingRequest = request.getProjectBuildingRequest();
+
+ List<ProjectBuildingResult> results = projectBuilder.build( files, request.isRecursive(),
+ projectBuildingRequest );
+
+ boolean problems = false;
+
+ for ( ProjectBuildingResult result : results )
+ {
+ projects.add( result.getProject() );
+
+ if ( !result.getProblems().isEmpty() && logger.isWarnEnabled() )
+ {
+ logger.warn( "" );
+ logger.warn( "Some problems were encountered while building the effective model for "
+ + result.getProject().getId() );
+
+ for ( ModelProblem problem : result.getProblems() )
+ {
+ String loc = ModelProblemUtils.formatLocation( problem, result.getProjectId() );
+ logger.warn( problem.getMessage() + ( StringUtils.isNotEmpty( loc ) ? " @ " + loc : "" ) );
+ }
+
+ problems = true;
+ }
+ }
+
+ if ( problems )
+ {
+ logger.warn( "" );
+ logger.warn( "It is highly recommended to fix these problems"
+ + " because they threaten the stability of your build." );
+ logger.warn( "" );
+ logger.warn( "For this reason, future Maven versions might no"
+ + " longer support building such malformed projects." );
+ logger.warn( "" );
+ }
+ }
+
+ private void validateProjects( List<MavenProject> projects )
+ {
+ Map<String, MavenProject> projectsMap = new HashMap<String, MavenProject>();
+
+ for ( MavenProject p : projects )
+ {
+ String projectKey = ArtifactUtils.key( p.getGroupId(), p.getArtifactId(), p.getVersion() );
+
+ projectsMap.put( projectKey, p );
+ }
+
+ for ( MavenProject project : projects )
+ {
+ // MNG-1911 / MNG-5572: Building plugins with extensions cannot be part of reactor
+ for ( Plugin plugin : project.getBuildPlugins() )
+ {
+ if ( plugin.isExtensions() )
+ {
+ String pluginKey = ArtifactUtils.key( plugin.getGroupId(), plugin.getArtifactId(),
+ plugin.getVersion() );
+
+ if ( projectsMap.containsKey( pluginKey ) )
+ {
+ logger.warn( project.getName() + " uses " + plugin.getKey()
+ + " as extensions, which is not possible within the same reactor build. "
+ + "This plugin was pulled from the local repository!" );
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java
new file mode 100644
index 00000000..01fec339
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/DefaultProjectDependencyGraph.java
@@ -0,0 +1,134 @@
+package org.apache.maven.graph;
+
+/*
+ * 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 java.util.Set;
+
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectSorter;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+
+/**
+ * Describes the inter-dependencies between projects in the reactor.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultProjectDependencyGraph
+ implements ProjectDependencyGraph
+{
+
+ private ProjectSorter sorter;
+
+ /**
+ * Creates a new project dependency graph based on the specified projects.
+ *
+ * @param projects The projects to create the dependency graph with
+ * @throws DuplicateProjectException
+ * @throws CycleDetectedException
+ */
+ public DefaultProjectDependencyGraph( Collection<MavenProject> projects )
+ throws CycleDetectedException, DuplicateProjectException
+ {
+ this.sorter = new ProjectSorter( projects );
+ }
+
+ public List<MavenProject> getSortedProjects()
+ {
+ return new ArrayList<MavenProject>( sorter.getSortedProjects() );
+ }
+
+ public List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive )
+ {
+ if ( project == null )
+ {
+ throw new IllegalArgumentException( "project missing" );
+ }
+
+ Set<String> projectIds = new HashSet<String>();
+
+ getDownstreamProjects( ProjectSorter.getId( project ), projectIds, transitive );
+
+ return getSortedProjects( projectIds );
+ }
+
+ private void getDownstreamProjects( String projectId, Set<String> projectIds, boolean transitive )
+ {
+ for ( String id : sorter.getDependents( projectId ) )
+ {
+ if ( projectIds.add( id ) && transitive )
+ {
+ getDownstreamProjects( id, projectIds, transitive );
+ }
+ }
+ }
+
+ public List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive )
+ {
+ if ( project == null )
+ {
+ throw new IllegalArgumentException( "project missing" );
+ }
+
+ Set<String> projectIds = new HashSet<String>();
+
+ getUpstreamProjects( ProjectSorter.getId( project ), projectIds, transitive );
+
+ return getSortedProjects( projectIds );
+ }
+
+ private void getUpstreamProjects( String projectId, Collection<String> projectIds, boolean transitive )
+ {
+ for ( String id : sorter.getDependencies( projectId ) )
+ {
+ if ( projectIds.add( id ) && transitive )
+ {
+ getUpstreamProjects( id, projectIds, transitive );
+ }
+ }
+ }
+
+ private List<MavenProject> getSortedProjects( Set<String> projectIds )
+ {
+ List<MavenProject> result = new ArrayList<MavenProject>( projectIds.size() );
+
+ for ( MavenProject mavenProject : sorter.getSortedProjects() )
+ {
+ if ( projectIds.contains( ProjectSorter.getId( mavenProject ) ) )
+ {
+ result.add( mavenProject );
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public String toString()
+ {
+ return sorter.getSortedProjects().toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
new file mode 100644
index 00000000..662bda47
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/FilteredProjectDependencyGraph.java
@@ -0,0 +1,111 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Provides a sub view of another dependency graph.
+ *
+ * @author Benjamin Bentmann
+ */
+class FilteredProjectDependencyGraph
+ implements ProjectDependencyGraph
+{
+
+ private ProjectDependencyGraph projectDependencyGraph;
+
+ private Map<MavenProject, ?> whiteList;
+
+ private List<MavenProject> sortedProjects;
+
+ /**
+ * Creates a new project dependency graph from the specified graph.
+ *
+ * @param projectDependencyGraph The project dependency graph to create a sub view from, must not be {@code null}.
+ * @param whiteList The projects on which the dependency view should focus, must not be {@code null}.
+ */
+ public FilteredProjectDependencyGraph( ProjectDependencyGraph projectDependencyGraph,
+ Collection<? extends MavenProject> whiteList )
+ {
+ if ( projectDependencyGraph == null )
+ {
+ throw new IllegalArgumentException( "project dependency graph missing" );
+ }
+
+ this.projectDependencyGraph = projectDependencyGraph;
+
+ this.whiteList = new IdentityHashMap<MavenProject, Object>();
+
+ for ( MavenProject project : whiteList )
+ {
+ this.whiteList.put( project, null );
+ }
+ }
+
+ public List<MavenProject> getSortedProjects()
+ {
+ if ( sortedProjects == null )
+ {
+ sortedProjects = applyFilter( projectDependencyGraph.getSortedProjects() );
+ }
+
+ return new ArrayList<MavenProject>( sortedProjects );
+ }
+
+ public List<MavenProject> getDownstreamProjects( MavenProject project, boolean transitive )
+ {
+ return applyFilter( projectDependencyGraph.getDownstreamProjects( project, transitive ) );
+ }
+
+ public List<MavenProject> getUpstreamProjects( MavenProject project, boolean transitive )
+ {
+ return applyFilter( projectDependencyGraph.getUpstreamProjects( project, transitive ) );
+ }
+
+ private List<MavenProject> applyFilter( Collection<? extends MavenProject> projects )
+ {
+ List<MavenProject> filtered = new ArrayList<MavenProject>( projects.size() );
+
+ for ( MavenProject project : projects )
+ {
+ if ( whiteList.containsKey( project ) )
+ {
+ filtered.add( project );
+ }
+ }
+
+ return filtered;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getSortedProjects().toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/GraphBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/GraphBuilder.java
new file mode 100644
index 00000000..fb7c4f2a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/graph/GraphBuilder.java
@@ -0,0 +1,31 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.building.Result;
+
+public interface GraphBuilder
+{
+ String HINT = "graphBuilder";
+
+ Result<? extends ProjectDependencyGraph> build( MavenSession session );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
new file mode 100644
index 00000000..26a8ddae
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
@@ -0,0 +1,271 @@
+package org.apache.maven.internal.aether;
+
+/*
+ * 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.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.bridge.MavenRepositorySystem;
+import org.apache.maven.eventspy.internal.EventSpyDispatcher;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Proxy;
+import org.apache.maven.settings.Server;
+import org.apache.maven.settings.building.SettingsProblem;
+import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest;
+import org.apache.maven.settings.crypto.SettingsDecrypter;
+import org.apache.maven.settings.crypto.SettingsDecryptionResult;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.aether.ConfigurationProperties;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.NoLocalRepositoryManagerException;
+import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.resolution.ResolutionErrorPolicy;
+import org.eclipse.aether.spi.localrepo.LocalRepositoryManagerFactory;
+import org.eclipse.aether.util.repository.AuthenticationBuilder;
+import org.eclipse.aether.util.repository.DefaultAuthenticationSelector;
+import org.eclipse.aether.util.repository.DefaultMirrorSelector;
+import org.eclipse.aether.util.repository.DefaultProxySelector;
+import org.eclipse.aether.util.repository.SimpleResolutionErrorPolicy;
+import org.eclipse.sisu.Nullable;
+
+/**
+ * @since 3.3.0
+ */
+@Named
+public class DefaultRepositorySystemSessionFactory
+{
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private ArtifactHandlerManager artifactHandlerManager;
+
+ @Inject
+ private RepositorySystem repoSystem;
+
+ @Inject
+ @Nullable
+ @Named( "simple" )
+ private LocalRepositoryManagerFactory simpleLocalRepoMgrFactory;
+
+ @Inject
+ @Nullable
+ @Named( "ide" )
+ private WorkspaceReader workspaceRepository;
+
+ @Inject
+ private SettingsDecrypter settingsDecrypter;
+
+ @Inject
+ private EventSpyDispatcher eventSpyDispatcher;
+
+ @Inject
+ MavenRepositorySystem mavenRepositorySystem;
+
+ public DefaultRepositorySystemSession newRepositorySession( MavenExecutionRequest request )
+ {
+ DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
+
+ session.setCache( request.getRepositoryCache() );
+
+ Map<Object, Object> configProps = new LinkedHashMap<Object, Object>();
+ configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
+ configProps.put( ConfigurationProperties.INTERACTIVE, request.isInteractiveMode() );
+ configProps.putAll( request.getSystemProperties() );
+ configProps.putAll( request.getUserProperties() );
+
+ session.setOffline( request.isOffline() );
+ session.setChecksumPolicy( request.getGlobalChecksumPolicy() );
+ if ( request.isNoSnapshotUpdates() )
+ {
+ session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_NEVER );
+ }
+ else if ( request.isUpdateSnapshots() )
+ {
+ session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_ALWAYS );
+ }
+ else
+ {
+ session.setUpdatePolicy( null );
+ }
+
+ int errorPolicy = 0;
+ errorPolicy |= request.isCacheNotFound() ? ResolutionErrorPolicy.CACHE_NOT_FOUND : 0;
+ errorPolicy |= request.isCacheTransferError() ? ResolutionErrorPolicy.CACHE_TRANSFER_ERROR : 0;
+ session.setResolutionErrorPolicy( new SimpleResolutionErrorPolicy( errorPolicy, errorPolicy
+ | ResolutionErrorPolicy.CACHE_NOT_FOUND ) );
+
+ session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
+
+ LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
+
+ if ( request.isUseLegacyLocalRepository() )
+ {
+ logger.warn( "Disabling enhanced local repository: using legacy is strongly discouraged to ensure"
+ + " build reproducibility." );
+ try
+ {
+ session.setLocalRepositoryManager( simpleLocalRepoMgrFactory.newInstance( session, localRepo ) );
+ }
+ catch ( NoLocalRepositoryManagerException e )
+ {
+
+ logger.warn( "Failed to configure legacy local repository: back to default" );
+ session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
+ }
+ }
+ else
+ {
+ session.setLocalRepositoryManager( repoSystem.newLocalRepositoryManager( session, localRepo ) );
+ }
+
+ if ( request.getWorkspaceReader() != null )
+ {
+ session.setWorkspaceReader( request.getWorkspaceReader() );
+ }
+ else
+ {
+ session.setWorkspaceReader( workspaceRepository );
+ }
+
+ DefaultSettingsDecryptionRequest decrypt = new DefaultSettingsDecryptionRequest();
+ decrypt.setProxies( request.getProxies() );
+ decrypt.setServers( request.getServers() );
+ SettingsDecryptionResult decrypted = settingsDecrypter.decrypt( decrypt );
+
+ if ( logger.isDebugEnabled() )
+ {
+ for ( SettingsProblem problem : decrypted.getProblems() )
+ {
+ logger.debug( problem.getMessage(), problem.getException() );
+ }
+ }
+
+ DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
+ for ( Mirror mirror : request.getMirrors() )
+ {
+ mirrorSelector.add( mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
+ mirror.getMirrorOfLayouts() );
+ }
+ session.setMirrorSelector( mirrorSelector );
+
+ DefaultProxySelector proxySelector = new DefaultProxySelector();
+ for ( Proxy proxy : decrypted.getProxies() )
+ {
+ AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+ authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() );
+ proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(),
+ proxy.getPort(), authBuilder.build() ),
+ proxy.getNonProxyHosts() );
+ }
+ session.setProxySelector( proxySelector );
+
+ DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
+ for ( Server server : decrypted.getServers() )
+ {
+ AuthenticationBuilder authBuilder = new AuthenticationBuilder();
+ authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() );
+ authBuilder.addPrivateKey( server.getPrivateKey(), server.getPassphrase() );
+ authSelector.add( server.getId(), authBuilder.build() );
+
+ if ( server.getConfiguration() != null )
+ {
+ Xpp3Dom dom = (Xpp3Dom) server.getConfiguration();
+ for ( int i = dom.getChildCount() - 1; i >= 0; i-- )
+ {
+ Xpp3Dom child = dom.getChild( i );
+ if ( "wagonProvider".equals( child.getName() ) )
+ {
+ dom.removeChild( i );
+ }
+ }
+
+ XmlPlexusConfiguration config = new XmlPlexusConfiguration( dom );
+ configProps.put( "aether.connector.wagon.config." + server.getId(), config );
+ }
+
+ configProps.put( "aether.connector.perms.fileMode." + server.getId(), server.getFilePermissions() );
+ configProps.put( "aether.connector.perms.dirMode." + server.getId(), server.getDirectoryPermissions() );
+ }
+ session.setAuthenticationSelector( authSelector );
+
+ session.setTransferListener( request.getTransferListener() );
+
+ session.setRepositoryListener( eventSpyDispatcher.chainListener( new LoggingRepositoryListener( logger ) ) );
+
+ session.setUserProperties( request.getUserProperties() );
+ session.setSystemProperties( request.getSystemProperties() );
+ session.setConfigProperties( configProps );
+
+ mavenRepositorySystem.injectMirror( request.getRemoteRepositories(), request.getMirrors() );
+ mavenRepositorySystem.injectProxy( session, request.getRemoteRepositories() );
+ mavenRepositorySystem.injectAuthentication( session, request.getRemoteRepositories() );
+
+ mavenRepositorySystem.injectMirror( request.getPluginArtifactRepositories(), request.getMirrors() );
+ mavenRepositorySystem.injectProxy( session, request.getPluginArtifactRepositories() );
+ mavenRepositorySystem.injectAuthentication( session, request.getPluginArtifactRepositories() );
+
+ return session;
+ }
+
+ private String getUserAgent()
+ {
+ return "Apache-Maven/" + getMavenVersion() + " (Java " + System.getProperty( "java.version" ) + "; "
+ + System.getProperty( "os.name" ) + " " + System.getProperty( "os.version" ) + ")";
+ }
+
+ private String getMavenVersion()
+ {
+ Properties props = new Properties();
+
+ InputStream is = getClass().getResourceAsStream( "/META-INF/maven/org.apache.maven/maven-core/pom.properties" );
+ if ( is != null )
+ {
+ try
+ {
+ props.load( is );
+ }
+ catch ( IOException e )
+ {
+ logger.debug( "Failed to read Maven version", e );
+ }
+ IOUtil.close( is );
+ }
+
+ return props.getProperty( "version", "unknown-version" );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java
new file mode 100644
index 00000000..7b67c3bd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/internal/aether/LoggingRepositoryListener.java
@@ -0,0 +1,141 @@
+package org.apache.maven.internal.aether;
+
+/*
+ * 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.FileNotFoundException;
+
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.AbstractRepositoryListener;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.transfer.MetadataNotFoundException;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class LoggingRepositoryListener
+ extends AbstractRepositoryListener
+{
+
+ private final Logger logger;
+
+ public LoggingRepositoryListener( Logger logger )
+ {
+ this.logger = logger;
+ }
+
+ @Override
+ public void artifactInstalling( RepositoryEvent event )
+ {
+ logger.info( "Installing " + event.getArtifact().getFile() + " to " + event.getFile() );
+ }
+
+ @Override
+ public void metadataInstalling( RepositoryEvent event )
+ {
+ logger.debug( "Installing " + event.getMetadata() + " to " + event.getFile() );
+ }
+
+ @Override
+ public void metadataResolved( RepositoryEvent event )
+ {
+ Exception e = event.getException();
+ if ( e != null )
+ {
+ if ( e instanceof MetadataNotFoundException )
+ {
+ logger.debug( e.getMessage() );
+ }
+ else if ( logger.isDebugEnabled() )
+ {
+ logger.warn( e.getMessage(), e );
+ }
+ else
+ {
+ logger.warn( e.getMessage() );
+ }
+ }
+ }
+
+ @Override
+ public void metadataInvalid( RepositoryEvent event )
+ {
+ Exception exception = event.getException();
+
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( "The metadata " );
+ if ( event.getMetadata().getFile() != null )
+ {
+ buffer.append( event.getMetadata().getFile() );
+ }
+ else
+ {
+ buffer.append( event.getMetadata() );
+ }
+
+ if ( exception instanceof FileNotFoundException )
+ {
+ buffer.append( " is inaccessible" );
+ }
+ else
+ {
+ buffer.append( " is invalid" );
+ }
+
+ if ( exception != null )
+ {
+ buffer.append( ": " );
+ buffer.append( exception.getMessage() );
+ }
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.warn( buffer.toString(), exception );
+ }
+ else
+ {
+ logger.warn( buffer.toString() );
+ }
+ }
+
+ @Override
+ public void artifactDescriptorInvalid( RepositoryEvent event )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( "The POM for " );
+ buffer.append( event.getArtifact() );
+ buffer.append( " is invalid, transitive dependencies (if any) will not be available" );
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.warn( buffer + ": " + event.getException().getMessage() );
+ }
+ else
+ {
+ logger.warn( buffer + ", enable debug logging for more details" );
+ }
+ }
+
+ @Override
+ public void artifactDescriptorMissing( RepositoryEvent event )
+ {
+ logger.warn( "The POM for " + event.getArtifact() + " is missing, no dependency information available" );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
new file mode 100644
index 00000000..6f994b3d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
@@ -0,0 +1,177 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
+import org.apache.maven.lifecycle.internal.LifecycleStarter;
+import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
+import org.apache.maven.lifecycle.internal.MojoDescriptorCreator;
+import org.apache.maven.lifecycle.internal.MojoExecutor;
+import org.apache.maven.lifecycle.internal.ProjectIndex;
+import org.apache.maven.lifecycle.internal.TaskSegment;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A facade that provides lifecycle services to components outside maven core.
+ *
+ * Note that this component is not normally used from within core itself.
+ *
+ * @author Jason van Zyl
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold
+ */
+@Component( role = LifecycleExecutor.class )
+public class DefaultLifecycleExecutor
+ implements LifecycleExecutor
+{
+
+ @Requirement
+ private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
+
+ @Requirement
+ private DefaultLifecycles defaultLifeCycles;
+
+ @Requirement
+ private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
+
+ @Requirement
+ private LifecycleExecutionPlanCalculator lifecycleExecutionPlanCalculator;
+
+ @Requirement
+ private MojoExecutor mojoExecutor;
+
+ @Requirement
+ private LifecycleStarter lifecycleStarter;
+
+
+ public void execute( MavenSession session )
+ {
+ lifecycleStarter.execute( session );
+ }
+
+ @Requirement
+ private MojoDescriptorCreator mojoDescriptorCreator;
+
+ // These methods deal with construction intact Plugin object that look like they come from a standard
+ // <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information
+ // together and this really shows the problem of constructing a sensible default configuration but
+ // it's all encapsulated here so it appears normalized to the POM builder.
+
+ // We are going to take the project packaging and find all plugin in the default lifecycle and create
+ // fully populated Plugin objects, including executions with goals and default configuration taken
+ // from the plugin.xml inside a plugin.
+ //
+ // TODO: This whole method could probably removed by injecting lifeCyclePluginAnalyzer straight into client site.
+ // TODO: But for some reason the whole plexus appcontext refuses to start when I try this.
+
+ public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
+ {
+ return lifeCyclePluginAnalyzer.getPluginsBoundByDefaultToAllLifecycles( packaging );
+ }
+
+ // USED BY MAVEN HELP PLUGIN
+
+ @Deprecated
+ public Map<String, Lifecycle> getPhaseToLifecycleMap()
+ {
+ return defaultLifeCycles.getPhaseToLifecycleMap();
+ }
+
+ // NOTE: Backward-compat with maven-help-plugin:2.1
+
+ @SuppressWarnings( { "UnusedDeclaration" } )
+ MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project, String invokedVia,
+ boolean canUsePrefix, boolean isOptionalMojo )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException
+ {
+ return mojoDescriptorCreator.getMojoDescriptor( task, session, project );
+ }
+
+ // Used by m2eclipse
+
+ @SuppressWarnings( { "UnusedDeclaration" } )
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+ PluginVersionResolutionException
+ {
+ List<TaskSegment> taskSegments =
+ lifecycleTaskSegmentCalculator.calculateTaskSegments( session, Arrays.asList( tasks ) );
+
+ TaskSegment mergedSegment = new TaskSegment( false );
+
+ for ( TaskSegment taskSegment : taskSegments )
+ {
+ mergedSegment.getTasks().addAll( taskSegment.getTasks() );
+ }
+
+ return lifecycleExecutionPlanCalculator.calculateExecutionPlan( session, session.getCurrentProject(),
+ mergedSegment.getTasks(), setup );
+ }
+
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+ PluginVersionResolutionException
+ {
+ return calculateExecutionPlan( session, true, tasks );
+ }
+
+ // Site 3.x
+ public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ lifecycleExecutionPlanCalculator.calculateForkedExecutions( mojoExecution, session );
+ }
+
+ // Site 3.x
+ public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws LifecycleExecutionException
+ {
+ return mojoExecutor.executeForkedExecutions( mojoExecution, session,
+ new ProjectIndex( session.getProjects() ) );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java
new file mode 100644
index 00000000..64c9a7f9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java
@@ -0,0 +1,144 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+
+import com.google.common.base.Preconditions;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @since 3.0
+ * @author Jason van Zyl
+ * @author Kristian Rosenvold
+ */
+// TODO: The configuration for the lifecycle needs to be externalized so that I can use the annotations properly for the
+// wiring and reference and external source for the lifecycle configuration.
+@Component( role = DefaultLifecycles.class )
+public class DefaultLifecycles
+{
+ public static final String[] STANDARD_LIFECYCLES = { "default", "clean", "site" };
+
+ // @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml")
+
+ @Requirement( role = Lifecycle.class )
+ private Map<String, Lifecycle> lifecycles;
+
+ @Requirement
+ private Logger logger;
+
+ public DefaultLifecycles()
+ {
+ }
+
+ public DefaultLifecycles( Map<String, Lifecycle> lifecycles, Logger logger )
+ {
+ this.lifecycles = new LinkedHashMap<String, Lifecycle>();
+ this.logger = logger;
+ this.lifecycles = lifecycles;
+ }
+
+ public Lifecycle get( String key )
+ {
+ return getPhaseToLifecycleMap().get( key );
+ }
+
+ /**
+ * We use this to map all phases to the lifecycle that contains it. This is used so that a user can specify the
+ * phase they want to execute and we can easily determine what lifecycle we need to run.
+ *
+ * @return A map of lifecycles, indexed on id
+ */
+ public Map<String, Lifecycle> getPhaseToLifecycleMap()
+ {
+ // If people are going to make their own lifecycles then we need to tell people how to namespace them correctly
+ // so that they don't interfere with internally defined lifecycles.
+
+ HashMap<String, Lifecycle> phaseToLifecycleMap = new HashMap<String, Lifecycle>();
+
+ for ( Lifecycle lifecycle : getLifeCycles() )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Lifecycle " + lifecycle );
+ }
+
+ for ( String phase : lifecycle.getPhases() )
+ {
+ // The first definition wins.
+ if ( !phaseToLifecycleMap.containsKey( phase ) )
+ {
+ phaseToLifecycleMap.put( phase, lifecycle );
+ }
+ else
+ {
+ Lifecycle original = phaseToLifecycleMap.get( phase );
+ logger.warn( "Duplicated lifecycle phase " + phase + ". Defined in " + original.getId()
+ + " but also in " + lifecycle.getId() );
+ }
+ }
+ }
+
+ return phaseToLifecycleMap;
+ }
+
+ public List<Lifecycle> getLifeCycles()
+ {
+ // ensure canonical order of standard lifecycles
+ Map<String, Lifecycle> lifecycles = new LinkedHashMap<String, Lifecycle>( this.lifecycles );
+
+ LinkedHashSet<String> lifecycleNames = new LinkedHashSet<String>( Arrays.asList( STANDARD_LIFECYCLES ) );
+ lifecycleNames.addAll( lifecycles.keySet() );
+
+ ArrayList<Lifecycle> result = new ArrayList<Lifecycle>();
+ for ( String name : lifecycleNames )
+ {
+ Lifecycle lifecycle = lifecycles.get( name );
+ Preconditions.checkNotNull( "A lifecycle must have an id.", lifecycle.getId() );
+ result.add( lifecycle );
+ }
+
+ return result;
+ }
+
+ public String getLifecyclePhaseList()
+ {
+ Set<String> phases = new LinkedHashSet<String>();
+
+ for ( Lifecycle lifecycle : getLifeCycles() )
+ {
+ phases.addAll( lifecycle.getPhases() );
+ }
+
+ return StringUtils.join( phases.iterator(), ", " );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java
new file mode 100644
index 00000000..ed07c1d5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifeCyclePluginAnalyzer.java
@@ -0,0 +1,32 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.Set;
+import org.apache.maven.model.Plugin;
+
+/**
+ * @since 3.0
+ * @author Kristian Rosenvold
+ */
+public interface LifeCyclePluginAnalyzer
+{
+ Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
new file mode 100644
index 00000000..fcfde951
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
@@ -0,0 +1,80 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 java.util.Map;
+
+/**
+ * Class Lifecycle.
+ */
+public class Lifecycle
+{
+ public Lifecycle()
+ {
+ }
+
+ public Lifecycle( String id, List<String> phases, Map<String, String> defaultPhases )
+ {
+ this.id = id;
+ this.phases = phases;
+ this.defaultPhases = defaultPhases;
+ }
+
+ // <lifecycle>
+ // <id>clean</id>
+ // <phases>
+ // <phase>pre-clean</phase>
+ // <phase>clean</phase>
+ // <phase>post-clean</phase>
+ // </phases>
+ // <default-phases>
+ // <clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
+ // </default-phases>
+ // </lifecycle>
+
+ private String id;
+
+ private List<String> phases;
+
+ private Map<String, String> defaultPhases;
+
+ public String getId()
+ {
+ return this.id;
+ }
+
+ public List<String> getPhases()
+ {
+ return this.phases;
+ }
+
+ public Map<String, String> getDefaultPhases()
+ {
+ return defaultPhases;
+ }
+
+ @Override
+ public String toString()
+ {
+ return id + " -> " + phases;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
new file mode 100644
index 00000000..349576cd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
@@ -0,0 +1,111 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ */
+public class LifecycleExecutionException
+ extends Exception
+{
+ private MavenProject project;
+
+ public LifecycleExecutionException( String message )
+ {
+ super( message );
+ }
+
+ public LifecycleExecutionException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public LifecycleExecutionException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public LifecycleExecutionException( String message, MavenProject project )
+ {
+ super( message );
+ this.project = project;
+ }
+
+ public LifecycleExecutionException( String message, MojoExecution execution, MavenProject project )
+ {
+ super( message );
+ this.project = project;
+ }
+
+ public LifecycleExecutionException( String message, MojoExecution execution, MavenProject project, Throwable cause )
+ {
+ super( message, cause );
+ this.project = project;
+ }
+
+ public LifecycleExecutionException( MojoExecution execution, MavenProject project, Throwable cause )
+ {
+ this( createMessage( execution, project, cause ), execution, project, cause );
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ private static String createMessage( MojoExecution execution, MavenProject project, Throwable cause )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+
+ buffer.append( "Failed to execute goal" );
+
+ if ( execution != null )
+ {
+ buffer.append( ' ' );
+ buffer.append( execution.getGroupId() );
+ buffer.append( ':' );
+ buffer.append( execution.getArtifactId() );
+ buffer.append( ':' );
+ buffer.append( execution.getVersion() );
+ buffer.append( ':' );
+ buffer.append( execution.getGoal() );
+ buffer.append( " (" );
+ buffer.append( execution.getExecutionId() );
+ buffer.append( ")" );
+ }
+
+ if ( project != null )
+ {
+ buffer.append( " on project " );
+ buffer.append( project.getArtifactId() );
+ }
+
+ if ( cause != null )
+ {
+ buffer.append( ": " ).append( cause.getMessage() );
+ }
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
new file mode 100644
index 00000000..04c602cf
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
@@ -0,0 +1,89 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A facade that provides lifecycle services to components outside Maven core.
+ *
+ * @author Jason van Zyl
+ */
+public interface LifecycleExecutor
+{
+
+ // USED BY MAVEN HELP PLUGIN
+ @Deprecated
+ String ROLE = LifecycleExecutor.class.getName();
+
+ // For a given project packaging find all the plugins that are bound to any registered
+ // lifecycles. The project builder needs to now what default plugin information needs to be
+ // merged into POM being built. Once the POM builder has this plugin information, versions can be assigned
+ // by the POM builder because they will have to be defined in plugin management. Once this is setComplete then it
+ // can be passed back so that the default configuration information can be populated.
+ //
+ // We need to know the specific version so that we can lookup the right version of the plugin descriptor
+ // which tells us what the default configuration is.
+ //
+
+ /**
+ * @return The plugins bound to the lifecycles of the specified packaging or {@code null} if the packaging is
+ * unknown.
+ */
+ Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging );
+
+ MavenExecutionPlan calculateExecutionPlan( MavenSession session, String... tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+ PluginVersionResolutionException;
+
+ MavenExecutionPlan calculateExecutionPlan( MavenSession session, boolean setup, String... tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginManagerException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
+ PluginVersionResolutionException;
+
+ void execute( MavenSession session );
+
+ // used by the site plugin 3.x
+ void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
+
+ // used by the site plugin 3.x
+ List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws LifecycleExecutionException;
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMappingDelegate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMappingDelegate.java
new file mode 100644
index 00000000..f0701987
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMappingDelegate.java
@@ -0,0 +1,52 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 java.util.Map;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Lifecycle mapping delegate component interface. Calculates project build execution plan given {@link Lifecycle} and
+ * lifecycle phase. Standard lifecycles use plugin execution {@code <phase>} or mojo default lifecycle phase to
+ * calculate the execution plan, but custom lifecycles can use alternative mapping strategies.
+ * <p>
+ * Implementations of this interface must be annotated with either {@code @Named("lifecycle-id")} or equivalent plexus
+ * {@code @Component} annotations.
+ *
+ * @since 3.2.0
+ * @see org.apache.maven.lifecycle.internal.DefaultLifecycleMappingDelegate
+ * @author ifedorenko
+ */
+public interface LifecycleMappingDelegate
+{
+ Map<String, List<MojoExecution>> calculateLifecycleMappings( MavenSession session, MavenProject project,
+ Lifecycle lifecycle, String lifecyclePhase )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException;
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleNotFoundException.java
new file mode 100644
index 00000000..e9ff0c20
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleNotFoundException.java
@@ -0,0 +1,54 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 a failure to locate a lifecycle.
+ *
+ * @author Benjamin Bentmann
+ */
+public class LifecycleNotFoundException
+ extends Exception
+{
+
+ private final String lifecycleId;
+
+ /**
+ * Creates a new exception to indicate that the specified lifecycle is unknown.
+ *
+ * @param lifecycleId The identifier of the lifecycle that could not be located, may be {@code null}.
+ */
+ public LifecycleNotFoundException( String lifecycleId )
+ {
+ super( "Unknown lifecycle " + lifecycleId );
+ this.lifecycleId = ( lifecycleId != null ) ? lifecycleId : "";
+ }
+
+ /**
+ * Gets the identifier of the lifecycle that was not found.
+ *
+ * @return The identifier of the lifecycle that was not found, never {@code null}.
+ */
+ public String getLifecycleId()
+ {
+ return lifecycleId;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecyclePhaseNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecyclePhaseNotFoundException.java
new file mode 100644
index 00000000..fab1d2f2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/LifecyclePhaseNotFoundException.java
@@ -0,0 +1,55 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 a failure to locate the lifecycle for some phase.
+ *
+ * @author Benjamin Bentmann
+ */
+public class LifecyclePhaseNotFoundException
+ extends Exception
+{
+
+ private final String lifecyclePhase;
+
+ /**
+ * Creates a new exception to indicate that the specified lifecycle phase is not defined by any known lifecycle.
+ *
+ * @param message The detail message, may be {@code null}.
+ * @param lifecyclePhase The name of the lifecycle phase that could not be located, may be {@code null}.
+ */
+ public LifecyclePhaseNotFoundException( String message, String lifecyclePhase )
+ {
+ super( message );
+ this.lifecyclePhase = ( lifecyclePhase != null ) ? lifecyclePhase : "";
+ }
+
+ /**
+ * Gets the lifecycle phase that was not found.
+ *
+ * @return The lifecycle phase that was not found, never {@code null}.
+ */
+ public String getLifecyclePhase()
+ {
+ return lifecyclePhase;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java
new file mode 100644
index 00000000..7767ea25
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MavenExecutionPlan.java
@@ -0,0 +1,202 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+
+//TODO: lifecycles being executed
+//TODO: what runs in each phase
+//TODO: plugins that need downloading
+//TODO: project dependencies that need downloading
+//TODO: unfortunately the plugins need to be downloaded in order to get the plugin.xml file. need to externalize this
+// from the plugin archive.
+//TODO: this will be the class that people get in IDEs to modify
+
+public class MavenExecutionPlan
+ implements Iterable<ExecutionPlanItem>
+{
+
+ /*
+ At the moment, this class is totally immutable, and this is in line with thoughts about the
+ pre-calculated execution plan that stays the same during the execution.
+
+ If deciding to add mutable state to this class, it should be at least considered to
+ separate this into a separate mutable structure.
+
+ */
+
+ private final List<ExecutionPlanItem> planItem;
+
+ private final Map<String, ExecutionPlanItem> lastMojoExecutionForAllPhases;
+
+ final List<String> phasesInExecutionPlan;
+
+ public MavenExecutionPlan( List<ExecutionPlanItem> planItem, DefaultLifecycles defaultLifecycles )
+ {
+ this.planItem = planItem;
+
+ lastMojoExecutionForAllPhases = new LinkedHashMap<String, ExecutionPlanItem>();
+
+ LinkedHashSet<String> totalPhaseSet = new LinkedHashSet<String>();
+ if ( defaultLifecycles != null )
+ {
+ for ( String phase : getDistinctPhasesInOrderOfExecutionPlanAppearance( planItem ) )
+ {
+ final Lifecycle lifecycle = defaultLifecycles.get( phase );
+ if ( lifecycle != null )
+ {
+ totalPhaseSet.addAll( lifecycle.getPhases() );
+ }
+ }
+ }
+ this.phasesInExecutionPlan = new ArrayList<String>( totalPhaseSet );
+
+ Map<String, ExecutionPlanItem> lastInExistingPhases = new HashMap<String, ExecutionPlanItem>();
+ for ( ExecutionPlanItem executionPlanItem : getExecutionPlanItems() )
+ {
+ lastInExistingPhases.put( executionPlanItem.getLifecyclePhase(), executionPlanItem );
+ }
+
+ ExecutionPlanItem lastSeenExecutionPlanItem = null;
+
+ for ( String phase : totalPhaseSet )
+ {
+ ExecutionPlanItem forThisPhase = lastInExistingPhases.get( phase );
+ if ( forThisPhase != null )
+ {
+ lastSeenExecutionPlanItem = forThisPhase;
+ }
+
+ lastMojoExecutionForAllPhases.put( phase, lastSeenExecutionPlanItem );
+ }
+ }
+
+ public Iterator<ExecutionPlanItem> iterator()
+ {
+ return getExecutionPlanItems().iterator();
+ }
+
+ /**
+ * Returns the last ExecutionPlanItem in the supplied phase. If no items are in the specified phase,
+ * the closest executionPlanItem from an earlier phase item will be returned.
+ *
+ * @param requestedPhase the requested phase
+ * The execution plan item
+ * @return The ExecutionPlanItem or null if none can be found
+ */
+ public ExecutionPlanItem findLastInPhase( String requestedPhase )
+ {
+ return lastMojoExecutionForAllPhases.get( requestedPhase );
+ }
+
+ private List<ExecutionPlanItem> getExecutionPlanItems()
+ {
+ return planItem;
+ }
+
+ private static Iterable<String> getDistinctPhasesInOrderOfExecutionPlanAppearance(
+ List<ExecutionPlanItem> planItems )
+ {
+ LinkedHashSet<String> result = new LinkedHashSet<String>();
+ for ( ExecutionPlanItem executionPlanItem : planItems )
+ {
+ final String phase = executionPlanItem.getLifecyclePhase();
+ if ( !result.contains( phase ) )
+ {
+ result.add( phase );
+ }
+ }
+ return result;
+ }
+
+ public List<MojoExecution> getMojoExecutions()
+ {
+ List<MojoExecution> result = new ArrayList<MojoExecution>();
+ for ( ExecutionPlanItem executionPlanItem : planItem )
+ {
+ result.add( executionPlanItem.getMojoExecution() );
+ }
+ return result;
+ }
+
+ /**
+ * Get set of plugins having a goal/mojo used but not marked @threadSafe
+ *
+ * @return the set of plugins (without info on which goal is concerned)
+ */
+ public Set<Plugin> getNonThreadSafePlugins()
+ {
+ Set<Plugin> plugins = new HashSet<Plugin>();
+ for ( ExecutionPlanItem executionPlanItem : planItem )
+ {
+ final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
+ if ( !mojoExecution.getMojoDescriptor().isThreadSafe() )
+ {
+ plugins.add( mojoExecution.getPlugin() );
+ }
+ }
+ return plugins;
+ }
+
+ /**
+ * Get set of mojos used but not marked @threadSafe
+ *
+ * @return the set of mojo descriptors
+ */
+ public Set<MojoDescriptor> getNonThreadSafeMojos()
+ {
+ Set<MojoDescriptor> mojos = new HashSet<MojoDescriptor>();
+ for ( ExecutionPlanItem executionPlanItem : planItem )
+ {
+ final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
+ if ( !mojoExecution.getMojoDescriptor().isThreadSafe() )
+ {
+ mojos.add( mojoExecution.getMojoDescriptor() );
+ }
+ }
+ return mojos;
+ }
+
+ // Used by m2e but will be removed, really.
+ @Deprecated
+ public List<MojoExecution> getExecutions()
+ {
+ return getMojoExecutions();
+ }
+
+ public int size()
+ {
+ return planItem.size();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MissingProjectException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MissingProjectException.java
new file mode 100644
index 00000000..571e1d2b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MissingProjectException.java
@@ -0,0 +1,41 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 a failure to execute a lifecycle phase or mojo because a project is required but not present.
+ *
+ * @author Benjamin Bentmann
+ */
+public class MissingProjectException
+ extends Exception
+{
+
+ /**
+ * Creates a new exception.
+ *
+ * @param message The detail message, may be {@code null}.
+ */
+ public MissingProjectException( String message )
+ {
+ super( message );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MojoExecutionConfigurator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MojoExecutionConfigurator.java
new file mode 100644
index 00000000..b85bac77
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/MojoExecutionConfigurator.java
@@ -0,0 +1,44 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * A MojoExecutionConfigurator is responsible for creating the configuration for Mojo based on configuration for a Mojo
+ * in the MavenProject and the default configuration for the Mojo from the containing plugin's plugin.xml descriptor.
+ *
+ * @provisional
+ * @author Jason van Zyl
+ * @since 3.3.1, MNG-5753
+ */
+public interface MojoExecutionConfigurator
+{
+ /**
+ * Create the MojoExecution configuration based on configuration for a Mojo in the MavenProject and the
+ * default configuration for the Mojo from the containing plugin's plugin.xml descriptor.
+ *
+ * @param project
+ * @param mojoExecution
+ * @param allowPluginLevelConfig
+ */
+ void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/NoGoalSpecifiedException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/NoGoalSpecifiedException.java
new file mode 100644
index 00000000..2ac9638a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/NoGoalSpecifiedException.java
@@ -0,0 +1,41 @@
+package org.apache.maven.lifecycle;
+
+/*
+ * 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 a failure to build because no goal was specified.
+ *
+ * @author Benjamin Bentmann
+ */
+public class NoGoalSpecifiedException
+ extends Exception
+{
+
+ /**
+ * Creates a new exception.
+ *
+ * @param message The detail message, may be {@code null}.
+ */
+ public NoGoalSpecifiedException( String message )
+ {
+ super( message );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java
new file mode 100644
index 00000000..771385cc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildListCalculator.java
@@ -0,0 +1,67 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = BuildListCalculator.class )
+public class BuildListCalculator
+{
+ public ProjectBuildList calculateProjectBuilds( MavenSession session, List<TaskSegment> taskSegments )
+ {
+ List<ProjectSegment> projectBuilds = new ArrayList<ProjectSegment>();
+
+ MavenProject rootProject = session.getTopLevelProject();
+
+ for ( TaskSegment taskSegment : taskSegments )
+ {
+ List<MavenProject> projects;
+
+ if ( taskSegment.isAggregating() )
+ {
+ projects = Collections.singletonList( rootProject );
+ }
+ else
+ {
+ projects = session.getProjects();
+ }
+ for ( MavenProject project : projects )
+ {
+ BuilderCommon.attachToThread( project ); // Not totally sure if this is needed for anything
+ MavenSession copiedSession = session.clone();
+ copiedSession.setCurrentProject( project );
+ projectBuilds.add( new ProjectSegment( project, taskSegment, copiedSession ) );
+ }
+ }
+ return new ProjectBuildList( projectBuilds );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java
new file mode 100644
index 00000000..01545078
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuildThreadFactory.java
@@ -0,0 +1,39 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Simple {@link ThreadFactory} implementation that ensures the corresponding threads have a meaningful name.
+ */
+public class BuildThreadFactory
+ implements ThreadFactory
+{
+ private final AtomicInteger id = new AtomicInteger();
+
+ private static final String PREFIX = "BuilderThread";
+
+ public Thread newThread( Runnable r )
+ {
+ return new Thread( r, String.format( "%s %d", PREFIX, id.getAndIncrement() ) );
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java
new file mode 100644
index 00000000..f2a8291a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/CompoundProjectExecutionListener.java
@@ -0,0 +1,72 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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 org.apache.maven.execution.ProjectExecutionEvent;
+import org.apache.maven.execution.ProjectExecutionListener;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+
+class CompoundProjectExecutionListener
+ implements ProjectExecutionListener
+{
+ private final Collection<ProjectExecutionListener> listeners;
+
+ public CompoundProjectExecutionListener( Collection<ProjectExecutionListener> listeners )
+ {
+ this.listeners = listeners; // NB this is live injected collection
+ }
+
+ public void beforeProjectExecution( ProjectExecutionEvent event )
+ throws LifecycleExecutionException
+ {
+ for ( ProjectExecutionListener listener : listeners )
+ {
+ listener.beforeProjectExecution( event );
+ }
+ }
+
+ public void beforeProjectLifecycleExecution( ProjectExecutionEvent event )
+ throws LifecycleExecutionException
+ {
+ for ( ProjectExecutionListener listener : listeners )
+ {
+ listener.beforeProjectLifecycleExecution( event );
+ }
+ }
+
+ public void afterProjectExecutionSuccess( ProjectExecutionEvent event )
+ throws LifecycleExecutionException
+ {
+ for ( ProjectExecutionListener listener : listeners )
+ {
+ listener.afterProjectExecutionSuccess( event );
+ }
+ }
+
+ public void afterProjectExecutionFailure( ProjectExecutionEvent event )
+ {
+ for ( ProjectExecutionListener listener : listeners )
+ {
+ listener.afterProjectExecutionFailure( event );
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java
new file mode 100644
index 00000000..9434a659
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java
@@ -0,0 +1,77 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Holds data relevant for an execution event.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultExecutionEvent
+ implements ExecutionEvent
+{
+
+ private final Type type;
+
+ private final MavenSession session;
+
+ private final MojoExecution mojoExecution;
+
+ private final Exception exception;
+
+ public DefaultExecutionEvent( Type type, MavenSession session, MojoExecution mojoExecution, Exception exception )
+ {
+ this.type = type;
+ this.session = session;
+ this.mojoExecution = mojoExecution;
+ this.exception = exception;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public MavenSession getSession()
+ {
+ return session;
+ }
+
+ public MavenProject getProject()
+ {
+ return session.getCurrentProject();
+ }
+
+ public MojoExecution getMojoExecution()
+ {
+ return mojoExecution;
+ }
+
+ public Exception getException()
+ {
+ return exception;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java
new file mode 100644
index 00000000..bfb98d43
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java
@@ -0,0 +1,119 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.ExecutionEvent;
+import org.apache.maven.execution.ExecutionListener;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility class that is only public
+ * for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without
+ * prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ExecutionEventCatapult.class )
+public class DefaultExecutionEventCatapult
+ implements ExecutionEventCatapult
+{
+
+ public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution )
+ {
+ fire( eventType, session, mojoExecution, null );
+ }
+
+ public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution,
+ Exception exception )
+ {
+ ExecutionListener listener = session.getRequest().getExecutionListener();
+
+ if ( listener != null )
+ {
+ ExecutionEvent event = new DefaultExecutionEvent( eventType, session, mojoExecution, exception );
+
+ switch ( eventType )
+ {
+ case ProjectDiscoveryStarted:
+ listener.projectDiscoveryStarted( event );
+ break;
+
+ case SessionStarted:
+ listener.sessionStarted( event );
+ break;
+ case SessionEnded:
+ listener.sessionEnded( event );
+ break;
+
+ case ProjectSkipped:
+ listener.projectSkipped( event );
+ break;
+ case ProjectStarted:
+ listener.projectStarted( event );
+ break;
+ case ProjectSucceeded:
+ listener.projectSucceeded( event );
+ break;
+ case ProjectFailed:
+ listener.projectFailed( event );
+ break;
+
+ case MojoSkipped:
+ listener.mojoSkipped( event );
+ break;
+ case MojoStarted:
+ listener.mojoStarted( event );
+ break;
+ case MojoSucceeded:
+ listener.mojoSucceeded( event );
+ break;
+ case MojoFailed:
+ listener.mojoFailed( event );
+ break;
+
+ case ForkStarted:
+ listener.forkStarted( event );
+ break;
+ case ForkSucceeded:
+ listener.forkSucceeded( event );
+ break;
+ case ForkFailed:
+ listener.forkFailed( event );
+ break;
+
+ case ForkedProjectStarted:
+ listener.forkedProjectStarted( event );
+ break;
+ case ForkedProjectSucceeded:
+ listener.forkedProjectSucceeded( event );
+ break;
+ case ForkedProjectFailed:
+ listener.forkedProjectFailed( event );
+ break;
+
+ default:
+ throw new IllegalStateException( "Unknown execution event type " + eventType );
+ }
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
new file mode 100644
index 00000000..8cc47cc5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
@@ -0,0 +1,591 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.DefaultLifecycles;
+import org.apache.maven.lifecycle.Lifecycle;
+import org.apache.maven.lifecycle.LifecycleMappingDelegate;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
+import org.apache.maven.lifecycle.MojoExecutionConfigurator;
+import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.Parameter;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.lifecycle.Execution;
+import org.apache.maven.plugin.lifecycle.Phase;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (Extract class)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = LifecycleExecutionPlanCalculator.class )
+public class DefaultLifecycleExecutionPlanCalculator
+ implements LifecycleExecutionPlanCalculator
+{
+ @Requirement
+ private PluginVersionResolver pluginVersionResolver;
+
+ @Requirement
+ private BuildPluginManager pluginManager;
+
+ @Requirement
+ private DefaultLifecycles defaultLifeCycles;
+
+ @Requirement
+ private MojoDescriptorCreator mojoDescriptorCreator;
+
+ @Requirement
+ private LifecyclePluginResolver lifecyclePluginResolver;
+
+ @Requirement( hint = DefaultLifecycleMappingDelegate.HINT )
+ private LifecycleMappingDelegate standardDelegate;
+
+ @Requirement
+ private Map<String, LifecycleMappingDelegate> delegates;
+
+ @Requirement
+ private Map<String, MojoExecutionConfigurator> mojoExecutionConfigurators;
+
+ @SuppressWarnings( { "UnusedDeclaration" } )
+ public DefaultLifecycleExecutionPlanCalculator()
+ {
+ }
+
+ // Only used for testing
+ public DefaultLifecycleExecutionPlanCalculator( BuildPluginManager pluginManager,
+ DefaultLifecycles defaultLifeCycles,
+ MojoDescriptorCreator mojoDescriptorCreator,
+ LifecyclePluginResolver lifecyclePluginResolver )
+ {
+ this.pluginManager = pluginManager;
+ this.defaultLifeCycles = defaultLifeCycles;
+ this.mojoDescriptorCreator = mojoDescriptorCreator;
+ this.lifecyclePluginResolver = lifecyclePluginResolver;
+ this.mojoExecutionConfigurators =
+ ImmutableMap.of( "default", (MojoExecutionConfigurator) new DefaultMojoExecutionConfigurator() );
+ }
+
+ @Override
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks,
+ boolean setup )
+ throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+ NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ lifecyclePluginResolver.resolveMissingPluginVersions( project, session );
+
+ final List<MojoExecution> executions = calculateMojoExecutions( session, project, tasks );
+
+ if ( setup )
+ {
+ setupMojoExecutions( session, project, executions );
+ }
+
+ final List<ExecutionPlanItem> planItem = ExecutionPlanItem.createExecutionPlanItems( project, executions );
+
+ return new MavenExecutionPlan( planItem, defaultLifeCycles );
+ }
+
+ @Override
+ public MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
+ throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+ NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ return calculateExecutionPlan( session, project, tasks, true );
+ }
+
+ private void setupMojoExecutions( MavenSession session, MavenProject project, List<MojoExecution> mojoExecutions )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ for ( MojoExecution mojoExecution : mojoExecutions )
+ {
+ setupMojoExecution( session, project, mojoExecution );
+ }
+ }
+
+ @Override
+ public void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ if ( mojoDescriptor == null )
+ {
+ mojoDescriptor =
+ pluginManager.getMojoDescriptor( mojoExecution.getPlugin(), mojoExecution.getGoal(),
+ project.getRemotePluginRepositories(),
+ session.getRepositorySession() );
+
+ mojoExecution.setMojoDescriptor( mojoDescriptor );
+ }
+
+ mojoExecutionConfigurator( mojoExecution ).configure( project,
+ mojoExecution,
+ MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );
+
+ finalizeMojoConfiguration( mojoExecution );
+
+ calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
+ }
+
+ public List<MojoExecution> calculateMojoExecutions( MavenSession session, MavenProject project, List<Object> tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException, LifecyclePhaseNotFoundException
+ {
+ final List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
+
+ for ( Object task : tasks )
+ {
+ if ( task instanceof GoalTask )
+ {
+ String pluginGoal = ( (GoalTask) task ).pluginGoal;
+
+ String executionId = "default-cli";
+ int executionIdx = pluginGoal.indexOf( '@' );
+ if ( executionIdx > 0 )
+ {
+ executionId = pluginGoal.substring( executionIdx + 1 );
+ }
+
+ MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project );
+
+ MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, executionId,
+ MojoExecution.Source.CLI );
+
+ mojoExecutions.add( mojoExecution );
+ }
+ else if ( task instanceof LifecycleTask )
+ {
+ String lifecyclePhase = ( (LifecycleTask) task ).getLifecyclePhase();
+
+ Map<String, List<MojoExecution>> phaseToMojoMapping =
+ calculateLifecycleMappings( session, project, lifecyclePhase );
+
+ for ( List<MojoExecution> mojoExecutionsFromLifecycle : phaseToMojoMapping.values() )
+ {
+ mojoExecutions.addAll( mojoExecutionsFromLifecycle );
+ }
+ }
+ else
+ {
+ throw new IllegalStateException( "unexpected task " + task );
+ }
+ }
+ return mojoExecutions;
+ }
+
+ private Map<String, List<MojoExecution>> calculateLifecycleMappings( MavenSession session, MavenProject project,
+ String lifecyclePhase )
+ throws LifecyclePhaseNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException
+ {
+ /*
+ * Determine the lifecycle that corresponds to the given phase.
+ */
+
+ Lifecycle lifecycle = defaultLifeCycles.get( lifecyclePhase );
+
+ if ( lifecycle == null )
+ {
+ throw new LifecyclePhaseNotFoundException( "Unknown lifecycle phase \"" + lifecyclePhase
+ + "\". You must specify a valid lifecycle phase" + " or a goal in the format <plugin-prefix>:<goal> or"
+ + " <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: "
+ + defaultLifeCycles.getLifecyclePhaseList() + ".", lifecyclePhase );
+ }
+
+ LifecycleMappingDelegate delegate;
+ if ( Arrays.binarySearch( DefaultLifecycles.STANDARD_LIFECYCLES, lifecycle.getId() ) >= 0 )
+ {
+ delegate = standardDelegate;
+ }
+ else
+ {
+ delegate = delegates.get( lifecycle.getId() );
+ if ( delegate == null )
+ {
+ delegate = standardDelegate;
+ }
+ }
+
+ return delegate.calculateLifecycleMappings( session, project, lifecycle, lifecyclePhase );
+ }
+
+ /**
+ * Post-processes the effective configuration for the specified mojo execution. This step discards all parameters
+ * from the configuration that are not applicable to the mojo and injects the default values for any missing
+ * parameters.
+ *
+ * @param mojoExecution The mojo execution whose configuration should be finalized, must not be {@code null}.
+ */
+ private void finalizeMojoConfiguration( MojoExecution mojoExecution )
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ Xpp3Dom executionConfiguration = mojoExecution.getConfiguration();
+ if ( executionConfiguration == null )
+ {
+ executionConfiguration = new Xpp3Dom( "configuration" );
+ }
+
+ Xpp3Dom defaultConfiguration = getMojoConfiguration( mojoDescriptor );
+
+ Xpp3Dom finalConfiguration = new Xpp3Dom( "configuration" );
+
+ if ( mojoDescriptor.getParameters() != null )
+ {
+ for ( Parameter parameter : mojoDescriptor.getParameters() )
+ {
+ Xpp3Dom parameterConfiguration = executionConfiguration.getChild( parameter.getName() );
+
+ if ( parameterConfiguration == null )
+ {
+ parameterConfiguration = executionConfiguration.getChild( parameter.getAlias() );
+ }
+
+ Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() );
+
+ parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults,
+ Boolean.TRUE );
+
+ if ( parameterConfiguration != null )
+ {
+ parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() );
+
+ if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) )
+ && StringUtils.isNotEmpty( parameter.getImplementation() ) )
+ {
+ parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() );
+ }
+
+ finalConfiguration.addChild( parameterConfiguration );
+ }
+ }
+ }
+
+ mojoExecution.setConfiguration( finalConfiguration );
+ }
+
+ private Xpp3Dom getMojoConfiguration( MojoDescriptor mojoDescriptor )
+ {
+ return MojoDescriptorCreator.convert( mojoDescriptor );
+ }
+
+ @Override
+ public void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ calculateForkedExecutions( mojoExecution, session, session.getCurrentProject(), new HashSet<MojoDescriptor>() );
+ }
+
+ private void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session, MavenProject project,
+ Collection<MojoDescriptor> alreadyForkedExecutions )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ if ( !mojoDescriptor.isForking() )
+ {
+ return;
+ }
+
+ if ( !alreadyForkedExecutions.add( mojoDescriptor ) )
+ {
+ return;
+ }
+
+ List<MavenProject> forkedProjects =
+ LifecycleDependencyResolver.getProjects( project, session, mojoDescriptor.isAggregator() );
+
+ for ( MavenProject forkedProject : forkedProjects )
+ {
+ if ( forkedProject != project )
+ {
+ lifecyclePluginResolver.resolveMissingPluginVersions( forkedProject, session );
+ }
+
+ List<MojoExecution> forkedExecutions;
+
+ if ( StringUtils.isNotEmpty( mojoDescriptor.getExecutePhase() ) )
+ {
+ forkedExecutions =
+ calculateForkedLifecycle( mojoExecution, session, forkedProject, alreadyForkedExecutions );
+ }
+ else
+ {
+ forkedExecutions = calculateForkedGoal( mojoExecution, session, forkedProject,
+ alreadyForkedExecutions );
+ }
+
+ mojoExecution.setForkedExecutions( BuilderCommon.getKey( forkedProject ), forkedExecutions );
+ }
+
+ alreadyForkedExecutions.remove( mojoDescriptor );
+ }
+
+ private List<MojoExecution> calculateForkedLifecycle( MojoExecution mojoExecution, MavenSession session,
+ MavenProject project,
+ Collection<MojoDescriptor> alreadyForkedExecutions )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ String forkedPhase = mojoDescriptor.getExecutePhase();
+
+ Map<String, List<MojoExecution>> lifecycleMappings = calculateLifecycleMappings( session, project,
+ forkedPhase );
+
+ for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() )
+ {
+ for ( MojoExecution forkedExecution : forkedExecutions )
+ {
+ if ( forkedExecution.getMojoDescriptor() == null )
+ {
+ MojoDescriptor forkedMojoDescriptor =
+ pluginManager.getMojoDescriptor( forkedExecution.getPlugin(), forkedExecution.getGoal(),
+ project.getRemotePluginRepositories(),
+ session.getRepositorySession() );
+
+ forkedExecution.setMojoDescriptor( forkedMojoDescriptor );
+ }
+
+ mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, false );
+ }
+ }
+
+ injectLifecycleOverlay( lifecycleMappings, mojoExecution, session, project );
+
+ List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
+
+ for ( List<MojoExecution> forkedExecutions : lifecycleMappings.values() )
+ {
+ for ( MojoExecution forkedExecution : forkedExecutions )
+ {
+ if ( !alreadyForkedExecutions.contains( forkedExecution.getMojoDescriptor() ) )
+ {
+ finalizeMojoConfiguration( forkedExecution );
+
+ calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions );
+
+ mojoExecutions.add( forkedExecution );
+ }
+ }
+ }
+
+ return mojoExecutions;
+ }
+
+ private void injectLifecycleOverlay( Map<String, List<MojoExecution>> lifecycleMappings,
+ MojoExecution mojoExecution, MavenSession session, MavenProject project )
+ throws PluginDescriptorParsingException, LifecycleNotFoundException, MojoNotFoundException,
+ PluginNotFoundException, PluginResolutionException, NoPluginFoundForPrefixException,
+ InvalidPluginDescriptorException, PluginVersionResolutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+
+ String forkedLifecycle = mojoDescriptor.getExecuteLifecycle();
+
+ if ( StringUtils.isEmpty( forkedLifecycle ) )
+ {
+ return;
+ }
+
+ org.apache.maven.plugin.lifecycle.Lifecycle lifecycleOverlay;
+
+ try
+ {
+ lifecycleOverlay = pluginDescriptor.getLifecycleMapping( forkedLifecycle );
+ }
+ catch ( IOException e )
+ {
+ throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e );
+ }
+
+ if ( lifecycleOverlay == null )
+ {
+ throw new LifecycleNotFoundException( forkedLifecycle );
+ }
+
+ for ( Phase phase : lifecycleOverlay.getPhases() )
+ {
+ List<MojoExecution> forkedExecutions = lifecycleMappings.get( phase.getId() );
+
+ if ( forkedExecutions != null )
+ {
+ for ( Execution execution : phase.getExecutions() )
+ {
+ for ( String goal : execution.getGoals() )
+ {
+ MojoDescriptor forkedMojoDescriptor;
+
+ if ( goal.indexOf( ':' ) < 0 )
+ {
+ forkedMojoDescriptor = pluginDescriptor.getMojo( goal );
+ if ( forkedMojoDescriptor == null )
+ {
+ throw new MojoNotFoundException( goal, pluginDescriptor );
+ }
+ }
+ else
+ {
+ forkedMojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( goal, session, project );
+ }
+
+ MojoExecution forkedExecution =
+ new MojoExecution( forkedMojoDescriptor, mojoExecution.getExecutionId() );
+
+ Xpp3Dom forkedConfiguration = (Xpp3Dom) execution.getConfiguration();
+
+ forkedExecution.setConfiguration( forkedConfiguration );
+
+ mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, true );
+
+ forkedExecutions.add( forkedExecution );
+ }
+ }
+
+ Xpp3Dom phaseConfiguration = (Xpp3Dom) phase.getConfiguration();
+
+ if ( phaseConfiguration != null )
+ {
+ for ( MojoExecution forkedExecution : forkedExecutions )
+ {
+ Xpp3Dom forkedConfiguration = forkedExecution.getConfiguration();
+
+ forkedConfiguration = Xpp3Dom.mergeXpp3Dom( phaseConfiguration, forkedConfiguration );
+
+ forkedExecution.setConfiguration( forkedConfiguration );
+ }
+ }
+ }
+ }
+ }
+
+ // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
+ // TODO: take repo mans into account as one may be aggregating prefixes of many
+ // TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing
+ // or the user forces the issue
+
+ private List<MojoExecution> calculateForkedGoal( MojoExecution mojoExecution, MavenSession session,
+ MavenProject project,
+ Collection<MojoDescriptor> alreadyForkedExecutions )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+
+ String forkedGoal = mojoDescriptor.getExecuteGoal();
+
+ MojoDescriptor forkedMojoDescriptor = pluginDescriptor.getMojo( forkedGoal );
+ if ( forkedMojoDescriptor == null )
+ {
+ throw new MojoNotFoundException( forkedGoal, pluginDescriptor );
+ }
+
+ if ( alreadyForkedExecutions.contains( forkedMojoDescriptor ) )
+ {
+ return Collections.emptyList();
+ }
+
+ MojoExecution forkedExecution = new MojoExecution( forkedMojoDescriptor, forkedGoal );
+
+ mojoExecutionConfigurator( forkedExecution ).configure( project, forkedExecution, true );
+
+ finalizeMojoConfiguration( forkedExecution );
+
+ calculateForkedExecutions( forkedExecution, session, project, alreadyForkedExecutions );
+
+ return Collections.singletonList( forkedExecution );
+ }
+
+ private MojoExecutionConfigurator mojoExecutionConfigurator( MojoExecution mojoExecution )
+ {
+ String configuratorId = mojoExecution.getMojoDescriptor().getComponentConfigurator();
+ if ( configuratorId == null )
+ {
+ configuratorId = "default";
+ }
+
+ MojoExecutionConfigurator mojoExecutionConfigurator = mojoExecutionConfigurators.get( configuratorId );
+
+ if ( mojoExecutionConfigurator == null )
+ {
+ //
+ // The plugin has a custom component configurator but does not have a custom mojo execution configurator
+ // so fall back to the default mojo execution configurator.
+ //
+ mojoExecutionConfigurator = mojoExecutionConfigurators.get( "default" );
+ }
+ return mojoExecutionConfigurator;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java
new file mode 100644
index 00000000..3024fe45
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleMappingDelegate.java
@@ -0,0 +1,158 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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 java.util.TreeMap;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.Lifecycle;
+import org.apache.maven.lifecycle.LifecycleMappingDelegate;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Component( role = LifecycleMappingDelegate.class, hint = DefaultLifecycleMappingDelegate.HINT )
+public class DefaultLifecycleMappingDelegate
+ implements LifecycleMappingDelegate
+{
+ public static final String HINT = "default";
+
+ @Requirement
+ private BuildPluginManager pluginManager;
+
+ public Map<String, List<MojoExecution>> calculateLifecycleMappings( MavenSession session, MavenProject project,
+ Lifecycle lifecycle, String lifecyclePhase )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException
+ {
+ /*
+ * Initialize mapping from lifecycle phase to bound mojos. The key set of this map denotes the phases the caller
+ * is interested in, i.e. all phases up to and including the specified phase.
+ */
+
+ Map<String, Map<Integer, List<MojoExecution>>> mappings =
+ new LinkedHashMap<String, Map<Integer, List<MojoExecution>>>();
+
+ for ( String phase : lifecycle.getPhases() )
+ {
+ Map<Integer, List<MojoExecution>> phaseBindings = new TreeMap<Integer, List<MojoExecution>>();
+
+ mappings.put( phase, phaseBindings );
+
+ if ( phase.equals( lifecyclePhase ) )
+ {
+ break;
+ }
+ }
+
+ /*
+ * Grab plugin executions that are bound to the selected lifecycle phases from project. The effective model of
+ * the project already contains the plugin executions induced by the project's packaging type. Remember, all
+ * phases of interest and only those are in the lifecyle mapping, if a phase has no value in the map, we are not
+ * interested in any of the executions bound to it.
+ */
+
+ for ( Plugin plugin : project.getBuild().getPlugins() )
+ {
+ for ( PluginExecution execution : plugin.getExecutions() )
+ {
+ // if the phase is specified then I don't have to go fetch the plugin yet and pull it down
+ // to examine the phase it is associated to.
+ if ( execution.getPhase() != null )
+ {
+ Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( execution.getPhase() );
+ if ( phaseBindings != null )
+ {
+ for ( String goal : execution.getGoals() )
+ {
+ MojoExecution mojoExecution = new MojoExecution( plugin, goal, execution.getId() );
+ mojoExecution.setLifecyclePhase( execution.getPhase() );
+ addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() );
+ }
+ }
+ }
+ // if not then i need to grab the mojo descriptor and look at the phase that is specified
+ else
+ {
+ for ( String goal : execution.getGoals() )
+ {
+ MojoDescriptor mojoDescriptor =
+ pluginManager.getMojoDescriptor( plugin, goal, project.getRemotePluginRepositories(),
+ session.getRepositorySession() );
+
+ Map<Integer, List<MojoExecution>> phaseBindings = mappings.get( mojoDescriptor.getPhase() );
+ if ( phaseBindings != null )
+ {
+ MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, execution.getId() );
+ mojoExecution.setLifecyclePhase( mojoDescriptor.getPhase() );
+ addMojoExecution( phaseBindings, mojoExecution, execution.getPriority() );
+ }
+ }
+ }
+ }
+ }
+
+ Map<String, List<MojoExecution>> lifecycleMappings = new LinkedHashMap<String, List<MojoExecution>>();
+
+ for ( Map.Entry<String, Map<Integer, List<MojoExecution>>> entry : mappings.entrySet() )
+ {
+ List<MojoExecution> mojoExecutions = new ArrayList<MojoExecution>();
+
+ for ( List<MojoExecution> executions : entry.getValue().values() )
+ {
+ mojoExecutions.addAll( executions );
+ }
+
+ lifecycleMappings.put( entry.getKey(), mojoExecutions );
+ }
+
+ return lifecycleMappings;
+
+ }
+
+ private void addMojoExecution( Map<Integer, List<MojoExecution>> phaseBindings, MojoExecution mojoExecution,
+ int priority )
+ {
+ List<MojoExecution> mojoExecutions = phaseBindings.get( priority );
+
+ if ( mojoExecutions == null )
+ {
+ mojoExecutions = new ArrayList<MojoExecution>();
+ phaseBindings.put( priority, mojoExecutions );
+ }
+
+ mojoExecutions.add( mojoExecution );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
new file mode 100644
index 00000000..a5e6a34c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
@@ -0,0 +1,258 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.lifecycle.DefaultLifecycles;
+import org.apache.maven.lifecycle.LifeCyclePluginAnalyzer;
+import org.apache.maven.lifecycle.Lifecycle;
+import org.apache.maven.lifecycle.mapping.LifecycleMapping;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author jdcasey
+ * @author Kristian Rosenvold (extracted class only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = LifeCyclePluginAnalyzer.class )
+public class DefaultLifecyclePluginAnalyzer
+ implements LifeCyclePluginAnalyzer
+{
+
+ @Requirement( role = LifecycleMapping.class )
+ private Map<String, LifecycleMapping> lifecycleMappings;
+
+ @Requirement
+ private DefaultLifecycles defaultLifeCycles;
+
+ @Requirement
+ private Logger logger;
+
+ public DefaultLifecyclePluginAnalyzer()
+ {
+ }
+
+ // These methods deal with construction intact Plugin object that look like they come from a standard
+ // <plugin/> block in a Maven POM. We have to do some wiggling to pull the sources of information
+ // together and this really shows the problem of constructing a sensible default configuration but
+ // it's all encapsulated here so it appears normalized to the POM builder.
+
+ // We are going to take the project packaging and find all plugin in the default lifecycle and create
+ // fully populated Plugin objects, including executions with goals and default configuration taken
+ // from the plugin.xml inside a plugin.
+ //
+
+ public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Looking up lifecyle mappings for packaging " + packaging + " from "
+ + Thread.currentThread().getContextClassLoader() );
+ }
+
+ LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
+
+ if ( lifecycleMappingForPackaging == null )
+ {
+ return null;
+ }
+
+ Map<Plugin, Plugin> plugins = new LinkedHashMap<Plugin, Plugin>();
+
+ for ( Lifecycle lifecycle : getOrderedLifecycles() )
+ {
+ org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration =
+ lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
+
+ Map<String, String> phaseToGoalMapping = null;
+
+ if ( lifecycleConfiguration != null )
+ {
+ phaseToGoalMapping = lifecycleConfiguration.getPhases();
+ }
+ else if ( lifecycle.getDefaultPhases() != null )
+ {
+ phaseToGoalMapping = lifecycle.getDefaultPhases();
+ }
+
+ if ( phaseToGoalMapping != null )
+ {
+ // These are of the form:
+ //
+ // compile -> org.apache.maven.plugins:maven-compiler-plugin:compile[,gid:aid:goal,...]
+ //
+ for ( Map.Entry<String, String> goalsForLifecyclePhase : phaseToGoalMapping.entrySet() )
+ {
+ String phase = goalsForLifecyclePhase.getKey();
+ String goals = goalsForLifecyclePhase.getValue();
+ if ( goals != null )
+ {
+ parseLifecyclePhaseDefinitions( plugins, phase, goals );
+ }
+ }
+ }
+ }
+
+ return plugins.keySet();
+ }
+
+ private List<Lifecycle> getOrderedLifecycles()
+ {
+ // NOTE: The lifecycle order can affect implied execution ids so we better be deterministic.
+
+ List<Lifecycle> lifecycles = new ArrayList<Lifecycle>( defaultLifeCycles.getLifeCycles() );
+
+ Collections.sort( lifecycles, new Comparator<Lifecycle>()
+ {
+
+ public int compare( Lifecycle l1, Lifecycle l2 )
+ {
+ return l1.getId().compareTo( l2.getId() );
+ }
+
+ } );
+
+ return lifecycles;
+ }
+
+ private void parseLifecyclePhaseDefinitions( Map<Plugin, Plugin> plugins, String phase, String goals )
+ {
+ String[] mojos = StringUtils.split( goals, "," );
+
+ for ( int i = 0; i < mojos.length; i++ )
+ {
+ GoalSpec gs = parseGoalSpec( mojos[i].trim() );
+
+ if ( gs == null )
+ {
+ logger.warn( "Ignored invalid goal specification '" + mojos[i] + "' from lifecycle mapping for phase "
+ + phase );
+ continue;
+ }
+
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( gs.groupId );
+ plugin.setArtifactId( gs.artifactId );
+ plugin.setVersion( gs.version );
+
+ Plugin existing = plugins.get( plugin );
+ if ( existing != null )
+ {
+ if ( existing.getVersion() == null )
+ {
+ existing.setVersion( plugin.getVersion() );
+ }
+ plugin = existing;
+ }
+ else
+ {
+ plugins.put( plugin, plugin );
+ }
+
+ PluginExecution execution = new PluginExecution();
+ execution.setId( getExecutionId( plugin, gs.goal ) );
+ execution.setPhase( phase );
+ execution.setPriority( i - mojos.length );
+ execution.getGoals().add( gs.goal );
+
+ plugin.getExecutions().add( execution );
+ }
+ }
+
+ private GoalSpec parseGoalSpec( String goalSpec )
+ {
+ GoalSpec gs = new GoalSpec();
+
+ String[] p = StringUtils.split( goalSpec.trim(), ":" );
+
+ if ( p.length == 3 )
+ {
+ // <groupId>:<artifactId>:<goal>
+ gs.groupId = p[0];
+ gs.artifactId = p[1];
+ gs.goal = p[2];
+ }
+ else if ( p.length == 4 )
+ {
+ // <groupId>:<artifactId>:<version>:<goal>
+ gs.groupId = p[0];
+ gs.artifactId = p[1];
+ gs.version = p[2];
+ gs.goal = p[3];
+ }
+ else
+ {
+ // invalid
+ gs = null;
+ }
+
+ return gs;
+ }
+
+ private String getExecutionId( Plugin plugin, String goal )
+ {
+ Set<String> existingIds = new HashSet<String>();
+ for ( PluginExecution execution : plugin.getExecutions() )
+ {
+ existingIds.add( execution.getId() );
+ }
+
+ String base = "default-" + goal;
+ String id = base;
+
+ for ( int index = 1; existingIds.contains( id ); index++ )
+ {
+ id = base + '-' + index;
+ }
+
+ return id;
+ }
+
+ static class GoalSpec
+ {
+
+ String groupId;
+
+ String artifactId;
+
+ String version;
+
+ String goal;
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
new file mode 100644
index 00000000..28377f1d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleTaskSegmentCalculator.java
@@ -0,0 +1,155 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Calculates the task segments in the build
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author jdcasey
+ * @author Kristian Rosenvold (extracted class)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+
+@Component( role = LifecycleTaskSegmentCalculator.class )
+public class DefaultLifecycleTaskSegmentCalculator
+ implements LifecycleTaskSegmentCalculator
+{
+ @Requirement
+ private MojoDescriptorCreator mojoDescriptorCreator;
+
+ @Requirement
+ private LifecyclePluginResolver lifecyclePluginResolver;
+
+ public DefaultLifecycleTaskSegmentCalculator()
+ {
+ }
+
+ public List<TaskSegment> calculateTaskSegments( MavenSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException
+ {
+
+ MavenProject rootProject = session.getTopLevelProject();
+
+ List<String> tasks = session.getGoals();
+
+ if ( ( tasks == null || tasks.isEmpty() ) && !StringUtils.isEmpty( rootProject.getDefaultGoal() ) )
+ {
+ tasks = Arrays.asList( StringUtils.split( rootProject.getDefaultGoal() ) );
+ }
+
+ return calculateTaskSegments( session, tasks );
+ }
+
+ public List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException
+ {
+ List<TaskSegment> taskSegments = new ArrayList<TaskSegment>( tasks.size() );
+
+ TaskSegment currentSegment = null;
+
+ for ( String task : tasks )
+ {
+ if ( isGoalSpecification( task ) )
+ {
+ // "pluginPrefix:goal" or "groupId:artifactId[:version]:goal"
+
+ lifecyclePluginResolver.resolveMissingPluginVersions( session.getTopLevelProject(), session );
+
+ MojoDescriptor mojoDescriptor =
+ mojoDescriptorCreator.getMojoDescriptor( task, session, session.getTopLevelProject() );
+
+ boolean aggregating = mojoDescriptor.isAggregator() || !mojoDescriptor.isProjectRequired();
+
+ if ( currentSegment == null || currentSegment.isAggregating() != aggregating )
+ {
+ currentSegment = new TaskSegment( aggregating );
+ taskSegments.add( currentSegment );
+ }
+
+ currentSegment.getTasks().add( new GoalTask( task ) );
+ }
+ else
+ {
+ // lifecycle phase
+
+ if ( currentSegment == null || currentSegment.isAggregating() )
+ {
+ currentSegment = new TaskSegment( false );
+ taskSegments.add( currentSegment );
+ }
+
+ currentSegment.getTasks().add( new LifecycleTask( task ) );
+ }
+ }
+
+ return taskSegments;
+ }
+
+ public boolean requiresProject( MavenSession session )
+ {
+ List<String> goals = session.getGoals();
+ if ( goals != null )
+ {
+ for ( String goal : goals )
+ {
+ if ( !isGoalSpecification( goal ) )
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ private boolean isGoalSpecification( String task )
+ {
+ return task.indexOf( ':' ) >= 0;
+ }
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java
new file mode 100644
index 00000000..176ba320
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java
@@ -0,0 +1,108 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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 org.apache.maven.lifecycle.MojoExecutionConfigurator;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * @since 3.3.1, MNG-5753
+ */
+@Component( role = MojoExecutionConfigurator.class )
+public class DefaultMojoExecutionConfigurator
+ implements MojoExecutionConfigurator
+{
+
+ @Override
+ public void configure( MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig )
+ {
+ String g = mojoExecution.getGroupId();
+
+ String a = mojoExecution.getArtifactId();
+
+ Plugin plugin = findPlugin( g, a, project.getBuildPlugins() );
+
+ if ( plugin == null && project.getPluginManagement() != null )
+ {
+ plugin = findPlugin( g, a, project.getPluginManagement().getPlugins() );
+ }
+
+ if ( plugin != null )
+ {
+ PluginExecution pluginExecution =
+ findPluginExecution( mojoExecution.getExecutionId(), plugin.getExecutions() );
+
+ Xpp3Dom pomConfiguration = null;
+
+ if ( pluginExecution != null )
+ {
+ pomConfiguration = (Xpp3Dom) pluginExecution.getConfiguration();
+ }
+ else if ( allowPluginLevelConfig )
+ {
+ pomConfiguration = (Xpp3Dom) plugin.getConfiguration();
+ }
+
+ Xpp3Dom mojoConfiguration = ( pomConfiguration != null ) ? new Xpp3Dom( pomConfiguration ) : null;
+
+ mojoConfiguration = Xpp3Dom.mergeXpp3Dom( mojoExecution.getConfiguration(), mojoConfiguration );
+
+ mojoExecution.setConfiguration( mojoConfiguration );
+ }
+ }
+
+ private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins )
+ {
+ for ( Plugin plugin : plugins )
+ {
+ if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) )
+ {
+ return plugin;
+ }
+ }
+
+ return null;
+ }
+
+ private PluginExecution findPluginExecution( String executionId, Collection<PluginExecution> executions )
+ {
+ if ( StringUtils.isNotEmpty( executionId ) )
+ {
+ for ( PluginExecution execution : executions )
+ {
+ if ( executionId.equals( execution.getId() ) )
+ {
+ return execution;
+ }
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java
new file mode 100644
index 00000000..762fc72b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java
@@ -0,0 +1,53 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.project.artifact.MavenMetadataSource;
+
+@SuppressWarnings( "deprecation" )
+@Named
+public class DefaultProjectArtifactFactory
+ implements ProjectArtifactFactory
+{
+ private final ArtifactFactory artifactFactory;
+
+ @Inject
+ public DefaultProjectArtifactFactory( ArtifactFactory artifactFactory )
+ {
+ this.artifactFactory = artifactFactory;
+ }
+
+ @Override
+ public Set<Artifact> createArtifacts( MavenProject project )
+ throws InvalidDependencyVersionException
+ {
+ return MavenMetadataSource.createArtifacts( artifactFactory, project.getDependencies(), null, null, project );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java
new file mode 100644
index 00000000..18fae7a9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DependencyContext.java
@@ -0,0 +1,114 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.project.MavenProject;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.TreeSet;
+
+/**
+ * Context of dependency artifacts for a particular project.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (class extract only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+// TODO: From a concurrency perspective, this class is not good. The combination of mutable/immutable state is not nice
+public class DependencyContext
+{
+
+ private static final Collection<?> UNRESOLVED = Arrays.asList();
+
+ private final MavenProject project;
+
+ private final Collection<String> scopesToCollectForCurrentProject;
+
+ private final Collection<String> scopesToResolveForCurrentProject;
+
+ private final Collection<String> scopesToCollectForAggregatedProjects;
+
+ private final Collection<String> scopesToResolveForAggregatedProjects;
+
+ private volatile Collection<?> lastDependencyArtifacts = UNRESOLVED;
+
+ private volatile int lastDependencyArtifactCount = -1;
+
+ public DependencyContext( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve )
+ {
+ this.project = project;
+ scopesToCollectForCurrentProject = scopesToCollect;
+ scopesToResolveForCurrentProject = scopesToResolve;
+ scopesToCollectForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
+ scopesToResolveForAggregatedProjects = Collections.synchronizedSet( new TreeSet<String>() );
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public Collection<String> getScopesToCollectForCurrentProject()
+ {
+ return scopesToCollectForCurrentProject;
+ }
+
+ public Collection<String> getScopesToResolveForCurrentProject()
+ {
+ return scopesToResolveForCurrentProject;
+ }
+
+ public Collection<String> getScopesToCollectForAggregatedProjects()
+ {
+ return scopesToCollectForAggregatedProjects;
+ }
+
+ public Collection<String> getScopesToResolveForAggregatedProjects()
+ {
+ return scopesToResolveForAggregatedProjects;
+ }
+
+ public boolean isResolutionRequiredForCurrentProject()
+ {
+ return lastDependencyArtifacts != project.getDependencyArtifacts() || ( lastDependencyArtifacts != null
+ && lastDependencyArtifactCount != lastDependencyArtifacts.size() );
+ }
+
+ public boolean isResolutionRequiredForAggregatedProjects( Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve )
+ {
+ boolean required =
+ scopesToCollectForAggregatedProjects.addAll( scopesToCollect )
+ || scopesToResolveForAggregatedProjects.addAll( scopesToResolve );
+ return required;
+ }
+
+ public void synchronizeWithProjectState()
+ {
+ lastDependencyArtifacts = project.getDependencyArtifacts();
+ lastDependencyArtifactCount = ( lastDependencyArtifacts != null ) ? lastDependencyArtifacts.size() : 0;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java
new file mode 100644
index 00000000..acff5661
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java
@@ -0,0 +1,40 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+
+/**
+ * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility interface that is only
+ * public for technical reasons, it is not part of the public API. In particular, this interface can be changed or
+ * deleted without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ExecutionEventCatapult
+{
+
+ void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution );
+
+ void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution, Exception exception );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
new file mode 100644
index 00000000..cceffdf8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionPlanItem.java
@@ -0,0 +1,84 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Wraps individual MojoExecutions, containing information about completion status and scheduling.
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Kristian Rosenvold
+ */
+public class ExecutionPlanItem
+{
+ private final MojoExecution mojoExecution;
+
+ public ExecutionPlanItem( MojoExecution mojoExecution )
+ {
+ this.mojoExecution = mojoExecution;
+ }
+
+ public static List<ExecutionPlanItem> createExecutionPlanItems( MavenProject mavenProject,
+ List<MojoExecution> executions )
+ {
+ BuilderCommon.attachToThread( mavenProject );
+
+ List<ExecutionPlanItem> result = new ArrayList<ExecutionPlanItem>();
+ for ( MojoExecution mojoExecution : executions )
+ {
+ result.add( new ExecutionPlanItem( mojoExecution ) );
+ }
+ return result;
+ }
+
+ public MojoExecution getMojoExecution()
+ {
+ return mojoExecution;
+ }
+
+ public String getLifecyclePhase()
+ {
+ return mojoExecution.getLifecyclePhase();
+ }
+
+ public Plugin getPlugin()
+ {
+ final MojoDescriptor mojoDescriptor = getMojoExecution().getMojoDescriptor();
+ return mojoDescriptor.getPluginDescriptor().getPlugin();
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ExecutionPlanItem{" + ", mojoExecution=" + mojoExecution + '}'
+ + super.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java
new file mode 100644
index 00000000..5c43dbd4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/GoalTask.java
@@ -0,0 +1,45 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.
+ */
+
+/**
+ * A task that is a goal
+ * <p/>
+ * TODO: From a concurrecy perspective, this class is not good. The combination of mutable/immutable state is not nice
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public final class GoalTask
+{
+
+ final String pluginGoal;
+
+ public GoalTask( String pluginGoal )
+ {
+ this.pluginGoal = pluginGoal;
+ }
+
+ @Override
+ public String toString()
+ {
+ return pluginGoal;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java
new file mode 100644
index 00000000..2edbe754
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDebugLogger.java
@@ -0,0 +1,182 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.lifecycle.MavenExecutionPlan;
+import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * Logs debug output from the various lifecycle phases.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author Kristian Rosenvold (extracted class only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = LifecycleDebugLogger.class )
+public class LifecycleDebugLogger
+{
+ @Requirement
+ private Logger logger;
+
+
+ public LifecycleDebugLogger()
+ {
+ }
+
+ public LifecycleDebugLogger( Logger logger )
+ {
+ this.logger = logger;
+ }
+
+
+ public void debug( String s )
+ {
+ logger.debug( s );
+ }
+
+ public void info( String s )
+ {
+ logger.info( s );
+ }
+
+ public void debugReactorPlan( ProjectBuildList projectBuilds )
+ {
+ if ( !logger.isDebugEnabled() )
+ {
+ return;
+ }
+
+ logger.debug( "=== REACTOR BUILD PLAN ================================================" );
+
+ for ( Iterator<ProjectSegment> it = projectBuilds.iterator(); it.hasNext(); )
+ {
+ ProjectSegment projectBuild = it.next();
+
+ logger.debug( "Project: " + projectBuild.getProject().getId() );
+ logger.debug( "Tasks: " + projectBuild.getTaskSegment().getTasks() );
+ logger.debug( "Style: " + ( projectBuild.getTaskSegment().isAggregating() ? "Aggregating" : "Regular" ) );
+
+ if ( it.hasNext() )
+ {
+ logger.debug( "-----------------------------------------------------------------------" );
+ }
+ }
+
+ logger.debug( "=======================================================================" );
+ }
+
+
+ public void debugProjectPlan( MavenProject currentProject, MavenExecutionPlan executionPlan )
+ {
+ if ( !logger.isDebugEnabled() )
+ {
+ return;
+ }
+
+ logger.debug( "=== PROJECT BUILD PLAN ================================================" );
+ logger.debug( "Project: " + BuilderCommon.getKey( currentProject ) );
+
+ debugDependencyRequirements( executionPlan.getMojoExecutions() );
+
+ logger.debug( "Repositories (dependencies): " + currentProject.getRemoteProjectRepositories() );
+ logger.debug( "Repositories (plugins) : " + currentProject.getRemotePluginRepositories() );
+
+ for ( ExecutionPlanItem mojoExecution : executionPlan )
+ {
+ debugMojoExecution( mojoExecution.getMojoExecution() );
+ }
+
+ logger.debug( "=======================================================================" );
+ }
+
+ private void debugMojoExecution( MojoExecution mojoExecution )
+ {
+ String mojoExecId =
+ mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':'
+ + mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')';
+
+ Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions();
+ if ( !forkedExecutions.isEmpty() )
+ {
+ for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() )
+ {
+ logger.debug( "--- init fork of " + fork.getKey() + " for " + mojoExecId + " ---" );
+
+ debugDependencyRequirements( fork.getValue() );
+
+ for ( MojoExecution forkedExecution : fork.getValue() )
+ {
+ debugMojoExecution( forkedExecution );
+ }
+
+ logger.debug( "--- exit fork of " + fork.getKey() + " for " + mojoExecId + " ---" );
+ }
+ }
+
+ logger.debug( "-----------------------------------------------------------------------" );
+ logger.debug( "Goal: " + mojoExecId );
+ logger.debug(
+ "Style: " + ( mojoExecution.getMojoDescriptor().isAggregator() ? "Aggregating" : "Regular" ) );
+ logger.debug( "Configuration: " + mojoExecution.getConfiguration() );
+ }
+
+ private void debugDependencyRequirements( List<MojoExecution> mojoExecutions )
+ {
+ Set<String> scopesToCollect = new TreeSet<String>();
+ Set<String> scopesToResolve = new TreeSet<String>();
+
+ for ( MojoExecution mojoExecution : mojoExecutions )
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
+ if ( StringUtils.isNotEmpty( scopeToCollect ) )
+ {
+ scopesToCollect.add( scopeToCollect );
+ }
+
+ String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
+ if ( StringUtils.isNotEmpty( scopeToResolve ) )
+ {
+ scopesToResolve.add( scopeToResolve );
+ }
+ }
+
+ logger.debug( "Dependencies (collect): " + scopesToCollect );
+ logger.debug( "Dependencies (resolve): " + scopesToResolve );
+ }
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
new file mode 100644
index 00000000..4d73528c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
@@ -0,0 +1,334 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.eventspy.internal.EventSpyDispatcher;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.project.DefaultDependencyResolutionRequest;
+import org.apache.maven.project.DependencyResolutionException;
+import org.apache.maven.project.DependencyResolutionResult;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectDependenciesResolver;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.util.filter.AndDependencyFilter;
+import org.eclipse.aether.util.filter.ScopeDependencyFilter;
+
+/**
+ * Resolves dependencies for the artifacts in context of the lifecycle build
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author Kristian Rosenvold (extracted class)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Named
+public class LifecycleDependencyResolver
+{
+
+ @Inject
+ private ProjectDependenciesResolver dependenciesResolver;
+
+ @Inject
+ private Logger logger;
+
+ @Inject
+ private ProjectArtifactFactory artifactFactory;
+
+ @Inject
+ private EventSpyDispatcher eventSpyDispatcher;
+
+ public LifecycleDependencyResolver()
+ {
+ }
+
+ public LifecycleDependencyResolver( ProjectDependenciesResolver projectDependenciesResolver, Logger logger )
+ {
+ this.dependenciesResolver = projectDependenciesResolver;
+ this.logger = logger;
+ }
+
+ public static List<MavenProject> getProjects( MavenProject project, MavenSession session, boolean aggregator )
+ {
+ if ( aggregator )
+ {
+ return session.getProjects();
+ }
+ else
+ {
+ return Collections.singletonList( project );
+ }
+ }
+
+ public void resolveProjectDependencies( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session,
+ boolean aggregating, Set<Artifact> projectArtifacts )
+ throws LifecycleExecutionException
+ {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ ClassLoader projectRealm = project.getClassRealm();
+ if ( projectRealm != null && projectRealm != tccl )
+ {
+ Thread.currentThread().setContextClassLoader( projectRealm );
+ }
+
+ if ( project.getDependencyArtifacts() == null )
+ {
+ try
+ {
+ project.setDependencyArtifacts( artifactFactory.createArtifacts( project ) );
+ }
+ catch ( InvalidDependencyVersionException e )
+ {
+ throw new LifecycleExecutionException( e );
+ }
+ }
+
+ Set<Artifact> artifacts =
+ getDependencies( project, scopesToCollect, scopesToResolve, session, aggregating, projectArtifacts );
+
+ project.setResolvedArtifacts( artifacts );
+
+ Map<String, Artifact> map = new HashMap<String, Artifact>();
+ for ( Artifact artifact : artifacts )
+ {
+ map.put( artifact.getDependencyConflictId(), artifact );
+ }
+ for ( Artifact artifact : project.getDependencyArtifacts() )
+ {
+ if ( artifact.getFile() == null )
+ {
+ Artifact resolved = map.get( artifact.getDependencyConflictId() );
+ if ( resolved != null )
+ {
+ artifact.setFile( resolved.getFile() );
+ artifact.setDependencyTrail( resolved.getDependencyTrail() );
+ artifact.setResolvedVersion( resolved.getVersion() );
+ artifact.setResolved( true );
+ }
+ }
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( tccl );
+ }
+ }
+
+ private Set<Artifact> getDependencies( MavenProject project, Collection<String> scopesToCollect,
+ Collection<String> scopesToResolve, MavenSession session,
+ boolean aggregating, Set<Artifact> projectArtifacts )
+ throws LifecycleExecutionException
+ {
+ if ( scopesToCollect == null )
+ {
+ scopesToCollect = Collections.emptySet();
+ }
+ if ( scopesToResolve == null )
+ {
+ scopesToResolve = Collections.emptySet();
+ }
+
+ if ( scopesToCollect.isEmpty() && scopesToResolve.isEmpty() )
+ {
+ return new LinkedHashSet<Artifact>();
+ }
+
+ scopesToCollect = new HashSet<String>( scopesToCollect );
+ scopesToCollect.addAll( scopesToResolve );
+
+ DependencyFilter collectionFilter = new ScopeDependencyFilter( null, negate( scopesToCollect ) );
+ DependencyFilter resolutionFilter = new ScopeDependencyFilter( null, negate( scopesToResolve ) );
+ resolutionFilter = AndDependencyFilter.newInstance( collectionFilter, resolutionFilter );
+ resolutionFilter =
+ AndDependencyFilter.newInstance( resolutionFilter, new ReactorDependencyFilter( projectArtifacts ) );
+
+ DependencyResolutionResult result;
+ try
+ {
+ DefaultDependencyResolutionRequest request =
+ new DefaultDependencyResolutionRequest( project, session.getRepositorySession() );
+ request.setResolutionFilter( resolutionFilter );
+
+ eventSpyDispatcher.onEvent( request );
+
+ result = dependenciesResolver.resolve( request );
+ }
+ catch ( DependencyResolutionException e )
+ {
+ result = e.getResult();
+
+ /*
+ * MNG-2277, the check below compensates for our bad plugin support where we ended up with aggregator
+ * plugins that require dependency resolution although they usually run in phases of the build where project
+ * artifacts haven't been assembled yet. The prime example of this is "mvn release:prepare".
+ */
+ if ( aggregating && areAllDependenciesInReactor( session.getProjects(),
+ result.getUnresolvedDependencies() ) )
+ {
+ logger.warn( "The following dependencies could not be resolved at this point of the build"
+ + " but seem to be part of the reactor:" );
+
+ for ( Dependency dependency : result.getUnresolvedDependencies() )
+ {
+ logger.warn( "o " + dependency );
+ }
+
+ logger.warn( "Try running the build up to the lifecycle phase \"package\"" );
+ }
+ else
+ {
+ throw new LifecycleExecutionException( null, project, e );
+ }
+ }
+
+ eventSpyDispatcher.onEvent( result );
+
+ Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
+ if ( result.getDependencyGraph() != null && !result.getDependencyGraph().getChildren().isEmpty() )
+ {
+ RepositoryUtils.toArtifacts( artifacts, result.getDependencyGraph().getChildren(),
+ Collections.singletonList( project.getArtifact().getId() ), collectionFilter );
+ }
+ return artifacts;
+ }
+
+ private boolean areAllDependenciesInReactor( Collection<MavenProject> projects,
+ Collection<Dependency> dependencies )
+ {
+ Set<String> projectKeys = getReactorProjectKeys( projects );
+
+ for ( Dependency dependency : dependencies )
+ {
+ org.eclipse.aether.artifact.Artifact a = dependency.getArtifact();
+ String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
+ if ( !projectKeys.contains( key ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private Set<String> getReactorProjectKeys( Collection<MavenProject> projects )
+ {
+ Set<String> projectKeys = new HashSet<String>( projects.size() * 2 );
+ for ( MavenProject project : projects )
+ {
+ String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
+ projectKeys.add( key );
+ }
+ return projectKeys;
+ }
+
+ private Collection<String> negate( Collection<String> scopes )
+ {
+ Collection<String> result = new HashSet<String>();
+ Collections.addAll( result, "system", "compile", "provided", "runtime", "test" );
+
+ for ( String scope : scopes )
+ {
+ if ( "compile".equals( scope ) )
+ {
+ result.remove( "compile" );
+ result.remove( "system" );
+ result.remove( "provided" );
+ }
+ else if ( "runtime".equals( scope ) )
+ {
+ result.remove( "compile" );
+ result.remove( "runtime" );
+ }
+ else if ( "compile+runtime".equals( scope ) )
+ {
+ result.remove( "compile" );
+ result.remove( "system" );
+ result.remove( "provided" );
+ result.remove( "runtime" );
+ }
+ else if ( "runtime+system".equals( scope ) )
+ {
+ result.remove( "compile" );
+ result.remove( "system" );
+ result.remove( "runtime" );
+ }
+ else if ( "test".equals( scope ) )
+ {
+ result.clear();
+ }
+ }
+
+ return result;
+ }
+
+ private static class ReactorDependencyFilter
+ implements DependencyFilter
+ {
+
+ private Set<String> keys = new HashSet<String>();
+
+ public ReactorDependencyFilter( Collection<Artifact> artifacts )
+ {
+ for ( Artifact artifact : artifacts )
+ {
+ String key = ArtifactUtils.key( artifact );
+ keys.add( key );
+ }
+ }
+
+ public boolean accept( DependencyNode node, List<DependencyNode> parents )
+ {
+ Dependency dependency = node.getDependency();
+ if ( dependency != null )
+ {
+ org.eclipse.aether.artifact.Artifact a = dependency.getArtifact();
+ String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
+ return !keys.contains( key );
+ }
+ return false;
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
new file mode 100644
index 00000000..7d35b102
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculator.java
@@ -0,0 +1,67 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.util.List;
+
+/**
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (extract interface only)
+ * <p/>
+ */
+public interface LifecycleExecutionPlanCalculator
+{
+ MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks )
+ throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+ NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
+
+ MavenExecutionPlan calculateExecutionPlan( MavenSession session, MavenProject project, List<Object> tasks,
+ boolean setup )
+ throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+ NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException;
+
+ void calculateForkedExecutions( MojoExecution mojoExecution, MavenSession session )
+ throws MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
+ PluginDescriptorParsingException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
+
+ void setupMojoExecution( MavenSession session, MavenProject project, MojoExecution mojoExecution )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException, NoPluginFoundForPrefixException,
+ LifecyclePhaseNotFoundException, LifecycleNotFoundException, PluginVersionResolutionException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
new file mode 100644
index 00000000..343fbf95
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
@@ -0,0 +1,154 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.BuildSuccess;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectExecutionEvent;
+import org.apache.maven.execution.ProjectExecutionListener;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
+import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.session.scope.internal.SessionScope;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Builds one or more lifecycles for a full module
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author Kristian Rosenvold (extracted class)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = LifecycleModuleBuilder.class )
+public class LifecycleModuleBuilder
+{
+
+ @Requirement
+ private MojoExecutor mojoExecutor;
+
+ @Requirement
+ private BuilderCommon builderCommon;
+
+ @Requirement
+ private ExecutionEventCatapult eventCatapult;
+
+ private ProjectExecutionListener projectExecutionListener;
+
+ // this tricks plexus-component-metadata generate required metadata
+ @Requirement
+ private List<ProjectExecutionListener> projectExecutionListeners;
+
+ @Requirement
+ private SessionScope sessionScope;
+
+ public void setProjectExecutionListeners( final List<ProjectExecutionListener> listeners )
+ {
+ this.projectExecutionListeners = listeners;
+ this.projectExecutionListener = new CompoundProjectExecutionListener( listeners );
+ }
+
+ public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject,
+ TaskSegment taskSegment )
+ {
+ buildProject( session, session, reactorContext, currentProject, taskSegment );
+ }
+
+ public void buildProject( MavenSession session, MavenSession rootSession, ReactorContext reactorContext,
+ MavenProject currentProject, TaskSegment taskSegment )
+ {
+ session.setCurrentProject( currentProject );
+
+ long buildStartTime = System.currentTimeMillis();
+
+ // session may be different from rootSession seeded in DefaultMaven
+ // explicitly seed the right session here to make sure it is used by Guice
+ sessionScope.enter( reactorContext.getSessionScopeMemento() );
+ sessionScope.seed( MavenSession.class, session );
+ try
+ {
+
+ if ( reactorContext.getReactorBuildStatus().isHaltedOrBlacklisted( currentProject ) )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.ProjectSkipped, session, null );
+ return;
+ }
+
+ BuilderCommon.attachToThread( currentProject );
+
+ projectExecutionListener.beforeProjectExecution( new ProjectExecutionEvent( session, currentProject ) );
+
+ eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, session, null );
+
+ MavenExecutionPlan executionPlan =
+ builderCommon.resolveBuildPlan( session, currentProject, taskSegment, new HashSet<Artifact>() );
+ List<MojoExecution> mojoExecutions = executionPlan.getMojoExecutions();
+
+ projectExecutionListener.beforeProjectLifecycleExecution( new ProjectExecutionEvent( session,
+ currentProject,
+ mojoExecutions ) );
+ mojoExecutor.execute( session, mojoExecutions, reactorContext.getProjectIndex() );
+
+ long buildEndTime = System.currentTimeMillis();
+
+ projectExecutionListener.afterProjectExecutionSuccess( new ProjectExecutionEvent( session, currentProject,
+ mojoExecutions ) );
+
+ reactorContext.getResult().addBuildSummary( new BuildSuccess( currentProject,
+ buildEndTime - buildStartTime ) );
+
+ eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, session, null );
+ }
+ catch ( Throwable t )
+ {
+ builderCommon.handleBuildError( reactorContext, rootSession, session, currentProject, t, buildStartTime );
+
+ projectExecutionListener.afterProjectExecutionFailure( new ProjectExecutionEvent( session, currentProject,
+ t ) );
+
+ // rethrow original errors and runtime exceptions
+ if ( t instanceof RuntimeException )
+ {
+ throw (RuntimeException) t;
+ }
+ if ( t instanceof Error )
+ {
+ throw (Error) t;
+ }
+ }
+ finally
+ {
+ sessionScope.exit();
+
+ session.setCurrentProject( null );
+
+ Thread.currentThread().setContextClassLoader( reactorContext.getOriginalContextClassLoader() );
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java
new file mode 100644
index 00000000..c615a6f6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecyclePluginResolver.java
@@ -0,0 +1,95 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.plugin.version.DefaultPluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (Extract class)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = LifecyclePluginResolver.class )
+public class LifecyclePluginResolver
+{
+ @Requirement
+ private PluginVersionResolver pluginVersionResolver;
+
+
+ public LifecyclePluginResolver( PluginVersionResolver pluginVersionResolver )
+ {
+ this.pluginVersionResolver = pluginVersionResolver;
+ }
+
+ public LifecyclePluginResolver()
+ {
+ }
+
+ public void resolveMissingPluginVersions( MavenProject project, MavenSession session )
+ throws PluginVersionResolutionException
+ {
+ Map<String, String> versions = new HashMap<String, String>( 64 );
+
+ for ( Plugin plugin : project.getBuildPlugins() )
+ {
+ if ( plugin.getVersion() == null )
+ {
+ PluginVersionRequest request =
+ new DefaultPluginVersionRequest( plugin, session.getRepositorySession(),
+ project.getRemotePluginRepositories() );
+ plugin.setVersion( pluginVersionResolver.resolve( request ).getVersion() );
+ }
+ versions.put( plugin.getKey(), plugin.getVersion() );
+ }
+
+ PluginManagement pluginManagement = project.getPluginManagement();
+ if ( pluginManagement != null )
+ {
+ for ( Plugin plugin : pluginManagement.getPlugins() )
+ {
+ if ( plugin.getVersion() == null )
+ {
+ plugin.setVersion( versions.get( plugin.getKey() ) );
+ if ( plugin.getVersion() == null )
+ {
+ PluginVersionRequest request =
+ new DefaultPluginVersionRequest( plugin, session.getRepositorySession(),
+ project.getRemotePluginRepositories() );
+ plugin.setVersion( pluginVersionResolver.resolve( request ).getVersion() );
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java
new file mode 100644
index 00000000..cee80739
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleStarter.java
@@ -0,0 +1,150 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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 java.util.Map;
+
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.DefaultLifecycles;
+import org.apache.maven.lifecycle.MissingProjectException;
+import org.apache.maven.lifecycle.NoGoalSpecifiedException;
+import org.apache.maven.lifecycle.internal.builder.Builder;
+import org.apache.maven.lifecycle.internal.builder.BuilderNotFoundException;
+import org.apache.maven.session.scope.internal.SessionScope;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Starts the build life cycle
+ *
+ * @author Jason van Zyl
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold
+ */
+@Component( role = LifecycleStarter.class )
+public class LifecycleStarter
+{
+ @Requirement
+ private ExecutionEventCatapult eventCatapult;
+
+ @Requirement
+ private DefaultLifecycles defaultLifeCycles;
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private BuildListCalculator buildListCalculator;
+
+ @Requirement
+ private LifecycleDebugLogger lifecycleDebugLogger;
+
+ @Requirement
+ private LifecycleTaskSegmentCalculator lifecycleTaskSegmentCalculator;
+
+ @Requirement
+ private Map<String, Builder> builders;
+
+ @Requirement
+ private SessionScope sessionScope;
+
+ public void execute( MavenSession session )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.SessionStarted, session, null );
+
+ ReactorContext reactorContext = null;
+ ProjectBuildList projectBuilds = null;
+ MavenExecutionResult result = session.getResult();
+
+ try
+ {
+ if ( buildExecutionRequiresProject( session ) && projectIsNotPresent( session ) )
+ {
+ throw new MissingProjectException( "The goal you specified requires a project to execute"
+ + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")."
+ + " Please verify you invoked Maven from the correct directory." );
+ }
+
+ List<TaskSegment> taskSegments = lifecycleTaskSegmentCalculator.calculateTaskSegments( session );
+ projectBuilds = buildListCalculator.calculateProjectBuilds( session, taskSegments );
+
+ if ( projectBuilds.isEmpty() )
+ {
+ throw new NoGoalSpecifiedException( "No goals have been specified for this build."
+ + " You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or"
+ + " <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>."
+ + " Available lifecycle phases are: " + defaultLifeCycles.getLifecyclePhaseList() + "." );
+ }
+
+ ProjectIndex projectIndex = new ProjectIndex( session.getProjects() );
+
+ if ( logger.isDebugEnabled() )
+ {
+ lifecycleDebugLogger.debugReactorPlan( projectBuilds );
+ }
+
+ ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
+ ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() );
+ reactorContext =
+ new ReactorContext( result, projectIndex, oldContextClassLoader, reactorBuildStatus,
+ sessionScope.memento() );
+
+ String builderId = session.getRequest().getBuilderId();
+ Builder builder = builders.get( builderId );
+ if ( builder == null )
+ {
+ throw new BuilderNotFoundException( String.format( "The builder requested using id = %s cannot be"
+ + " found", builderId ) );
+ }
+
+ int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
+ if ( degreeOfConcurrency >= 2 )
+ {
+ logger.info( "" );
+ logger.info( String.format( "Using the %s implementation with a thread count of %d",
+ builder.getClass().getSimpleName(), degreeOfConcurrency ) );
+ }
+ builder.build( session, reactorContext, projectBuilds, taskSegments, reactorBuildStatus );
+
+ }
+ catch ( Exception e )
+ {
+ result.addException( e );
+ }
+ finally
+ {
+ eventCatapult.fire( ExecutionEvent.Type.SessionEnded, session, null );
+ }
+ }
+
+ private boolean buildExecutionRequiresProject( MavenSession session )
+ {
+ return lifecycleTaskSegmentCalculator.requiresProject( session );
+ }
+
+ private boolean projectIsNotPresent( MavenSession session )
+ {
+ return !session.getRequest().isProjectPresent();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java
new file mode 100644
index 00000000..0b5fff34
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTask.java
@@ -0,0 +1,50 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.
+ */
+
+/**
+ * A task that is a lifecycle
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public final class LifecycleTask
+{
+
+ private final String lifecyclePhase;
+
+ public LifecycleTask( String lifecyclePhase )
+ {
+ this.lifecyclePhase = lifecyclePhase;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getLifecyclePhase();
+ }
+
+ public String getLifecyclePhase()
+ {
+ return lifecyclePhase;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
new file mode 100644
index 00000000..a721355b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculator.java
@@ -0,0 +1,61 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+
+import java.util.List;
+
+/**
+ * Calculates the task segments in the build
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author jdcasey
+ * @author Kristian Rosenvold (extracted interface)
+ * <p/>
+ * NOTE: This interface is not part of any public api and can be changed or deleted without prior notice.
+ */
+
+public interface LifecycleTaskSegmentCalculator
+{
+ List<TaskSegment> calculateTaskSegments( MavenSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException;
+
+ List<TaskSegment> calculateTaskSegments( MavenSession session, List<String> tasks )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException;
+
+ boolean requiresProject( MavenSession session );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java
new file mode 100644
index 00000000..36c85fdd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java
@@ -0,0 +1,309 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.prefix.DefaultPluginPrefixRequest;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.prefix.PluginPrefixRequest;
+import org.apache.maven.plugin.prefix.PluginPrefixResolver;
+import org.apache.maven.plugin.prefix.PluginPrefixResult;
+import org.apache.maven.plugin.version.DefaultPluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.StringTokenizer;
+
+/**
+ * Resolves dependencies for the artifacts in context of the lifecycle build
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Jason van Zyl
+ * @author jdcasey
+ * @author Kristian Rosenvold (extracted class only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = MojoDescriptorCreator.class )
+public class MojoDescriptorCreator
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private PluginVersionResolver pluginVersionResolver;
+
+ @Requirement
+ private BuildPluginManager pluginManager;
+
+ @Requirement
+ private PluginPrefixResolver pluginPrefixResolver;
+
+ @Requirement
+ private LifecyclePluginResolver lifecyclePluginResolver;
+
+ public MojoDescriptorCreator()
+ {
+ }
+
+ public MojoDescriptorCreator( PluginVersionResolver pluginVersionResolver, BuildPluginManager pluginManager,
+ PluginPrefixResolver pluginPrefixResolver,
+ LifecyclePluginResolver lifecyclePluginResolver )
+ {
+ this.pluginVersionResolver = pluginVersionResolver;
+ this.pluginManager = pluginManager;
+ this.pluginPrefixResolver = pluginPrefixResolver;
+ this.lifecyclePluginResolver = lifecyclePluginResolver;
+ }
+
+ private Plugin findPlugin( String groupId, String artifactId, Collection<Plugin> plugins )
+ {
+ for ( Plugin plugin : plugins )
+ {
+ if ( artifactId.equals( plugin.getArtifactId() ) && groupId.equals( plugin.getGroupId() ) )
+ {
+ return plugin;
+ }
+ }
+
+ return null;
+ }
+
+ public static Xpp3Dom convert( MojoDescriptor mojoDescriptor )
+ {
+ Xpp3Dom dom = new Xpp3Dom( "configuration" );
+
+ PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();
+
+ PlexusConfiguration[] ces = c.getChildren();
+
+ if ( ces != null )
+ {
+ for ( PlexusConfiguration ce : ces )
+ {
+ String value = ce.getValue( null );
+ String defaultValue = ce.getAttribute( "default-value", null );
+ if ( value != null || defaultValue != null )
+ {
+ Xpp3Dom e = new Xpp3Dom( ce.getName() );
+ e.setValue( value );
+ if ( defaultValue != null )
+ {
+ e.setAttribute( "default-value", defaultValue );
+ }
+ dom.addChild( e );
+ }
+ }
+ }
+
+ return dom;
+ }
+
+ // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId
+
+ public MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
+ PluginVersionResolutionException
+ {
+ String goal = null;
+
+ Plugin plugin = null;
+
+ StringTokenizer tok = new StringTokenizer( task, ":" );
+
+ int numTokens = tok.countTokens();
+
+ if ( numTokens >= 4 )
+ {
+ // We have everything that we need
+ //
+ // org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
+ //
+ // groupId
+ // artifactId
+ // version
+ // goal
+ //
+ plugin = new Plugin();
+ plugin.setGroupId( tok.nextToken() );
+ plugin.setArtifactId( tok.nextToken() );
+ plugin.setVersion( tok.nextToken() );
+ goal = tok.nextToken();
+
+ // This won't be valid, but it constructs something easy to read in the error message
+ while ( tok.hasMoreTokens() )
+ {
+ goal += ":" + tok.nextToken();
+ }
+ }
+ else if ( numTokens == 3 )
+ {
+ // We have everything that we need except the version
+ //
+ // org.apache.maven.plugins:maven-remote-resources-plugin:???:process
+ //
+ // groupId
+ // artifactId
+ // ???
+ // goal
+ //
+ plugin = new Plugin();
+ plugin.setGroupId( tok.nextToken() );
+ plugin.setArtifactId( tok.nextToken() );
+ goal = tok.nextToken();
+ }
+ else if ( numTokens <= 2 )
+ {
+ // We have a prefix and goal
+ //
+ // idea:idea
+ //
+ String prefix = tok.nextToken();
+
+ if ( numTokens == 2 )
+ {
+ goal = tok.nextToken();
+ }
+ else
+ {
+ // goal was missing - pass through to MojoNotFoundException
+ goal = "";
+ }
+
+ // This is the case where someone has executed a single goal from the command line
+ // of the form:
+ //
+ // mvn remote-resources:process
+ //
+ // From the metadata stored on the server which has been created as part of a standard
+ // Maven plugin deployment we will find the right PluginDescriptor from the remote
+ // repository.
+
+ plugin = findPluginForPrefix( prefix, session );
+ }
+
+ int executionIdx = goal.indexOf( '@' );
+ if ( executionIdx > 0 )
+ {
+ goal = goal.substring( 0, executionIdx );
+ }
+
+ injectPluginDeclarationFromProject( plugin, project );
+
+ // If there is no version to be found then we need to look in the repository metadata for
+ // this plugin and see what's specified as the latest release.
+ //
+ if ( plugin.getVersion() == null )
+ {
+ resolvePluginVersion( plugin, session, project );
+ }
+
+ return pluginManager.getMojoDescriptor( plugin, goal, project.getRemotePluginRepositories(),
+ session.getRepositorySession() );
+ }
+
+ // TODO: take repo mans into account as one may be aggregating prefixes of many
+ // TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing
+ // or the user forces the issue
+
+ public Plugin findPluginForPrefix( String prefix, MavenSession session )
+ throws NoPluginFoundForPrefixException
+ {
+ // [prefix]:[goal]
+
+ if ( session.getCurrentProject() != null )
+ {
+ try
+ {
+ lifecyclePluginResolver.resolveMissingPluginVersions( session.getCurrentProject(), session );
+ }
+ catch ( PluginVersionResolutionException e )
+ {
+ // not critical here
+ logger.debug( e.getMessage(), e );
+ }
+ }
+
+ PluginPrefixRequest prefixRequest = new DefaultPluginPrefixRequest( prefix, session );
+ PluginPrefixResult prefixResult = pluginPrefixResolver.resolve( prefixRequest );
+
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( prefixResult.getGroupId() );
+ plugin.setArtifactId( prefixResult.getArtifactId() );
+
+ return plugin;
+ }
+
+ private void resolvePluginVersion( Plugin plugin, MavenSession session, MavenProject project )
+ throws PluginVersionResolutionException
+ {
+ PluginVersionRequest versionRequest =
+ new DefaultPluginVersionRequest( plugin, session.getRepositorySession(),
+ project.getRemotePluginRepositories() );
+ plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() );
+ }
+
+ private void injectPluginDeclarationFromProject( Plugin plugin, MavenProject project )
+ {
+ Plugin pluginInPom = findPlugin( plugin, project.getBuildPlugins() );
+
+ if ( pluginInPom == null && project.getPluginManagement() != null )
+ {
+ pluginInPom = findPlugin( plugin, project.getPluginManagement().getPlugins() );
+ }
+
+ if ( pluginInPom != null )
+ {
+ if ( plugin.getVersion() == null )
+ {
+ plugin.setVersion( pluginInPom.getVersion() );
+ }
+
+ plugin.setDependencies( new ArrayList<Dependency>( pluginInPom.getDependencies() ) );
+ }
+ }
+
+ private Plugin findPlugin( Plugin plugin, Collection<Plugin> plugins )
+ {
+ return findPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugins );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
new file mode 100644
index 00000000..a6ba752c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
@@ -0,0 +1,394 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.lifecycle.MissingProjectException;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.MavenPluginManager;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.PluginConfigurationException;
+import org.apache.maven.plugin.PluginIncompatibleException;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Executes an individual mojo
+ *
+ * @since 3.0
+ * @author Jason van Zyl
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = MojoExecutor.class )
+public class MojoExecutor
+{
+
+ @Requirement
+ private BuildPluginManager pluginManager;
+
+ @Requirement
+ private MavenPluginManager mavenPluginManager;
+
+ @Requirement
+ private LifecycleDependencyResolver lifeCycleDependencyResolver;
+
+ @Requirement
+ private ExecutionEventCatapult eventCatapult;
+
+ public MojoExecutor()
+ {
+ }
+
+ public DependencyContext newDependencyContext( MavenSession session, List<MojoExecution> mojoExecutions )
+ {
+ Set<String> scopesToCollect = new TreeSet<String>();
+ Set<String> scopesToResolve = new TreeSet<String>();
+
+ collectDependencyRequirements( scopesToResolve, scopesToCollect, mojoExecutions );
+
+ return new DependencyContext( session.getCurrentProject(), scopesToCollect, scopesToResolve );
+ }
+
+ private void collectDependencyRequirements( Set<String> scopesToResolve, Set<String> scopesToCollect,
+ Collection<MojoExecution> mojoExecutions )
+ {
+ for ( MojoExecution mojoExecution : mojoExecutions )
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ scopesToResolve.addAll( toScopes( mojoDescriptor.getDependencyResolutionRequired() ) );
+
+ scopesToCollect.addAll( toScopes( mojoDescriptor.getDependencyCollectionRequired() ) );
+ }
+ }
+
+ private Collection<String> toScopes( String classpath )
+ {
+ if ( StringUtils.isNotEmpty( classpath ) )
+ {
+ if ( Artifact.SCOPE_COMPILE.equals( classpath ) )
+ {
+ return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED );
+ }
+ else if ( Artifact.SCOPE_RUNTIME.equals( classpath ) )
+ {
+ return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME );
+ }
+ else if ( Artifact.SCOPE_COMPILE_PLUS_RUNTIME.equals( classpath ) )
+ {
+ return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED,
+ Artifact.SCOPE_RUNTIME );
+ }
+ else if ( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM.equals( classpath ) )
+ {
+ return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_RUNTIME );
+ }
+ else if ( Artifact.SCOPE_TEST.equals( classpath ) )
+ {
+ return Arrays.asList( Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED,
+ Artifact.SCOPE_RUNTIME, Artifact.SCOPE_TEST );
+ }
+ }
+ return Collections.emptyList();
+ }
+
+ public void execute( MavenSession session, List<MojoExecution> mojoExecutions, ProjectIndex projectIndex )
+ throws LifecycleExecutionException
+
+ {
+ DependencyContext dependencyContext = newDependencyContext( session, mojoExecutions );
+
+ PhaseRecorder phaseRecorder = new PhaseRecorder( session.getCurrentProject() );
+
+ for ( MojoExecution mojoExecution : mojoExecutions )
+ {
+ execute( session, mojoExecution, projectIndex, dependencyContext, phaseRecorder );
+ }
+ }
+
+ public void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
+ DependencyContext dependencyContext, PhaseRecorder phaseRecorder )
+ throws LifecycleExecutionException
+ {
+ execute( session, mojoExecution, projectIndex, dependencyContext );
+ phaseRecorder.observeExecution( mojoExecution );
+ }
+
+ private void execute( MavenSession session, MojoExecution mojoExecution, ProjectIndex projectIndex,
+ DependencyContext dependencyContext )
+ throws LifecycleExecutionException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ try
+ {
+ mavenPluginManager.checkRequiredMavenVersion( mojoDescriptor.getPluginDescriptor() );
+ }
+ catch ( PluginIncompatibleException e )
+ {
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
+ }
+
+ if ( mojoDescriptor.isProjectRequired() && !session.getRequest().isProjectPresent() )
+ {
+ Throwable cause =
+ new MissingProjectException( "Goal requires a project to execute"
+ + " but there is no POM in this directory (" + session.getExecutionRootDirectory() + ")."
+ + " Please verify you invoked Maven from the correct directory." );
+ throw new LifecycleExecutionException( mojoExecution, null, cause );
+ }
+
+ if ( mojoDescriptor.isOnlineRequired() && session.isOffline() )
+ {
+ if ( MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) )
+ {
+ Throwable cause =
+ new IllegalStateException( "Goal requires online mode for execution"
+ + " but Maven is currently offline." );
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), cause );
+ }
+ else
+ {
+ eventCatapult.fire( ExecutionEvent.Type.MojoSkipped, session, mojoExecution );
+
+ return;
+ }
+ }
+
+ List<MavenProject> forkedProjects = executeForkedExecutions( mojoExecution, session, projectIndex );
+
+ ensureDependenciesAreResolved( mojoDescriptor, session, dependencyContext );
+
+ eventCatapult.fire( ExecutionEvent.Type.MojoStarted, session, mojoExecution );
+
+ try
+ {
+ try
+ {
+ pluginManager.executeMojo( session, mojoExecution );
+ }
+ catch ( MojoFailureException e )
+ {
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
+ }
+ catch ( MojoExecutionException e )
+ {
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
+ }
+ catch ( PluginConfigurationException e )
+ {
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
+ }
+ catch ( PluginManagerException e )
+ {
+ throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
+ }
+
+ eventCatapult.fire( ExecutionEvent.Type.MojoSucceeded, session, mojoExecution );
+ }
+ catch ( LifecycleExecutionException e )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.MojoFailed, session, mojoExecution, e );
+
+ throw e;
+ }
+ finally
+ {
+ for ( MavenProject forkedProject : forkedProjects )
+ {
+ forkedProject.setExecutionProject( null );
+ }
+ }
+ }
+
+ public void ensureDependenciesAreResolved( MojoDescriptor mojoDescriptor, MavenSession session,
+ DependencyContext dependencyContext )
+ throws LifecycleExecutionException
+
+ {
+ MavenProject project = dependencyContext.getProject();
+ boolean aggregating = mojoDescriptor.isAggregator();
+
+ if ( dependencyContext.isResolutionRequiredForCurrentProject() )
+ {
+ Collection<String> scopesToCollect = dependencyContext.getScopesToCollectForCurrentProject();
+ Collection<String> scopesToResolve = dependencyContext.getScopesToResolveForCurrentProject();
+
+ lifeCycleDependencyResolver.resolveProjectDependencies( project, scopesToCollect, scopesToResolve, session,
+ aggregating, Collections.<Artifact>emptySet() );
+
+ dependencyContext.synchronizeWithProjectState();
+ }
+
+ if ( aggregating )
+ {
+ Collection<String> scopesToCollect = toScopes( mojoDescriptor.getDependencyCollectionRequired() );
+ Collection<String> scopesToResolve = toScopes( mojoDescriptor.getDependencyResolutionRequired() );
+
+ if ( dependencyContext.isResolutionRequiredForAggregatedProjects( scopesToCollect, scopesToResolve ) )
+ {
+ for ( MavenProject aggregatedProject : session.getProjects() )
+ {
+ if ( aggregatedProject != project )
+ {
+ lifeCycleDependencyResolver.resolveProjectDependencies( aggregatedProject, scopesToCollect,
+ scopesToResolve, session, aggregating,
+ Collections.<Artifact>emptySet() );
+ }
+ }
+ }
+ }
+
+ ArtifactFilter artifactFilter = getArtifactFilter( mojoDescriptor );
+ List<MavenProject> projectsToResolve =
+ LifecycleDependencyResolver.getProjects( session.getCurrentProject(), session,
+ mojoDescriptor.isAggregator() );
+ for ( MavenProject projectToResolve : projectsToResolve )
+ {
+ projectToResolve.setArtifactFilter( artifactFilter );
+ }
+ }
+
+ private ArtifactFilter getArtifactFilter( MojoDescriptor mojoDescriptor )
+ {
+ String scopeToResolve = mojoDescriptor.getDependencyResolutionRequired();
+ String scopeToCollect = mojoDescriptor.getDependencyCollectionRequired();
+
+ List<String> scopes = new ArrayList<String>( 2 );
+ if ( StringUtils.isNotEmpty( scopeToCollect ) )
+ {
+ scopes.add( scopeToCollect );
+ }
+ if ( StringUtils.isNotEmpty( scopeToResolve ) )
+ {
+ scopes.add( scopeToResolve );
+ }
+
+ if ( scopes.isEmpty() )
+ {
+ return null;
+ }
+ else
+ {
+ return new CumulativeScopeArtifactFilter( scopes );
+ }
+ }
+
+ public List<MavenProject> executeForkedExecutions( MojoExecution mojoExecution, MavenSession session,
+ ProjectIndex projectIndex )
+ throws LifecycleExecutionException
+ {
+ List<MavenProject> forkedProjects = Collections.emptyList();
+
+ Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions();
+
+ if ( !forkedExecutions.isEmpty() )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.ForkStarted, session, mojoExecution );
+
+ MavenProject project = session.getCurrentProject();
+
+ forkedProjects = new ArrayList<MavenProject>( forkedExecutions.size() );
+
+ try
+ {
+ for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() )
+ {
+ String projectId = fork.getKey();
+
+ int index = projectIndex.getIndices().get( projectId );
+
+ MavenProject forkedProject = projectIndex.getProjects().get( projectId );
+
+ forkedProjects.add( forkedProject );
+
+ MavenProject executedProject = forkedProject.clone();
+
+ forkedProject.setExecutionProject( executedProject );
+
+ List<MojoExecution> mojoExecutions = fork.getValue();
+
+ if ( mojoExecutions.isEmpty() )
+ {
+ continue;
+ }
+
+ try
+ {
+ session.setCurrentProject( executedProject );
+ session.getProjects().set( index, executedProject );
+ projectIndex.getProjects().put( projectId, executedProject );
+
+ eventCatapult.fire( ExecutionEvent.Type.ForkedProjectStarted, session, mojoExecution );
+
+ execute( session, mojoExecutions, projectIndex );
+
+ eventCatapult.fire( ExecutionEvent.Type.ForkedProjectSucceeded, session, mojoExecution );
+ }
+ catch ( LifecycleExecutionException e )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.ForkedProjectFailed, session, mojoExecution, e );
+
+ throw e;
+ }
+ finally
+ {
+ projectIndex.getProjects().put( projectId, forkedProject );
+ session.getProjects().set( index, forkedProject );
+ session.setCurrentProject( project );
+ }
+ }
+
+ eventCatapult.fire( ExecutionEvent.Type.ForkSucceeded, session, mojoExecution );
+ }
+ catch ( LifecycleExecutionException e )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.ForkFailed, session, mojoExecution, e );
+
+ throw e;
+ }
+ }
+
+ return forkedProjects;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java
new file mode 100644
index 00000000..a09a3cb9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/PhaseRecorder.java
@@ -0,0 +1,78 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.plugin.MojoExecution;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public class PhaseRecorder
+{
+ private String lastLifecyclePhase;
+
+ private final MavenProject project;
+
+ public PhaseRecorder( MavenProject project )
+ {
+ this.project = project;
+ }
+
+ public void observeExecution( MojoExecution mojoExecution )
+ {
+ String lifecyclePhase = mojoExecution.getLifecyclePhase();
+
+ if ( lifecyclePhase != null )
+ {
+ if ( lastLifecyclePhase == null )
+ {
+ lastLifecyclePhase = lifecyclePhase;
+ }
+ else if ( !lifecyclePhase.equals( lastLifecyclePhase ) )
+ {
+ project.addLifecyclePhase( lastLifecyclePhase );
+ lastLifecyclePhase = lifecyclePhase;
+ }
+ }
+
+ if ( lastLifecyclePhase != null )
+ {
+ project.addLifecyclePhase( lastLifecyclePhase );
+ }
+ }
+
+ public boolean isDifferentPhase( MojoExecution nextMojoExecution )
+ {
+ String lifecyclePhase = nextMojoExecution.getLifecyclePhase();
+ if ( lifecyclePhase == null )
+ {
+ return lastLifecyclePhase != null;
+ }
+ return !lifecyclePhase.equals( lastLifecyclePhase );
+
+ }
+
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java
new file mode 100644
index 00000000..b4a81075
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectArtifactFactory.java
@@ -0,0 +1,38 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+
+/**
+ * Component interface responsible for creation of MavenProject#dependencyArtifacts instances.
+ *
+ * @since 3.2.4
+ * @provisional This interface is part of work in progress and can be changed or removed without notice.
+ */
+public interface ProjectArtifactFactory
+{
+ Set<Artifact> createArtifacts( MavenProject project )
+ throws InvalidDependencyVersionException;
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java
new file mode 100644
index 00000000..6c8fd50a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectBuildList.java
@@ -0,0 +1,158 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * A list of project segments, ordered so that all ProjectSegments from first TaskSegment come before any
+ * subsequent TaskSegments.
+ *
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public class ProjectBuildList
+ implements Iterable<ProjectSegment>
+{
+ private final List<ProjectSegment> items;
+
+ public ProjectBuildList( List<ProjectSegment> items )
+ {
+ this.items = Collections.unmodifiableList( items );
+ }
+
+ // TODO: Optimize; or maybe just rewrite the whole way aggregating mojos are being run.
+ /**
+ * Returns aProjectBuildList that contains only items for the specified taskSegment
+ * @param taskSegment the requested tasksegment
+ * @return a project build list for the supplied task segment
+ */
+ public ProjectBuildList getByTaskSegment( TaskSegment taskSegment )
+ {
+ List<ProjectSegment> currentSegment = new ArrayList<ProjectSegment>();
+ for ( ProjectSegment projectBuild : items )
+ {
+ if ( taskSegment == projectBuild.getTaskSegment() )
+ { // NOTE: There's no notion of taskSegment equality.
+ currentSegment.add( projectBuild );
+ }
+ }
+ return new ProjectBuildList( currentSegment );
+ }
+
+ public Map<MavenProject, ProjectSegment> selectSegment( TaskSegment taskSegment )
+ {
+ Map<MavenProject, ProjectSegment> result = new HashMap<MavenProject, ProjectSegment>();
+ for ( ProjectSegment projectBuild : items )
+ {
+ if ( taskSegment == projectBuild.getTaskSegment() )
+ { // NOTE: There's no notion of taskSegment equality.
+ result.put( projectBuild.getProject(), projectBuild );
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Finds the first ProjectSegment matching the supplied project
+ * @param mavenProject the requested project
+ * @return The projectSegment or null.
+ */
+ public ProjectSegment findByMavenProject( MavenProject mavenProject )
+ {
+ for ( ProjectSegment projectBuild : items )
+ {
+ if ( mavenProject.equals( projectBuild.getProject() ) )
+ {
+ return projectBuild;
+ }
+ }
+ return null;
+ }
+
+ public Iterator<ProjectSegment> iterator()
+ {
+ return items.iterator();
+ }
+
+ public void closeAll()
+ {
+ for ( ProjectSegment item : items )
+ {
+ MavenSession sessionForThisModule = item.getSession();
+ sessionForThisModule.setCurrentProject( null );
+ }
+ }
+
+ public int size()
+ {
+ return items.size();
+ }
+
+ public ProjectSegment get( int index )
+ {
+ return items.get( index );
+ }
+
+ public Set<String> getReactorProjectKeys()
+ {
+ Set<String> projectKeys = new HashSet<String>( items.size() * 2 );
+ for ( ProjectSegment projectBuild : items )
+ {
+ MavenProject project = projectBuild.getProject();
+ String key = ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
+ projectKeys.add( key );
+ }
+ return projectKeys;
+ }
+
+
+ public boolean isEmpty()
+ {
+ return items.isEmpty();
+ }
+
+ /**
+ * @return a set of all the projects managed by the build
+ */
+ public Set<MavenProject> getProjects()
+ {
+ Set<MavenProject> projects = new HashSet<MavenProject>();
+
+ for ( ProjectSegment s : items )
+ {
+ projects.add( s.getProject() );
+ }
+ return projects;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java
new file mode 100644
index 00000000..b1b1d186
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectIndex.java
@@ -0,0 +1,70 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.project.MavenProject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Provides the positional index of the project
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (extracted class only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+// Todo: Kristian wonders if this class really is necessary and if it overlaps other concepts.
+public final class ProjectIndex
+{
+
+ private final Map<String, MavenProject> projects;
+
+ private final Map<String, Integer> indices;
+
+ public ProjectIndex( List<MavenProject> projects )
+ {
+ this.projects = new HashMap<String, MavenProject>( projects.size() * 2 );
+ this.indices = new HashMap<String, Integer>( projects.size() * 2 );
+
+ for ( int i = 0; i < projects.size(); i++ )
+ {
+ MavenProject project = projects.get( i );
+ String key = BuilderCommon.getKey( project );
+
+ this.getProjects().put( key, project );
+ this.getIndices().put( key, i );
+ }
+ }
+
+ public Map<String, MavenProject> getProjects()
+ {
+ return projects;
+ }
+
+ public Map<String, Integer> getIndices()
+ {
+ return indices;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java
new file mode 100644
index 00000000..5ef77454
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ProjectSegment.java
@@ -0,0 +1,106 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.project.MavenProject;
+
+import java.util.List;
+
+/**
+ * A build context that matches a mavenproject to a given tasksegment, and the session to be used.
+ * <p/>
+ * A note to the reader;
+ * <p/>
+ * There are several issues/discussions regarding how "aggregator" plugins should be handled.
+ * Read for instance http://docs.codehaus.org/display/MAVEN/Deterministic+Lifecycle+Planning
+ * <p/>
+ * In their current implementation they are "bolted" onto the lifecycle by separating them
+ * into TaskSegments. This class represents the execution context of one such task segment.
+ * <p/>
+ * Wise voices have suggested that maybe aggregators shouldn't be bound to the ordinary
+ * lifecycle at all, in which case we wouldn't be needing this class at all ( and
+ * ProjectBuildList.getByTaskSegments). Or maybe they should be introduced in the calculation
+ * of the execution plan instead, which seems much nicer.
+ * <p/>
+ * Additionally this class contains a clone of the MavenSession, which is *only* needed
+ * because it has as notion of a "current" project.
+ *
+ * @since 3.0
+ * @author Jason van Zyl
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public final class ProjectSegment
+{
+ private final MavenProject project;
+
+ private final TaskSegment taskSegment;
+
+ private final MavenSession session;
+
+ private final List<MavenProject> nonTransitiveUpstreamProjects;
+
+ private final List<MavenProject> transitiveUpstreamProjects;
+
+ public ProjectSegment( MavenProject project, TaskSegment taskSegment, MavenSession copiedSession )
+ {
+ this.project = project;
+ this.taskSegment = taskSegment;
+ this.session = copiedSession;
+ final ProjectDependencyGraph dependencyGraph = getSession().getProjectDependencyGraph();
+ nonTransitiveUpstreamProjects = dependencyGraph.getUpstreamProjects( getProject(), false );
+ transitiveUpstreamProjects = dependencyGraph.getUpstreamProjects( getProject(), true );
+ }
+
+ public MavenSession getSession()
+ {
+ return session;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public TaskSegment getTaskSegment()
+ {
+ return taskSegment;
+ }
+
+ public List<MavenProject> getImmediateUpstreamProjects()
+ {
+ return nonTransitiveUpstreamProjects;
+ }
+
+ public List<MavenProject> getTransitiveUpstreamProjects()
+ {
+ return transitiveUpstreamProjects;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getProject().getId() + " -> " + getTaskSegment();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java
new file mode 100644
index 00000000..2e2c3fd4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorBuildStatus.java
@@ -0,0 +1,80 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.ProjectDependencyGraph;
+import org.apache.maven.lifecycle.internal.builder.BuilderCommon;
+import org.apache.maven.project.MavenProject;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+/**
+ * Contains status information that is global to an entire reactor build.
+ *
+ * @since 3.0
+ * @author <a href="mailto:kristian.rosenvold@gmail.com">Kristian Rosenvold</a>
+ */
+public class ReactorBuildStatus
+{
+ private final ProjectDependencyGraph projectDependencyGraph;
+
+ private final Collection<String> blackListedProjects = Collections.synchronizedSet( new HashSet<String>() );
+
+ private volatile boolean halted = false;
+
+ public ReactorBuildStatus( ProjectDependencyGraph projectDependencyGraph )
+ {
+ this.projectDependencyGraph = projectDependencyGraph;
+ }
+
+ public boolean isBlackListed( MavenProject project )
+ {
+ return blackListedProjects.contains( BuilderCommon.getKey( project ) );
+ }
+
+ public void blackList( MavenProject project )
+ {
+ if ( blackListedProjects.add( BuilderCommon.getKey( project ) ) && projectDependencyGraph != null )
+ {
+ for ( MavenProject downstreamProject : projectDependencyGraph.getDownstreamProjects( project, true ) )
+ {
+ blackListedProjects.add( BuilderCommon.getKey( downstreamProject ) );
+ }
+ }
+ }
+
+ public void halt()
+ {
+ halted = true;
+ }
+
+ public boolean isHalted()
+ {
+ return halted;
+ }
+
+ public boolean isHaltedOrBlacklisted( MavenProject mavenProject )
+ {
+ return isBlackListed( mavenProject ) || isHalted();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java
new file mode 100644
index 00000000..7df53140
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ReactorContext.java
@@ -0,0 +1,83 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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.execution.MavenExecutionResult;
+import org.apache.maven.session.scope.internal.SessionScope;
+
+/**
+ * Context that is fixed for the entire reactor build.
+ *
+ * @since 3.0
+ * @author Jason van Zyl
+ * @author Kristian Rosenvold
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public class ReactorContext
+{
+ private final MavenExecutionResult result;
+
+ private final ProjectIndex projectIndex;
+
+ private final ClassLoader originalContextClassLoader;
+
+ private final ReactorBuildStatus reactorBuildStatus;
+
+ private final SessionScope.Memento sessionScope;
+
+ public ReactorContext( MavenExecutionResult result, ProjectIndex projectIndex,
+ ClassLoader originalContextClassLoader, ReactorBuildStatus reactorBuildStatus,
+ SessionScope.Memento sessionScope )
+ {
+ this.result = result;
+ this.projectIndex = projectIndex;
+ this.originalContextClassLoader = originalContextClassLoader;
+ this.reactorBuildStatus = reactorBuildStatus;
+ this.sessionScope = sessionScope;
+ }
+
+ public ReactorBuildStatus getReactorBuildStatus()
+ {
+ return reactorBuildStatus;
+ }
+
+ public MavenExecutionResult getResult()
+ {
+ return result;
+ }
+
+ public ProjectIndex getProjectIndex()
+ {
+ return projectIndex;
+ }
+
+ public ClassLoader getOriginalContextClassLoader()
+ {
+ return originalContextClassLoader;
+ }
+
+ /**
+ * @since 3.3.0
+ */
+ public SessionScope.Memento getSessionScopeMemento()
+ {
+ return sessionScope;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java
new file mode 100644
index 00000000..9551887c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/TaskSegment.java
@@ -0,0 +1,73 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * 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;
+
+/**
+ * Describes the required task segment as provided on the maven command line; i.e. "clean jetty:run install"
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ * @author Kristian Rosenvold (extracted class only)
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public final class TaskSegment
+{
+
+ // Can be both "LifeCycleTask" (clean/install) and "GoalTask" (org.mortbay.jetty:maven-jetty-plugin:6.1.19:run)
+
+ private final List<Object> tasks;
+
+ private final boolean aggregating;
+
+ public TaskSegment( boolean aggregating )
+ {
+ this.aggregating = aggregating;
+ tasks = new ArrayList<Object>();
+ }
+
+ public TaskSegment( boolean aggregating, Object... tasks )
+ {
+ this.aggregating = aggregating;
+ this.tasks = new ArrayList<Object>( Arrays.asList( tasks ) );
+ }
+
+ @Override
+ public String toString()
+ {
+ return getTasks().toString();
+ }
+
+ public List<Object> getTasks()
+ {
+ return tasks;
+ }
+
+ public boolean isAggregating()
+ {
+ return aggregating;
+ }
+
+ // TODO: Consider throwing UnsupprtedSomething on hashCode/equals
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java
new file mode 100644
index 00000000..155abf92
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/Builder.java
@@ -0,0 +1,47 @@
+package org.apache.maven.lifecycle.internal.builder;
+
+/*
+ * 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 java.util.concurrent.ExecutionException;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.internal.ProjectBuildList;
+import org.apache.maven.lifecycle.internal.ReactorBuildStatus;
+import org.apache.maven.lifecycle.internal.ReactorContext;
+import org.apache.maven.lifecycle.internal.TaskSegment;
+
+/**
+ * A {@link Builder} encapsulates a strategy for building a set of Maven projects. The default strategy in Maven builds
+ * the the projects serially, but a {@link Builder} can employ any type of concurrency model to build the projects.
+ *
+ * @author jvanzyl
+ * @provisional
+ */
+public interface Builder
+{
+ //
+ // Be nice to whittle this down to Session, maybe add task segments to the session. The session really is the
+ // the place to store reactor related information.
+ //
+ void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds,
+ List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus )
+ throws ExecutionException, InterruptedException;
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
new file mode 100644
index 00000000..34fb323e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
@@ -0,0 +1,199 @@
+package org.apache.maven.lifecycle.internal.builder;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.execution.BuildFailure;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.lifecycle.LifecycleNotFoundException;
+import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
+import org.apache.maven.lifecycle.MavenExecutionPlan;
+import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
+import org.apache.maven.lifecycle.internal.LifecycleDebugLogger;
+import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
+import org.apache.maven.lifecycle.internal.ReactorContext;
+import org.apache.maven.lifecycle.internal.TaskSegment;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+
+import java.util.Set;
+
+/**
+ * Common code that is shared by the LifecycleModuleBuilder and the LifeCycleWeaveBuilder
+ *
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * Builds one or more lifecycles for a full module
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = BuilderCommon.class )
+public class BuilderCommon
+{
+ @Requirement
+ private LifecycleDebugLogger lifecycleDebugLogger;
+
+ @Requirement
+ private LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator;
+
+ @Requirement
+ private ExecutionEventCatapult eventCatapult;
+
+ @Requirement
+ private Logger logger;
+
+
+ public BuilderCommon()
+ {
+ }
+
+ public BuilderCommon( LifecycleDebugLogger lifecycleDebugLogger,
+ LifecycleExecutionPlanCalculator lifeCycleExecutionPlanCalculator, Logger logger )
+ {
+ this.lifecycleDebugLogger = lifecycleDebugLogger;
+ this.lifeCycleExecutionPlanCalculator = lifeCycleExecutionPlanCalculator;
+ this.logger = logger;
+ }
+
+ public MavenExecutionPlan resolveBuildPlan( MavenSession session, MavenProject project, TaskSegment taskSegment,
+ Set<Artifact> projectArtifacts )
+ throws PluginNotFoundException, PluginResolutionException, LifecyclePhaseNotFoundException,
+ PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException,
+ NoPluginFoundForPrefixException, LifecycleNotFoundException, PluginVersionResolutionException,
+ LifecycleExecutionException
+ {
+ MavenExecutionPlan executionPlan =
+ lifeCycleExecutionPlanCalculator.calculateExecutionPlan( session, project, taskSegment.getTasks() );
+
+ lifecycleDebugLogger.debugProjectPlan( project, executionPlan );
+
+ if ( session.getRequest().getDegreeOfConcurrency() > 1 )
+ {
+ final Set<Plugin> unsafePlugins = executionPlan.getNonThreadSafePlugins();
+ if ( !unsafePlugins.isEmpty() && logger.isDebugEnabled() )
+ {
+ logger.warn( "*****************************************************************" );
+ logger.warn( "* Your build is requesting parallel execution, but project *" );
+ logger.warn( "* contains the following plugin(s) that have goals not marked *" );
+ logger.warn( "* as @threadSafe to support parallel building. *" );
+ logger.warn( "* While this /may/ work fine, please look for plugin updates *" );
+ logger.warn( "* and/or request plugins be made thread-safe. *" );
+ logger.warn( "* If reporting an issue, report it against the plugin in *" );
+ logger.warn( "* question, not against maven-core *" );
+ logger.warn( "*****************************************************************" );
+ if ( logger.isDebugEnabled() )
+ {
+ final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos();
+ logger.warn( "The following goals are not marked @threadSafe in " + project.getName() + ":" );
+ for ( MojoDescriptor unsafeGoal : unsafeGoals )
+ {
+ logger.warn( unsafeGoal.getId() );
+ }
+ }
+ else
+ {
+ logger.warn( "The following plugins are not marked @threadSafe in " + project.getName() + ":" );
+ for ( Plugin unsafePlugin : unsafePlugins )
+ {
+ logger.warn( unsafePlugin.getId() );
+ }
+ logger.warn( "Enable debug to see more precisely which goals are not marked @threadSafe." );
+ }
+ logger.warn( "*****************************************************************" );
+ }
+ }
+
+ return executionPlan;
+ }
+
+ public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession,
+ final MavenSession currentSession, final MavenProject mavenProject, Throwable t,
+ final long buildStartTime )
+ {
+ // record the error and mark the project as failed
+ long buildEndTime = System.currentTimeMillis();
+ buildContext.getResult().addException( t );
+ buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, t ) );
+
+ // notify listeners about "soft" project build failures only
+ if ( t instanceof Exception && !( t instanceof RuntimeException ) )
+ {
+ eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, currentSession, null, (Exception) t );
+ }
+
+ // reactor failure modes
+ if ( t instanceof RuntimeException || !( t instanceof Exception ) )
+ {
+ // fail fast on RuntimeExceptions, Errors and "other" Throwables
+ // assume these are system errors and further build is meaningless
+ buildContext.getReactorBuildStatus().halt();
+ }
+ else if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) )
+ {
+ // continue the build
+ }
+ else if ( MavenExecutionRequest.REACTOR_FAIL_AT_END.equals( rootSession.getReactorFailureBehavior() ) )
+ {
+ // continue the build but ban all projects that depend on the failed one
+ buildContext.getReactorBuildStatus().blackList( mavenProject );
+ }
+ else if ( MavenExecutionRequest.REACTOR_FAIL_FAST.equals( rootSession.getReactorFailureBehavior() ) )
+ {
+ buildContext.getReactorBuildStatus().halt();
+ }
+ else
+ {
+ logger.error( "invalid reactor failure behavior " + rootSession.getReactorFailureBehavior() );
+ buildContext.getReactorBuildStatus().halt();
+ }
+ }
+
+ public static void attachToThread( MavenProject currentProject )
+ {
+ ClassRealm projectRealm = currentProject.getClassRealm();
+ if ( projectRealm != null )
+ {
+ Thread.currentThread().setContextClassLoader( projectRealm );
+ }
+ }
+
+ // Todo: I'm really wondering where this method belongs; smells like it should be on MavenProject, but for some
+ // reason it isn't ? This localization is kind-of a code smell.
+
+ public static String getKey( MavenProject project )
+ {
+ return project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java
new file mode 100644
index 00000000..52c668f1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderNotFoundException.java
@@ -0,0 +1,29 @@
+package org.apache.maven.lifecycle.internal.builder;
+
+/*
+ * 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.
+ */
+
+public class BuilderNotFoundException
+ extends Exception
+{
+ public BuilderNotFoundException( String message )
+ {
+ super( message );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
new file mode 100644
index 00000000..de6a5a31
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraph.java
@@ -0,0 +1,153 @@
+package org.apache.maven.lifecycle.internal.builder.multithreaded;
+
+/*
+ * 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.execution.ProjectDependencyGraph;
+import org.apache.maven.lifecycle.internal.ProjectBuildList;
+import org.apache.maven.lifecycle.internal.ProjectSegment;
+import org.apache.maven.project.MavenProject;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Presents a view of the Dependency Graph that is suited for concurrent building.
+ *
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+public class ConcurrencyDependencyGraph
+{
+
+ private final ProjectBuildList projectBuilds;
+
+ private final ProjectDependencyGraph projectDependencyGraph;
+
+ private final HashSet<MavenProject> finishedProjects = new HashSet<MavenProject>();
+
+ public ConcurrencyDependencyGraph( ProjectBuildList projectBuilds, ProjectDependencyGraph projectDependencyGraph )
+ {
+ this.projectDependencyGraph = projectDependencyGraph;
+ this.projectBuilds = projectBuilds;
+ }
+
+ public int getNumberOfBuilds()
+ {
+ return projectBuilds.size();
+ }
+
+ /**
+ * Gets all the builds that have no reactor-dependencies
+ *
+ * @return A list of all the initial builds
+ */
+
+ public List<MavenProject> getRootSchedulableBuilds()
+ {
+ List<MavenProject> result = new ArrayList<MavenProject>();
+ for ( ProjectSegment projectBuild : projectBuilds )
+ {
+ if ( projectDependencyGraph.getUpstreamProjects( projectBuild.getProject(), false ).size() == 0 )
+ {
+ result.add( projectBuild.getProject() );
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Marks the provided project as finished. Returns a list of
+ *
+ * @param mavenProject The project
+ * @return The list of builds that are eligible for starting now that the provided project is done
+ */
+ public List<MavenProject> markAsFinished( MavenProject mavenProject )
+ {
+ finishedProjects.add( mavenProject );
+ return getSchedulableNewProcesses( mavenProject );
+ }
+
+ private List<MavenProject> getSchedulableNewProcesses( MavenProject finishedProject )
+ {
+ List<MavenProject> result = new ArrayList<MavenProject>();
+ // schedule dependent projects, if all of their requirements are met
+ for ( MavenProject dependentProject : projectDependencyGraph.getDownstreamProjects( finishedProject, false ) )
+ {
+ final List<MavenProject> upstreamProjects =
+ projectDependencyGraph.getUpstreamProjects( dependentProject, false );
+ if ( finishedProjects.containsAll( upstreamProjects ) )
+ {
+ result.add( dependentProject );
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return set of projects that have yet to be processed successfully by the build.
+ */
+ public Set<MavenProject> getUnfinishedProjects()
+ {
+ Set<MavenProject> unfinished = new HashSet<MavenProject>( projectBuilds.getProjects() );
+ unfinished.remove( finishedProjects );
+ return unfinished;
+ }
+
+ /**
+ * @return set of projects that have been successfully processed by the build.
+ */
+ protected Set<MavenProject> getFinishedProjects()
+ {
+ return finishedProjects;
+ }
+
+ protected ProjectBuildList getProjectBuilds()
+ {
+ return projectBuilds;
+ }
+
+ /**
+ * For the given {@link MavenProject} {@code p}, return all of {@code p}'s dependencies.
+ *
+ * @param p
+ * @return List of prerequisite projects
+ */
+ protected List<MavenProject> getDependencies( MavenProject p )
+ {
+ return projectDependencyGraph.getUpstreamProjects( p, false );
+ }
+
+ /**
+ * For the given {@link MavenProject} {@code p} return {@code p}'s uncompleted dependencies.
+ *
+ * @param p
+ * @return List of uncompleted prerequisite projects
+ */
+ public List<MavenProject> getActiveDependencies( MavenProject p )
+ {
+ List<MavenProject> activeDependencies = projectDependencyGraph.getUpstreamProjects( p, false );
+ activeDependencies.removeAll( finishedProjects );
+ return activeDependencies;
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java
new file mode 100644
index 00000000..906e5e75
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java
@@ -0,0 +1,197 @@
+package org.apache.maven.lifecycle.internal.builder.multithreaded;
+
+/*
+ * 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 java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionService;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.internal.BuildThreadFactory;
+import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
+import org.apache.maven.lifecycle.internal.ProjectBuildList;
+import org.apache.maven.lifecycle.internal.ProjectSegment;
+import org.apache.maven.lifecycle.internal.ReactorBuildStatus;
+import org.apache.maven.lifecycle.internal.ReactorContext;
+import org.apache.maven.lifecycle.internal.TaskSegment;
+import org.apache.maven.lifecycle.internal.builder.Builder;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Builds the full lifecycle in weave-mode (phase by phase as opposed to project-by-project)
+ *
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * Builds one or more lifecycles for a full module
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ */
+@Component( role = Builder.class, hint = "multithreaded" )
+public class MultiThreadedBuilder
+ implements Builder
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private LifecycleModuleBuilder lifecycleModuleBuilder;
+
+
+ public MultiThreadedBuilder()
+ {
+ }
+
+ @Override
+ public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds,
+ List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus )
+ throws ExecutionException, InterruptedException
+ {
+ ExecutorService executor =
+ Executors.newFixedThreadPool( Math.min( session.getRequest().getDegreeOfConcurrency(),
+ session.getProjects().size() ), new BuildThreadFactory() );
+ CompletionService<ProjectSegment> service = new ExecutorCompletionService<ProjectSegment>( executor );
+ ConcurrencyDependencyGraph analyzer =
+ new ConcurrencyDependencyGraph( projectBuilds, session.getProjectDependencyGraph() );
+
+ // Currently disabled
+ ThreadOutputMuxer muxer = null; // new ThreadOutputMuxer( analyzer.getProjectBuilds(), System.out );
+
+ for ( TaskSegment taskSegment : taskSegments )
+ {
+ Map<MavenProject, ProjectSegment> projectBuildMap = projectBuilds.selectSegment( taskSegment );
+ try
+ {
+ multiThreadedProjectTaskSegmentBuild( analyzer, reactorContext, session, service, taskSegment,
+ projectBuildMap, muxer );
+ if ( reactorContext.getReactorBuildStatus().isHalted() )
+ {
+ break;
+ }
+ }
+ catch ( Exception e )
+ {
+ session.getResult().addException( e );
+ break;
+ }
+
+ }
+ }
+
+ private void multiThreadedProjectTaskSegmentBuild( ConcurrencyDependencyGraph analyzer,
+ ReactorContext reactorContext, MavenSession rootSession,
+ CompletionService<ProjectSegment> service,
+ TaskSegment taskSegment,
+ Map<MavenProject, ProjectSegment> projectBuildList,
+ ThreadOutputMuxer muxer )
+ {
+
+ // schedule independent projects
+ for ( MavenProject mavenProject : analyzer.getRootSchedulableBuilds() )
+ {
+ ProjectSegment projectSegment = projectBuildList.get( mavenProject );
+ logger.debug( "Scheduling: " + projectSegment.getProject() );
+ Callable<ProjectSegment> cb =
+ createBuildCallable( rootSession, projectSegment, reactorContext, taskSegment, muxer );
+ service.submit( cb );
+ }
+
+ // for each finished project
+ for ( int i = 0; i < analyzer.getNumberOfBuilds(); i++ )
+ {
+ try
+ {
+ ProjectSegment projectBuild = service.take().get();
+ if ( reactorContext.getReactorBuildStatus().isHalted() )
+ {
+ break;
+ }
+ final List<MavenProject> newItemsThatCanBeBuilt =
+ analyzer.markAsFinished( projectBuild.getProject() );
+ for ( MavenProject mavenProject : newItemsThatCanBeBuilt )
+ {
+ ProjectSegment scheduledDependent = projectBuildList.get( mavenProject );
+ logger.debug( "Scheduling: " + scheduledDependent );
+ Callable<ProjectSegment> cb =
+ createBuildCallable( rootSession, scheduledDependent, reactorContext, taskSegment, muxer );
+ service.submit( cb );
+ }
+ }
+ catch ( InterruptedException e )
+ {
+ rootSession.getResult().addException( e );
+ break;
+ }
+ catch ( ExecutionException e )
+ {
+ // TODO MNG-5766 changes likely made this redundant
+ rootSession.getResult().addException( e );
+ break;
+ }
+ }
+
+ // cancel outstanding builds (if any) - this can happen if an exception is thrown in above block
+
+ Future<ProjectSegment> unprocessed;
+ while ( ( unprocessed = service.poll() ) != null )
+ {
+ try
+ {
+ unprocessed.get();
+ }
+ catch ( InterruptedException e )
+ {
+ throw new RuntimeException( e );
+ }
+ catch ( ExecutionException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ }
+
+ private Callable<ProjectSegment> createBuildCallable( final MavenSession rootSession,
+ final ProjectSegment projectBuild,
+ final ReactorContext reactorContext,
+ final TaskSegment taskSegment, final ThreadOutputMuxer muxer )
+ {
+ return new Callable<ProjectSegment>()
+ {
+ public ProjectSegment call()
+ {
+ // muxer.associateThreadWithProjectSegment( projectBuild );
+ lifecycleModuleBuilder.buildProject( projectBuild.getSession(), rootSession, reactorContext,
+ projectBuild.getProject(), taskSegment );
+ // muxer.setThisModuleComplete( projectBuild );
+
+ return projectBuild;
+ }
+ };
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java
new file mode 100644
index 00000000..8f1f4932
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxer.java
@@ -0,0 +1,477 @@
+package org.apache.maven.lifecycle.internal.builder.multithreaded;
+
+/*
+ * 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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.lifecycle.internal.ProjectBuildList;
+import org.apache.maven.lifecycle.internal.ProjectSegment;
+
+/**
+ * @since 3.0
+ * @author Kristian Rosenvold
+ * <p/>
+ * NOTE: This class is not part of any public api and can be changed or deleted without prior notice.
+ * This class in particular may spontaneusly self-combust and be replaced by a plexus-compliant thread aware
+ * logger implementation at any time.
+ */
+@SuppressWarnings( { "SynchronizationOnLocalVariableOrMethodParameter" } )
+public class ThreadOutputMuxer
+{
+ private final Iterator<ProjectSegment> projects;
+
+ private final ThreadLocal<ProjectSegment> projectBuildThreadLocal = new ThreadLocal<ProjectSegment>();
+
+ private final Map<ProjectSegment, ByteArrayOutputStream> streams =
+ new HashMap<ProjectSegment, ByteArrayOutputStream>();
+
+ private final Map<ProjectSegment, PrintStream> printStreams = new HashMap<ProjectSegment, PrintStream>();
+
+ private final ByteArrayOutputStream defaultOutputStreamForUnknownData = new ByteArrayOutputStream();
+
+ private final PrintStream defaultPringStream = new PrintStream( defaultOutputStreamForUnknownData );
+
+ private final Set<ProjectSegment> completedBuilds = Collections.synchronizedSet( new HashSet<ProjectSegment>() );
+
+ private volatile ProjectSegment currentBuild;
+
+ private final PrintStream originalSystemOUtStream;
+
+ private final ConsolePrinter printer;
+
+ /**
+ * A simple but safe solution for printing to the console.
+ */
+
+ class ConsolePrinter
+ implements Runnable
+ {
+ public volatile boolean running;
+
+ private final ProjectBuildList projectBuildList;
+
+ ConsolePrinter( ProjectBuildList projectBuildList )
+ {
+ this.projectBuildList = projectBuildList;
+ }
+
+ public void run()
+ {
+ running = true;
+ for ( ProjectSegment projectBuild : projectBuildList )
+ {
+ final PrintStream projectStream = printStreams.get( projectBuild );
+ ByteArrayOutputStream projectOs = streams.get( projectBuild );
+
+ do
+ {
+ synchronized ( projectStream )
+ {
+ try
+ {
+ projectStream.wait( 100 );
+ }
+ catch ( InterruptedException e )
+ {
+ throw new RuntimeException( e );
+ }
+ try
+ {
+ projectOs.writeTo( originalSystemOUtStream );
+ }
+ catch ( IOException e )
+ {
+ throw new RuntimeException( e );
+ }
+
+ projectOs.reset();
+ }
+ }
+ while ( !completedBuilds.contains( projectBuild ) );
+ }
+ running = false;
+ }
+
+ /*
+ Wait until we are sure the print-stream thread is running.
+ */
+
+ public void waitUntilRunning( boolean expect )
+ {
+ while ( !running == expect )
+ {
+ try
+ {
+ Thread.sleep( 10 );
+ }
+ catch ( InterruptedException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+ }
+ }
+
+ public ThreadOutputMuxer( ProjectBuildList segmentChunks, PrintStream originalSystemOut )
+ {
+ projects = segmentChunks.iterator();
+ for ( ProjectSegment segmentChunk : segmentChunks )
+ {
+ final ByteArrayOutputStream value = new ByteArrayOutputStream();
+ streams.put( segmentChunk, value );
+ printStreams.put( segmentChunk, new PrintStream( value ) );
+ }
+ setNext();
+ this.originalSystemOUtStream = originalSystemOut;
+ System.setOut( new ThreadBoundPrintStream( this.originalSystemOUtStream ) );
+ printer = new ConsolePrinter( segmentChunks );
+ new Thread( printer ).start();
+ printer.waitUntilRunning( true );
+ }
+
+ public void close()
+ {
+ printer.waitUntilRunning( false );
+ System.setOut( this.originalSystemOUtStream );
+ }
+
+ private void setNext()
+ {
+ currentBuild = projects.hasNext() ? projects.next() : null;
+ }
+
+ private boolean ownsRealOutputStream( ProjectSegment projectBuild )
+ {
+ return projectBuild.equals( currentBuild );
+ }
+
+ private PrintStream getThreadBoundPrintStream()
+ {
+ ProjectSegment threadProject = projectBuildThreadLocal.get();
+ if ( threadProject == null )
+ {
+ return defaultPringStream;
+ }
+ if ( ownsRealOutputStream( threadProject ) )
+ {
+ return originalSystemOUtStream;
+ }
+ return printStreams.get( threadProject );
+ }
+
+ public void associateThreadWithProjectSegment( ProjectSegment projectBuild )
+ {
+ projectBuildThreadLocal.set( projectBuild );
+ }
+
+ public void setThisModuleComplete( ProjectSegment projectBuild )
+ {
+ completedBuilds.add( projectBuild );
+ PrintStream stream = printStreams.get( projectBuild );
+ synchronized ( stream )
+ {
+ stream.notifyAll();
+ }
+ disconnectThreadFromProject();
+ }
+
+ private void disconnectThreadFromProject()
+ {
+ projectBuildThreadLocal.remove();
+ }
+
+ private class ThreadBoundPrintStream
+ extends PrintStream
+ {
+
+ public ThreadBoundPrintStream( PrintStream systemOutStream )
+ {
+ super( systemOutStream );
+ }
+
+ private PrintStream getOutputStreamForCurrentThread()
+ {
+ return getThreadBoundPrintStream();
+ }
+
+ @Override
+ public void println()
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println();
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( char c )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( c );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( char x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( double d )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( d );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( double x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( float f )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( f );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( float x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( int i )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( i );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( int x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( long l )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( l );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( long x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( boolean b )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( b );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( boolean x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( char s[] )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( s );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( char x[] )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( Object obj )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( obj );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( Object x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void print( String s )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.print( s );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void println( String x )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.println( x );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void write( byte b[], int off, int len )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.write( b, off, len );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void close()
+ {
+ getOutputStreamForCurrentThread().close();
+ }
+
+ @Override
+ public void flush()
+ {
+ getOutputStreamForCurrentThread().flush();
+ }
+
+ @Override
+ public void write( int b )
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.write( b );
+ currentStream.notifyAll();
+ }
+ }
+
+ @Override
+ public void write( byte b[] )
+ throws IOException
+ {
+ final PrintStream currentStream = getOutputStreamForCurrentThread();
+ synchronized ( currentStream )
+ {
+ currentStream.write( b );
+ currentStream.notifyAll();
+ }
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java
new file mode 100644
index 00000000..464944f1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/singlethreaded/SingleThreadedBuilder.java
@@ -0,0 +1,65 @@
+package org.apache.maven.lifecycle.internal.builder.singlethreaded;
+
+/*
+ * 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.execution.MavenSession;
+import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
+import org.apache.maven.lifecycle.internal.ProjectBuildList;
+import org.apache.maven.lifecycle.internal.ProjectSegment;
+import org.apache.maven.lifecycle.internal.ReactorBuildStatus;
+import org.apache.maven.lifecycle.internal.ReactorContext;
+import org.apache.maven.lifecycle.internal.TaskSegment;
+import org.apache.maven.lifecycle.internal.builder.Builder;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+@Component( role = Builder.class, hint = "singlethreaded" )
+public class SingleThreadedBuilder
+ implements Builder
+{
+ @Requirement
+ private LifecycleModuleBuilder lifecycleModuleBuilder;
+
+ public void build( MavenSession session, ReactorContext reactorContext, ProjectBuildList projectBuilds,
+ List<TaskSegment> taskSegments, ReactorBuildStatus reactorBuildStatus )
+ {
+ for ( TaskSegment taskSegment : taskSegments )
+ {
+ for ( ProjectSegment projectBuild : projectBuilds.getByTaskSegment( taskSegment ) )
+ {
+ try
+ {
+ lifecycleModuleBuilder.buildProject( session, reactorContext, projectBuild.getProject(),
+ taskSegment );
+ if ( reactorBuildStatus.isHalted() )
+ {
+ break;
+ }
+ }
+ catch ( Exception e )
+ {
+ break; // Why are we just ignoring this exception? Are exceptions are being used for flow control
+ }
+ }
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
new file mode 100644
index 00000000..9947e2fc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
@@ -0,0 +1,111 @@
+package org.apache.maven.lifecycle.mapping;
+
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DefaultLifecycleMapping
+ implements LifecycleMapping
+{
+
+ private List<Lifecycle> lifecycles;
+
+ private Map<String, Lifecycle> lifecycleMap;
+
+ /** @deprecated use lifecycles instead */
+ private Map<String, String> phases;
+
+ /**
+ * Populates the lifecycle map from the injected list of lifecycle mappings (if not already done).
+ */
+ private void initLifecycleMap()
+ {
+ if ( lifecycleMap == null )
+ {
+ lifecycleMap = new HashMap<String, Lifecycle>();
+
+ if ( lifecycles != null )
+ {
+ for ( Lifecycle lifecycle : lifecycles )
+ {
+ lifecycleMap.put( lifecycle.getId(), lifecycle );
+ }
+ }
+ else
+ {
+ /*
+ * NOTE: This is to provide a migration path for implementors of the legacy API which did not know about
+ * getLifecycles().
+ */
+
+ String[] lifecycleIds = { "default", "clean", "site" };
+
+ for ( String lifecycleId : lifecycleIds )
+ {
+ Map<String, String> phases = getPhases( lifecycleId );
+ if ( phases != null )
+ {
+ Lifecycle lifecycle = new Lifecycle();
+
+ lifecycle.setId( lifecycleId );
+ lifecycle.setPhases( phases );
+
+ lifecycleMap.put( lifecycleId, lifecycle );
+ }
+ }
+ }
+ }
+ }
+
+ public Map<String, Lifecycle> getLifecycles()
+ {
+ initLifecycleMap();
+
+ return lifecycleMap;
+ }
+
+ public List<String> getOptionalMojos( String lifecycle )
+ {
+ return null;
+ }
+
+ public Map<String, String> getPhases( String lifecycle )
+ {
+ initLifecycleMap();
+
+ Lifecycle lifecycleMapping = lifecycleMap.get( lifecycle );
+
+ if ( lifecycleMapping != null )
+ {
+ return lifecycleMapping.getPhases();
+ }
+ else if ( "default".equals( lifecycle ) )
+ {
+ return phases;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java
new file mode 100644
index 00000000..6adf4f34
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/Lifecycle.java
@@ -0,0 +1,83 @@
+package org.apache.maven.lifecycle.mapping;
+
+/*
+ * 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 java.util.Map;
+
+/**
+ * Class Lifecycle.
+ */
+public class Lifecycle
+{
+ /**
+ * Field id
+ */
+ private String id;
+
+ /**
+ * Field phases
+ */
+ private Map<String, String> phases;
+
+ /*
+ * NOTE: This exists merely for backward-compat with legacy-style lifecycle definitions and allows configuration
+ * injection to work instead of failing.
+ */
+ @SuppressWarnings( "unused" )
+ private List<String> optionalMojos;
+
+ /**
+ * Method getId
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /**
+ * Method getPhases
+ */
+ public Map<String, String> getPhases()
+ {
+ return this.phases;
+ }
+
+ /**
+ * Method setId
+ *
+ * @param id
+ */
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ /**
+ * Method setPhases
+ *
+ * @param phases
+ */
+ public void setPhases( Map<String, String> phases )
+ {
+ this.phases = phases;
+ } //-- void setPhases(java.util.List)
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java
new file mode 100644
index 00000000..e656cc9f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java
@@ -0,0 +1,39 @@
+package org.apache.maven.lifecycle.mapping;
+
+/*
+ * 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 java.util.Map;
+
+public interface LifecycleMapping
+{
+
+ @Deprecated
+ String ROLE = LifecycleMapping.class.getName();
+
+ Map<String, Lifecycle> getLifecycles();
+
+ @Deprecated
+ List<String> getOptionalMojos( String lifecycle );
+
+ @Deprecated
+ Map<String, String> getPhases( String lifecycle );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java
new file mode 100644
index 00000000..1702aa1e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java
@@ -0,0 +1,171 @@
+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.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.lifecycle.LifeCyclePluginAnalyzer;
+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.building.ModelProblem.Severity;
+import org.apache.maven.model.building.ModelProblem.Version;
+import org.apache.maven.model.building.ModelProblemCollectorRequest;
+import org.apache.maven.model.merge.MavenModelMerger;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+
+/**
+ * Handles injection of plugin executions induced by the lifecycle bindings for a packaging.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = LifecycleBindingsInjector.class )
+public class DefaultLifecycleBindingsInjector
+ implements LifecycleBindingsInjector
+{
+
+ private LifecycleBindingsMerger merger = new LifecycleBindingsMerger();
+
+ @Requirement
+ private LifeCyclePluginAnalyzer lifecycle;
+
+ public void injectLifecycleBindings( Model model, ModelBuildingRequest request, ModelProblemCollector problems )
+ {
+ String packaging = model.getPackaging();
+
+ Collection<Plugin> defaultPlugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles( packaging );
+
+ if ( defaultPlugins == null )
+ {
+ problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Unknown packaging: " + packaging )
+ .setLocation( model.getLocation( "packaging" ) ) );
+ }
+ else if ( !defaultPlugins.isEmpty() )
+ {
+ Model lifecycleModel = new Model();
+ lifecycleModel.setBuild( new Build() );
+ lifecycleModel.getBuild().getPlugins().addAll( defaultPlugins );
+
+ merger.merge( model, lifecycleModel );
+ }
+ }
+
+ protected static class LifecycleBindingsMerger
+ extends MavenModelMerger
+ {
+
+ private static final String PLUGIN_MANAGEMENT = "plugin-management";
+
+ public void merge( Model target, Model source )
+ {
+ if ( target.getBuild() == null )
+ {
+ target.setBuild( new Build() );
+ }
+
+ Map<Object, Object> context =
+ Collections.<Object, Object>singletonMap( PLUGIN_MANAGEMENT, target.getBuild().getPluginManagement() );
+
+ mergePluginContainer_Plugins( target.getBuild(), source.getBuild(), false, context );
+ }
+
+ @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> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
+
+ for ( Plugin element : tgt )
+ {
+ Object key = getPluginKey( element );
+ merged.put( key, element );
+ }
+
+ Map<Object, Plugin> unmanaged = new LinkedHashMap<Object, Plugin>();
+
+ for ( Plugin element : src )
+ {
+ Object key = getPluginKey( element );
+ Plugin existing = merged.get( key );
+ if ( existing != null )
+ {
+ mergePlugin( existing, element, sourceDominant, context );
+ }
+ else
+ {
+ merged.put( key, element );
+ unmanaged.put( key, element );
+ }
+ }
+
+ if ( !unmanaged.isEmpty() )
+ {
+ PluginManagement pluginMgmt = (PluginManagement) context.get( PLUGIN_MANAGEMENT );
+ if ( pluginMgmt != null )
+ {
+ for ( Plugin managedPlugin : pluginMgmt.getPlugins() )
+ {
+ Object key = getPluginKey( managedPlugin );
+ Plugin unmanagedPlugin = unmanaged.get( key );
+ if ( unmanagedPlugin != null )
+ {
+ Plugin plugin = managedPlugin.clone();
+ mergePlugin( plugin, unmanagedPlugin, sourceDominant, Collections.emptyMap() );
+ merged.put( key, plugin );
+ }
+ }
+ }
+ }
+
+ List<Plugin> result = new ArrayList<Plugin>( merged.values() );
+
+ target.setPlugins( result );
+ }
+ }
+
+ @Override
+ protected void mergePluginExecution( PluginExecution target, PluginExecution source, boolean sourceDominant,
+ Map<Object, Object> context )
+ {
+ super.mergePluginExecution( target, source, sourceDominant, context );
+
+ target.setPriority( Math.min( target.getPriority(), source.getPriority() ) );
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
new file mode 100644
index 00000000..492a2980
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
@@ -0,0 +1,37 @@
+package org.apache.maven.monitor.event;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author jdcasey
+ */
+@Deprecated
+public interface EventDispatcher
+{
+
+ void addEventMonitor( EventMonitor monitor );
+
+ void dispatchStart( String event, String target );
+
+ void dispatchEnd( String event, String target );
+
+ void dispatchError( String event, String target, Throwable cause );
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
new file mode 100644
index 00000000..3e726746
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
@@ -0,0 +1,35 @@
+package org.apache.maven.monitor.event;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author jdcasey
+ */
+@Deprecated
+public interface EventMonitor
+{
+
+ void startEvent( String eventName, String target, long timestamp );
+
+ void endEvent( String eventName, String target, long timestamp );
+
+ void errorEvent( String eventName, String target, long timestamp, Throwable cause );
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java
new file mode 100644
index 00000000..6c1b9cbf
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java
@@ -0,0 +1,54 @@
+package org.apache.maven.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.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * @author Jason van Zyl
+ */
+public interface BuildPluginManager
+{
+ // igorf: Way too many declared exceptions!
+ PluginDescriptor loadPlugin( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ InvalidPluginDescriptorException;
+
+ // igorf: Way too many declared exceptions!
+ MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException;
+
+ ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor )
+ throws PluginResolutionException, PluginManagerException;
+
+ void executeMojo( MavenSession session, MojoExecution execution )
+ throws MojoFailureException, MojoExecutionException, PluginConfigurationException, PluginManagerException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
new file mode 100644
index 00000000..a73e1efe
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CacheUtils.java
@@ -0,0 +1,211 @@
+package org.apache.maven.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.Iterator;
+import java.util.List;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.Plugin;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.repository.WorkspaceReader;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class CacheUtils
+{
+
+ public static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ public static int hash( Object obj )
+ {
+ return obj != null ? obj.hashCode() : 0;
+ }
+
+ public static int repositoriesHashCode( List<RemoteRepository> repositories )
+ {
+ int result = 17;
+ for ( RemoteRepository repository : repositories )
+ {
+ result = 31 * result + repositoryHashCode( repository );
+ }
+ return result;
+ }
+
+ private static int repositoryHashCode( RemoteRepository repository )
+ {
+ int result = 17;
+ result = 31 * result + hash( repository.getUrl() );
+ return result;
+ }
+
+ private static boolean repositoryEquals( RemoteRepository r1, RemoteRepository r2 )
+ {
+ if ( r1 == r2 )
+ {
+ return true;
+ }
+
+ return eq( r1.getId(), r2.getId() ) && eq( r1.getUrl(), r2.getUrl() )
+ && policyEquals( r1.getPolicy( false ), r2.getPolicy( false ) )
+ && policyEquals( r1.getPolicy( true ), r2.getPolicy( true ) );
+ }
+
+ private static boolean policyEquals( RepositoryPolicy p1, RepositoryPolicy p2 )
+ {
+ if ( p1 == p2 )
+ {
+ return true;
+ }
+ // update policy doesn't affect contents
+ return p1.isEnabled() == p2.isEnabled() && eq( p1.getChecksumPolicy(), p2.getChecksumPolicy() );
+ }
+
+ public static boolean repositoriesEquals( List<RemoteRepository> r1, List<RemoteRepository> r2 )
+ {
+ if ( r1.size() != r2.size() )
+ {
+ return false;
+ }
+
+ for ( Iterator<RemoteRepository> it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); )
+ {
+ if ( !repositoryEquals( it1.next(), it2.next() ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static int pluginHashCode( Plugin plugin )
+ {
+ int hash = 17;
+
+ hash = hash * 31 + hash( plugin.getGroupId() );
+ hash = hash * 31 + hash( plugin.getArtifactId() );
+ hash = hash * 31 + hash( plugin.getVersion() );
+
+ hash = hash * 31 + ( plugin.isExtensions() ? 1 : 0 );
+
+ for ( Dependency dependency : plugin.getDependencies() )
+ {
+ hash = hash * 31 + hash( dependency.getGroupId() );
+ hash = hash * 31 + hash( dependency.getArtifactId() );
+ hash = hash * 31 + hash( dependency.getVersion() );
+ hash = hash * 31 + hash( dependency.getType() );
+ hash = hash * 31 + hash( dependency.getClassifier() );
+ hash = hash * 31 + hash( dependency.getScope() );
+
+ for ( Exclusion exclusion : dependency.getExclusions() )
+ {
+ hash = hash * 31 + hash( exclusion.getGroupId() );
+ hash = hash * 31 + hash( exclusion.getArtifactId() );
+ }
+ }
+
+ return hash;
+ }
+
+ public static boolean pluginEquals( Plugin a, Plugin b )
+ {
+ return eq( a.getArtifactId(), b.getArtifactId() ) //
+ && eq( a.getGroupId(), b.getGroupId() ) //
+ && eq( a.getVersion(), b.getVersion() ) //
+ && a.isExtensions() == b.isExtensions() //
+ && dependenciesEquals( a.getDependencies(), b.getDependencies() );
+ }
+
+ private static boolean dependenciesEquals( List<Dependency> a, List<Dependency> b )
+ {
+ if ( a.size() != b.size() )
+ {
+ return false;
+ }
+
+ Iterator<Dependency> aI = a.iterator();
+ Iterator<Dependency> bI = b.iterator();
+
+ while ( aI.hasNext() )
+ {
+ Dependency aD = aI.next();
+ Dependency bD = bI.next();
+
+ boolean r = eq( aD.getGroupId(), bD.getGroupId() ) //
+ && eq( aD.getArtifactId(), bD.getArtifactId() ) //
+ && eq( aD.getVersion(), bD.getVersion() ) //
+ && eq( aD.getType(), bD.getType() ) //
+ && eq( aD.getClassifier(), bD.getClassifier() ) //
+ && eq( aD.getScope(), bD.getScope() );
+
+ r &= exclusionsEquals( aD.getExclusions(), bD.getExclusions() );
+
+ if ( !r )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static boolean exclusionsEquals( List<Exclusion> a, List<Exclusion> b )
+ {
+ if ( a.size() != b.size() )
+ {
+ return false;
+ }
+
+ Iterator<Exclusion> aI = a.iterator();
+ Iterator<Exclusion> bI = b.iterator();
+
+ while ( aI.hasNext() )
+ {
+ Exclusion aD = aI.next();
+ Exclusion bD = bI.next();
+
+ boolean r = eq( aD.getGroupId(), bD.getGroupId() ) //
+ && eq( aD.getArtifactId(), bD.getArtifactId() );
+
+ if ( !r )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static WorkspaceRepository getWorkspace( RepositorySystemSession session )
+ {
+ WorkspaceReader reader = session.getWorkspaceReader();
+ return ( reader != null ) ? reader.getRepository() : null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CompoundMojoExecutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CompoundMojoExecutionListener.java
new file mode 100644
index 00000000..9fe52833
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CompoundMojoExecutionListener.java
@@ -0,0 +1,64 @@
+package org.apache.maven.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.Collection;
+
+import org.apache.maven.execution.MojoExecutionEvent;
+import org.apache.maven.execution.MojoExecutionListener;
+
+class CompoundMojoExecutionListener
+ implements MojoExecutionListener
+{
+
+ private final Collection<MojoExecutionListener> listeners;
+
+ public CompoundMojoExecutionListener( Collection<MojoExecutionListener> listeners )
+ {
+ this.listeners = listeners; // NB this is live injected collection
+ }
+
+ public void beforeMojoExecution( MojoExecutionEvent event )
+ throws MojoExecutionException
+ {
+ for ( MojoExecutionListener listener : listeners )
+ {
+ listener.beforeMojoExecution( event );
+ }
+ }
+
+ public void afterMojoExecutionSuccess( MojoExecutionEvent event )
+ throws MojoExecutionException
+ {
+ for ( MojoExecutionListener listener : listeners )
+ {
+ listener.afterMojoExecutionSuccess( event );
+ }
+ }
+
+ public void afterExecutionFailure( MojoExecutionEvent event )
+ {
+ for ( MojoExecutionListener listener : listeners )
+ {
+ listener.afterExecutionFailure( event );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CycleDetectedInPluginGraphException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CycleDetectedInPluginGraphException.java
new file mode 100644
index 00000000..f77461fe
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/CycleDetectedInPluginGraphException.java
@@ -0,0 +1,46 @@
+package org.apache.maven.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.Plugin;
+import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException;
+
+/**
+ * Exception occurring trying to resolve a plugin.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class CycleDetectedInPluginGraphException
+ extends Exception
+{
+ private final Plugin plugin;
+
+ public CycleDetectedInPluginGraphException( Plugin plugin, CycleDetectedInComponentGraphException e )
+ {
+ super( "A cycle was detected in the component graph of the plugin: " + plugin.getArtifactId() );
+
+ this.plugin = plugin;
+ }
+
+ public Plugin getPlugin()
+ {
+ return plugin;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java
new file mode 100644
index 00000000..57084ceb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DebugConfigurationListener.java
@@ -0,0 +1,91 @@
+package org.apache.maven.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.lang.reflect.Array;
+
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Log at debug level the mojo configuration.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+@Deprecated
+public class DebugConfigurationListener
+ implements ConfigurationListener
+{
+ private Logger logger;
+
+ public DebugConfigurationListener( Logger logger )
+ {
+ this.logger = logger;
+ }
+
+ public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( " (s) " + fieldName + " = " + toString( value ) );
+ }
+ }
+
+ public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( " (f) " + fieldName + " = " + toString( value ) );
+ }
+ }
+
+ /**
+ * Creates a human-friendly string represenation of the specified object.
+ *
+ * @param obj The object to create a string representation for, may be <code>null</code>.
+ * @return The string representation, never <code>null</code>.
+ */
+ private String toString( Object obj )
+ {
+ String str;
+ if ( obj != null && obj.getClass().isArray() )
+ {
+ int n = Array.getLength( obj );
+ StringBuilder buf = new StringBuilder( 256 );
+ buf.append( '[' );
+ for ( int i = 0; i < n; i++ )
+ {
+ if ( i > 0 )
+ {
+ buf.append( ", " );
+ }
+ buf.append( String.valueOf( Array.get( obj, i ) ) );
+ }
+ buf.append( ']' );
+ str = buf.toString();
+ }
+ else
+ {
+ str = String.valueOf( obj );
+ }
+ return str;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
new file mode 100644
index 00000000..8145bd58
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
@@ -0,0 +1,244 @@
+package org.apache.maven.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.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.MojoExecutionEvent;
+import org.apache.maven.execution.MojoExecutionListener;
+import org.apache.maven.execution.scope.internal.MojoExecutionScope;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+// TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works
+// TODO: remove the coreArtifactFilterManager
+
+@Component( role = BuildPluginManager.class )
+public class DefaultBuildPluginManager
+ implements BuildPluginManager
+{
+
+ @Requirement
+ private MavenPluginManager mavenPluginManager;
+
+ @Requirement
+ private LegacySupport legacySupport;
+
+ @Requirement
+ private MojoExecutionScope scope;
+
+ private MojoExecutionListener mojoExecutionListener;
+
+ // this tricks plexus-component-metadata generate required metadata
+ @Requirement( role = MojoExecutionListener.class )
+ private List<MojoExecutionListener> mojoExecutionListeners;
+
+ public void setMojoExecutionListeners( final List<MojoExecutionListener> listeners )
+ {
+ this.mojoExecutionListeners = listeners;
+ this.mojoExecutionListener = new CompoundMojoExecutionListener( listeners );
+ }
+
+ /**
+ * @param plugin
+ * @param repositories
+ * @param session
+ * @return PluginDescriptor The component descriptor for the Maven plugin.
+ * @throws PluginNotFoundException The plugin could not be found in any repositories.
+ * @throws PluginResolutionException The plugin could be found but could not be resolved.
+ * @throws InvalidPluginDescriptorException
+ */
+ public PluginDescriptor loadPlugin( Plugin plugin, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ InvalidPluginDescriptorException
+ {
+ return mavenPluginManager.getPluginDescriptor( plugin, repositories, session );
+ }
+
+ // ----------------------------------------------------------------------
+ // Mojo execution
+ // ----------------------------------------------------------------------
+
+ public void executeMojo( MavenSession session, MojoExecution mojoExecution )
+ throws MojoFailureException, MojoExecutionException, PluginConfigurationException, PluginManagerException
+ {
+ MavenProject project = session.getCurrentProject();
+
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ Mojo mojo = null;
+
+ ClassRealm pluginRealm;
+ try
+ {
+ pluginRealm = getPluginRealm( session, mojoDescriptor.getPluginDescriptor() );
+ }
+ catch ( PluginResolutionException e )
+ {
+ throw new PluginExecutionException( mojoExecution, project, e );
+ }
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader( pluginRealm );
+
+ MavenSession oldSession = legacySupport.getSession();
+
+ scope.enter();
+
+ try
+ {
+ scope.seed( MavenProject.class, project );
+ scope.seed( MojoExecution.class, mojoExecution );
+
+ mojo = mavenPluginManager.getConfiguredMojo( Mojo.class, session, mojoExecution );
+
+ legacySupport.setSession( session );
+
+ // NOTE: DuplicateArtifactAttachmentException is currently unchecked, so be careful removing this try/catch!
+ // This is necessary to avoid creating compatibility problems for existing plugins that use
+ // MavenProjectHelper.attachArtifact(..).
+ try
+ {
+ MojoExecutionEvent mojoExecutionEvent = new MojoExecutionEvent( session, project, mojoExecution, mojo );
+
+ mojoExecutionListener.beforeMojoExecution( mojoExecutionEvent );
+
+ mojo.execute();
+
+ mojoExecutionListener.afterMojoExecutionSuccess( mojoExecutionEvent );
+ }
+ catch ( ClassCastException e )
+ {
+ // to be processed in the outer catch block
+ throw e;
+ }
+ catch ( RuntimeException e )
+ {
+ throw new PluginExecutionException( mojoExecution, project, e );
+ }
+ }
+ catch ( PluginContainerException e )
+ {
+ mojoExecutionListener.afterExecutionFailure( new MojoExecutionEvent( session, project, mojoExecution, mojo,
+ e ) );
+
+ throw new PluginExecutionException( mojoExecution, project, e );
+ }
+ catch ( NoClassDefFoundError e )
+ {
+ mojoExecutionListener.afterExecutionFailure( new MojoExecutionEvent( session, project, mojoExecution, mojo,
+ e ) );
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "A required class was missing while executing " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
+ pluginRealm.display( ps );
+
+ Exception wrapper = new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), e );
+
+ throw new PluginExecutionException( mojoExecution, project, wrapper );
+ }
+ catch ( LinkageError e )
+ {
+ mojoExecutionListener.afterExecutionFailure( new MojoExecutionEvent( session, project, mojoExecution, mojo,
+ e ) );
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "An API incompatibility was encountered while executing " + mojoDescriptor.getId() + ": "
+ + e.getClass().getName() + ": " + e.getMessage() );
+ pluginRealm.display( ps );
+
+ Exception wrapper = new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), e );
+
+ throw new PluginExecutionException( mojoExecution, project, wrapper );
+ }
+ catch ( ClassCastException e )
+ {
+ mojoExecutionListener.afterExecutionFailure( new MojoExecutionEvent( session, project, mojoExecution, mojo,
+ e ) );
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "A type incompatibility occured while executing " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginExecutionException( mojoExecution, project, os.toString(), e );
+ }
+ catch ( RuntimeException e )
+ {
+ mojoExecutionListener.afterExecutionFailure( new MojoExecutionEvent( session, project, mojoExecution, mojo,
+ e ) );
+
+ throw e;
+ }
+ finally
+ {
+ mavenPluginManager.releaseMojo( mojo, mojoExecution );
+
+ scope.exit();
+
+ Thread.currentThread().setContextClassLoader( oldClassLoader );
+
+ legacySupport.setSession( oldSession );
+ }
+ }
+
+ /**
+ * TODO pluginDescriptor classRealm and artifacts are set as a side effect of this
+ * call, which is not nice.
+ * @throws PluginResolutionException
+ */
+ public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor )
+ throws PluginResolutionException, PluginManagerException
+ {
+ ClassRealm pluginRealm = pluginDescriptor.getClassRealm();
+ if ( pluginRealm != null )
+ {
+ return pluginRealm;
+ }
+
+ mavenPluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
+
+ return pluginDescriptor.getClassRealm();
+ }
+
+ public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ MojoNotFoundException, InvalidPluginDescriptorException
+ {
+ return mavenPluginManager.getMojoDescriptor( plugin, goal, repositories, session );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultExtensionRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultExtensionRealmCache.java
new file mode 100644
index 00000000..c9df92c6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultExtensionRealmCache.java
@@ -0,0 +1,170 @@
+package org.apache.maven.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.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.project.ExtensionDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
+
+/**
+ * Default extension realm cache implementation. Assumes cached data does not change.
+ */
+@Component( role = ExtensionRealmCache.class )
+public class DefaultExtensionRealmCache
+ implements ExtensionRealmCache, Disposable
+{
+
+ protected static class CacheKey
+ implements Key
+ {
+
+ private final List<File> files;
+
+ private final List<Long> timestamps;
+
+ private final List<Long> sizes;
+
+ private final List<String> ids;
+
+ private final int hashCode;
+
+ public CacheKey( List<Artifact> extensionArtifacts )
+ {
+ this.files = new ArrayList<File>( extensionArtifacts.size() );
+ this.timestamps = new ArrayList<Long>( extensionArtifacts.size() );
+ this.sizes = new ArrayList<Long>( extensionArtifacts.size() );
+ this.ids = new ArrayList<String>( extensionArtifacts.size() );
+
+ for ( Artifact artifact : extensionArtifacts )
+ {
+ File file = artifact.getFile();
+ files.add( file );
+ timestamps.add( ( file != null ) ? Long.valueOf( file.lastModified() ) : Long.valueOf( 0 ) );
+ sizes.add( ( file != null ) ? Long.valueOf( file.length() ) : Long.valueOf( 0 ) );
+ ids.add( artifact.getVersion() );
+ }
+
+ this.hashCode =
+ 31 * files.hashCode() + 31 * ids.hashCode() + 31 * timestamps.hashCode() + 31 * sizes.hashCode();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey other = (CacheKey) o;
+
+ return ids.equals( other.ids ) && files.equals( other.files ) && timestamps.equals( other.timestamps )
+ && sizes.equals( other.sizes );
+ }
+
+ @Override
+ public String toString()
+ {
+ return files.toString();
+ }
+ }
+
+ protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>();
+
+ @Override
+ public Key createKey( List<Artifact> extensionArtifacts )
+ {
+ return new CacheKey( extensionArtifacts );
+ }
+
+ public CacheRecord get( Key key )
+ {
+ return cache.get( key );
+ }
+
+ public CacheRecord put( Key key, ClassRealm extensionRealm, ExtensionDescriptor extensionDescriptor,
+ List<Artifact> artifacts )
+ {
+ if ( extensionRealm == null )
+ {
+ throw new NullPointerException();
+ }
+
+ if ( cache.containsKey( key ) )
+ {
+ throw new IllegalStateException( "Duplicate extension realm for extension " + key );
+ }
+
+ CacheRecord record = new CacheRecord( extensionRealm, extensionDescriptor, artifacts );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ public void flush()
+ {
+ for ( CacheRecord record : cache.values() )
+ {
+ ClassRealm realm = record.realm;
+ try
+ {
+ realm.getWorld().disposeRealm( realm.getId() );
+ }
+ catch ( NoSuchRealmException e )
+ {
+ // ignore
+ }
+ }
+ cache.clear();
+ }
+
+ public void register( MavenProject project, Key key, CacheRecord record )
+ {
+ // default cache does not track extension usage
+ }
+
+ public void dispose()
+ {
+ flush();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
new file mode 100644
index 00000000..23bda64d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginArtifactsCache.java
@@ -0,0 +1,218 @@
+package org.apache.maven.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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginArtifactsCache.class )
+public class DefaultPluginArtifactsCache
+ implements PluginArtifactsCache
+{
+
+ protected static class CacheKey
+ implements Key
+ {
+
+ private final Plugin plugin;
+
+ private final WorkspaceRepository workspace;
+
+ private final LocalRepository localRepo;
+
+ private final List<RemoteRepository> repositories;
+
+ private final DependencyFilter filter;
+
+ private final int hashCode;
+
+ public CacheKey( Plugin plugin, DependencyFilter extensionFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ {
+ this.plugin = plugin.clone();
+ workspace = CacheUtils.getWorkspace( session );
+ this.localRepo = session.getLocalRepository();
+ this.repositories = new ArrayList<RemoteRepository>( repositories.size() );
+ for ( RemoteRepository repository : repositories )
+ {
+ if ( repository.isRepositoryManager() )
+ {
+ this.repositories.addAll( repository.getMirroredRepositories() );
+ }
+ else
+ {
+ this.repositories.add( repository );
+ }
+ }
+ this.filter = extensionFilter;
+
+ int hash = 17;
+ hash = hash * 31 + CacheUtils.pluginHashCode( plugin );
+ hash = hash * 31 + hash( workspace );
+ hash = hash * 31 + hash( localRepo );
+ hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + hash( extensionFilter );
+ this.hashCode = hash;
+ }
+
+ @Override
+ public String toString()
+ {
+ return plugin.getId();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ private static int hash( Object obj )
+ {
+ return obj != null ? obj.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) o;
+
+ return CacheUtils.pluginEquals( plugin, that.plugin ) && eq( workspace, that.workspace )
+ && eq( localRepo, that.localRepo ) && CacheUtils.repositoriesEquals( repositories, that.repositories )
+ && eq( filter, that.filter );
+ }
+
+ private static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ }
+
+ protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>();
+
+ public Key createKey( Plugin plugin, DependencyFilter extensionFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ {
+ return new CacheKey( plugin, extensionFilter, repositories, session );
+ }
+
+ public CacheRecord get( Key key )
+ throws PluginResolutionException
+ {
+ CacheRecord cacheRecord = cache.get( key );
+
+ if ( cacheRecord != null && cacheRecord.exception != null )
+ {
+ throw cacheRecord.exception;
+ }
+
+ return cacheRecord;
+ }
+
+ public CacheRecord put( Key key, List<Artifact> pluginArtifacts )
+ {
+ if ( pluginArtifacts == null )
+ {
+ throw new NullPointerException();
+ }
+
+ assertUniqueKey( key );
+
+ CacheRecord record =
+ new CacheRecord( Collections.unmodifiableList( new ArrayList<Artifact>( pluginArtifacts ) ) );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ protected void assertUniqueKey( Key key )
+ {
+ if ( cache.containsKey( key ) )
+ {
+ throw new IllegalStateException( "Duplicate artifact resolution result for plugin " + key );
+ }
+ }
+
+ public CacheRecord put( Key key, PluginResolutionException exception )
+ {
+ if ( exception == null )
+ {
+ throw new NullPointerException();
+ }
+
+ assertUniqueKey( key );
+
+ CacheRecord record = new CacheRecord( exception );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ public void flush()
+ {
+ cache.clear();
+ }
+
+ protected static int pluginHashCode( Plugin plugin )
+ {
+ return CacheUtils.pluginHashCode( plugin );
+ }
+
+ protected static boolean pluginEquals( Plugin a, Plugin b )
+ {
+ return CacheUtils.pluginEquals( a, b );
+ }
+
+ public void register( MavenProject project, Key cacheKey, CacheRecord record )
+ {
+ // default cache does not track record usage
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
new file mode 100644
index 00000000..4927726b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginDescriptorCache.java
@@ -0,0 +1,219 @@
+package org.apache.maven.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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * Caches raw plugin descriptors. A raw plugin descriptor is a descriptor that has just been extracted from the plugin
+ * artifact and does not contain any runtime specific data. The cache must not be used for descriptors that hold runtime
+ * data like the plugin realm. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginDescriptorCache.class )
+public class DefaultPluginDescriptorCache
+ implements PluginDescriptorCache
+{
+
+ private Map<Key, PluginDescriptor> descriptors = new HashMap<Key, PluginDescriptor>( 128 );
+
+ public void flush()
+ {
+ descriptors.clear();
+ }
+
+ public Key createKey( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
+ {
+ return new CacheKey( plugin, repositories, session );
+ }
+
+ public PluginDescriptor get( Key cacheKey )
+ {
+ return clone( descriptors.get( cacheKey ) );
+ }
+
+ public void put( Key cacheKey, PluginDescriptor pluginDescriptor )
+ {
+ descriptors.put( cacheKey, clone( pluginDescriptor ) );
+ }
+
+ protected static PluginDescriptor clone( PluginDescriptor original )
+ {
+ PluginDescriptor clone = null;
+
+ if ( original != null )
+ {
+ clone = new PluginDescriptor();
+
+ clone.setGroupId( original.getGroupId() );
+ clone.setArtifactId( original.getArtifactId() );
+ clone.setVersion( original.getVersion() );
+ clone.setGoalPrefix( original.getGoalPrefix() );
+ clone.setInheritedByDefault( original.isInheritedByDefault() );
+
+ clone.setName( original.getName() );
+ clone.setDescription( original.getDescription() );
+ clone.setRequiredMavenVersion( original.getRequiredMavenVersion() );
+
+ clone.setPluginArtifact( ArtifactUtils.copyArtifactSafe( original.getPluginArtifact() ) );
+
+ clone.setComponents( clone( original.getMojos(), clone ) );
+ clone.setId( original.getId() );
+ clone.setIsolatedRealm( original.isIsolatedRealm() );
+ clone.setSource( original.getSource() );
+
+ clone.setDependencies( original.getDependencies() );
+ }
+
+ return clone;
+ }
+
+ private static List<ComponentDescriptor<?>> clone( List<MojoDescriptor> mojos, PluginDescriptor pluginDescriptor )
+ {
+ List<ComponentDescriptor<?>> clones = null;
+
+ if ( mojos != null )
+ {
+ clones = new ArrayList<ComponentDescriptor<?>>( mojos.size() );
+
+ for ( MojoDescriptor mojo : mojos )
+ {
+ MojoDescriptor clone = mojo.clone();
+ clone.setPluginDescriptor( pluginDescriptor );
+ clones.add( clone );
+ }
+ }
+
+ return clones;
+ }
+
+ private static final class CacheKey
+ implements Key
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ private final WorkspaceRepository workspace;
+
+ private final LocalRepository localRepo;
+
+ private final List<RemoteRepository> repositories;
+
+ private final int hashCode;
+
+ public CacheKey( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
+ {
+ groupId = plugin.getGroupId();
+ artifactId = plugin.getArtifactId();
+ version = plugin.getVersion();
+
+ workspace = CacheUtils.getWorkspace( session );
+ localRepo = session.getLocalRepository();
+ this.repositories = new ArrayList<RemoteRepository>( repositories.size() );
+ for ( RemoteRepository repository : repositories )
+ {
+ if ( repository.isRepositoryManager() )
+ {
+ this.repositories.addAll( repository.getMirroredRepositories() );
+ }
+ else
+ {
+ this.repositories.add( repository );
+ }
+ }
+
+ int hash = 17;
+ hash = hash * 31 + groupId.hashCode();
+ hash = hash * 31 + artifactId.hashCode();
+ hash = hash * 31 + version.hashCode();
+ hash = hash * 31 + hash( workspace );
+ hash = hash * 31 + localRepo.hashCode();
+ hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
+ this.hashCode = hash;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) obj;
+
+ return eq( this.artifactId, that.artifactId ) && eq( this.groupId, that.groupId )
+ && eq( this.version, that.version ) && eq( this.localRepo, that.localRepo )
+ && eq( this.workspace, that.workspace )
+ && CacheUtils.repositoriesEquals( this.repositories, that.repositories );
+ }
+
+ @Override
+ public String toString()
+ {
+ return groupId + ':' + artifactId + ':' + version;
+ }
+
+ private static int hash( Object obj )
+ {
+ return obj != null ? obj.hashCode() : 0;
+ }
+
+ private static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
new file mode 100644
index 00000000..6c8288ee
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
@@ -0,0 +1,219 @@
+package org.apache.maven.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.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceRepository;
+
+/**
+ * Default PluginCache implementation. Assumes cached data does not change.
+ */
+@Component( role = PluginRealmCache.class )
+public class DefaultPluginRealmCache
+ implements PluginRealmCache, Disposable
+{
+
+ protected static class CacheKey
+ implements Key
+ {
+
+ private final Plugin plugin;
+
+ private final WorkspaceRepository workspace;
+
+ private final LocalRepository localRepo;
+
+ private final List<RemoteRepository> repositories;
+
+ private final ClassLoader parentRealm;
+
+ private final Map<String, ClassLoader> foreignImports;
+
+ private final DependencyFilter filter;
+
+ private final int hashCode;
+
+ public CacheKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader> foreignImports,
+ DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ {
+ this.plugin = plugin.clone();
+ this.workspace = CacheUtils.getWorkspace( session );
+ this.localRepo = session.getLocalRepository();
+ this.repositories = new ArrayList<RemoteRepository>( repositories.size() );
+ for ( RemoteRepository repository : repositories )
+ {
+ if ( repository.isRepositoryManager() )
+ {
+ this.repositories.addAll( repository.getMirroredRepositories() );
+ }
+ else
+ {
+ this.repositories.add( repository );
+ }
+ }
+ this.parentRealm = parentRealm;
+ this.foreignImports =
+ ( foreignImports != null ) ? foreignImports : Collections.<String, ClassLoader>emptyMap();
+ this.filter = dependencyFilter;
+
+ int hash = 17;
+ hash = hash * 31 + CacheUtils.pluginHashCode( plugin );
+ hash = hash * 31 + hash( workspace );
+ hash = hash * 31 + hash( localRepo );
+ hash = hash * 31 + CacheUtils.repositoriesHashCode( repositories );
+ hash = hash * 31 + hash( parentRealm );
+ hash = hash * 31 + this.foreignImports.hashCode();
+ hash = hash * 31 + hash( dependencyFilter );
+ this.hashCode = hash;
+ }
+
+ @Override
+ public String toString()
+ {
+ return plugin.getId();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ private static int hash( Object obj )
+ {
+ return obj != null ? obj.hashCode() : 0;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) o;
+
+ return parentRealm == that.parentRealm && CacheUtils.pluginEquals( plugin, that.plugin )
+ && eq( workspace, that.workspace ) && eq( localRepo, that.localRepo )
+ && CacheUtils.repositoriesEquals( this.repositories, that.repositories ) && eq( filter, that.filter )
+ && eq( foreignImports, that.foreignImports );
+ }
+
+ private static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ }
+
+ protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>();
+
+ public Key createKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader> foreignImports,
+ DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ {
+ return new CacheKey( plugin, parentRealm, foreignImports, dependencyFilter, repositories, session );
+ }
+
+ public CacheRecord get( Key key )
+ {
+ return cache.get( key );
+ }
+
+ public CacheRecord put( Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts )
+ {
+ if ( pluginRealm == null || pluginArtifacts == null )
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if ( cache.containsKey( key ) )
+ {
+ throw new IllegalStateException( "Duplicate plugin realm for plugin " + key );
+ }
+
+ CacheRecord record = new CacheRecord( pluginRealm, pluginArtifacts );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ public void flush()
+ {
+ for ( CacheRecord record : cache.values() )
+ {
+ ClassRealm realm = record.realm;
+ try
+ {
+ realm.getWorld().disposeRealm( realm.getId() );
+ }
+ catch ( NoSuchRealmException e )
+ {
+ // ignore
+ }
+ }
+ cache.clear();
+ }
+
+ protected static int pluginHashCode( Plugin plugin )
+ {
+ return CacheUtils.pluginHashCode( plugin );
+ }
+
+ protected static boolean pluginEquals( Plugin a, Plugin b )
+ {
+ return CacheUtils.pluginEquals( a, b );
+ }
+
+ public void register( MavenProject project, Key key, CacheRecord record )
+ {
+ // default cache does not track plugin usage
+ }
+
+ public void dispose()
+ {
+ flush();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
new file mode 100644
index 00000000..d50df0e9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/ExtensionRealmCache.java
@@ -0,0 +1,84 @@
+package org.apache.maven.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.artifact.Artifact;
+import org.apache.maven.project.ExtensionDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+
+/**
+ * Caches extension class realms. <strong>Warning:</strong> This is an internal utility interface that is only public
+ * for technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted
+ * without prior notice.
+ *
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ */
+public interface ExtensionRealmCache
+{
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ static class CacheRecord
+ {
+
+ public final ClassRealm realm;
+
+ public final ExtensionDescriptor desciptor;
+
+ public final List<Artifact> artifacts;
+
+ public CacheRecord( ClassRealm realm, ExtensionDescriptor descriptor, List<Artifact> artifacts )
+ {
+ this.realm = realm;
+ this.desciptor = descriptor;
+ this.artifacts = artifacts;
+ }
+
+ }
+
+ Key createKey( List<Artifact> extensionArtifacts );
+
+ CacheRecord get( Key key );
+
+ CacheRecord put( Key key, ClassRealm extensionRealm, ExtensionDescriptor extensionDescriptor,
+ List<Artifact> artifacts );
+
+ void flush();
+
+ /**
+ * Registers the specified cache record for usage with the given project. Integrators can use the information
+ * collected from this method in combination with a custom cache implementation to dispose unused records from the
+ * cache.
+ *
+ * @param project The project that employs the plugin realm, must not be {@code null}.
+ * @param record The cache record being used for the project, must not be {@code null}.
+ */
+ void register( MavenProject project, Key key, CacheRecord record );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginDescriptorException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginDescriptorException.java
new file mode 100644
index 00000000..223ccd81
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginDescriptorException.java
@@ -0,0 +1,44 @@
+package org.apache.maven.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;
+
+public class InvalidPluginDescriptorException
+ extends Exception
+{
+
+ public InvalidPluginDescriptorException( String message, List<String> errors )
+ {
+ super( toMessage( message, errors ) );
+ }
+
+ private static String toMessage( String message, List<String> errors )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( message );
+ for ( String error : errors )
+ {
+ buffer.append( ", " ).append( error );
+ }
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java
new file mode 100644
index 00000000..b89fc869
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/InvalidPluginException.java
@@ -0,0 +1,48 @@
+package org.apache.maven.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.project.ProjectBuildingException;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+
+/**
+ * Thrown when a plugin is not internally consistent.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class InvalidPluginException
+ extends Exception
+{
+ public InvalidPluginException( String message, ProjectBuildingException e )
+ {
+ super( message, e );
+ }
+
+ public InvalidPluginException( String message, InvalidDependencyVersionException e )
+ {
+ super( message, e );
+ }
+
+ public InvalidPluginException( String message )
+ {
+ super( message );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/LegacySupport.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/LegacySupport.java
new file mode 100644
index 00000000..b246ed18
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/LegacySupport.java
@@ -0,0 +1,59 @@
+package org.apache.maven.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.execution.MavenSession;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * Helps to provide backward-compatibility with plugins that use legacy components. <strong>Warning:</strong> This is an
+ * internal utility interface that is only public for technical reasons, it is not part of the public API. In
+ * particular, this interface can be changed or deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface LegacySupport
+{
+
+ /**
+ * Sets the currently active session. Some legacy components are basically stateful and their API is missing
+ * parameters that would be required to delegate to a stateless component. Saving the session (in a thread-local
+ * variable) is our best effort to record any state that is required to enable proper delegation.
+ *
+ * @param session The currently active session, may be {@code null}.
+ */
+ void setSession( MavenSession session );
+
+ /**
+ * Gets the currently active session.
+ *
+ * @return The currently active session or {@code null} if none.
+ */
+ MavenSession getSession();
+
+ /**
+ * Gets the currently active repository session.
+ *
+ * @return The currently active repository session or {@code null} if none.
+ */
+ RepositorySystemSession getRepositorySession();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java
new file mode 100644
index 00000000..b228a1b4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java
@@ -0,0 +1,128 @@
+package org.apache.maven.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.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Provides basic services to manage Maven plugins and their mojos. This component is kept general in its design such
+ * that the plugins/mojos can be used in arbitrary contexts. In particular, the mojos can be used for ordinary build
+ * plugins as well as special purpose plugins like reports.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface MavenPluginManager
+{
+
+ /**
+ * Retrieves the descriptor for the specified plugin from its main artifact.
+ *
+ * @param plugin The plugin whose descriptor should be retrieved, must not be {@code null}.
+ * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
+ * null}.
+ * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
+ * @return The plugin descriptor, never {@code null}.
+ */
+ PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException;
+
+ /**
+ * Retrieves the descriptor for the specified plugin goal from the plugin's main artifact.
+ *
+ * @param plugin The plugin whose mojo descriptor should be retrieved, must not be {@code null}.
+ * @param goal The simple name of the mojo whose descriptor should be retrieved, must not be {@code null}.
+ * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
+ * null}.
+ * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
+ * @return The mojo descriptor, never {@code null}.
+ */
+ MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws MojoNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ InvalidPluginDescriptorException;
+
+ /**
+ * Verifies the specified plugin is compatible with the current Maven runtime.
+ *
+ * @param pluginDescriptor The descriptor of the plugin to check, must not be {@code null}.
+ */
+ void checkRequiredMavenVersion( PluginDescriptor pluginDescriptor )
+ throws PluginIncompatibleException;
+
+ /**
+ * Sets up the class realm for the specified plugin. Both the class realm and the plugin artifacts that constitute
+ * it will be stored in the plugin descriptor.
+ *
+ * @param pluginDescriptor The plugin descriptor in which to save the class realm and the plugin artifacts, must not
+ * be {@code null}.
+ * @param session The build session from which to pick the current project and repository settings, must not be
+ * {@code null}.
+ * @param parent The parent class realm for the plugin, may be {@code null} to use the Maven core realm.
+ * @param imports The packages/types to import from the parent realm, may be {@code null}.
+ * @param filter The filter used to exclude certain plugin dependencies, may be {@code null}.
+ */
+ void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
+ List<String> imports, DependencyFilter filter )
+ throws PluginResolutionException, PluginContainerException;
+
+ /**
+ * Sets up class realm for the specified build extensions plugin.
+ *
+ * @since 3.3.0
+ */
+ ExtensionRealmCache.CacheRecord setupExtensionsRealm( MavenProject project, Plugin plugin,
+ RepositorySystemSession session )
+ throws PluginManagerException;
+
+ /**
+ * Looks up the mojo for the specified mojo execution and populates its parameters from the configuration given by
+ * the mojo execution. The mojo/plugin descriptor associated with the mojo execution provides the class realm to
+ * lookup the mojo from. <strong>Warning:</strong> The returned mojo instance must be released via
+ * {@link #releaseMojo(Object, MojoExecution)} when the mojo is no longer needed to free any resources allocated for
+ * it.
+ *
+ * @param mojoInterface The component role of the mojo, must not be {@code null}.
+ * @param session The build session in whose context the mojo will be used, must not be {@code null}.
+ * @param mojoExecution The mojo execution to retrieve the mojo for, must not be {@code null}.
+ * @return The ready-to-execute mojo, never {@code null}.
+ */
+ <T> T getConfiguredMojo( Class<T> mojoInterface, MavenSession session, MojoExecution mojoExecution )
+ throws PluginConfigurationException, PluginContainerException;
+
+ /**
+ * Releases the specified mojo back to the container.
+ *
+ * @param mojo The mojo to release, may be {@code null}.
+ * @param mojoExecution The mojo execution the mojo was originally retrieved for, must not be {@code null}.
+ */
+ void releaseMojo( Object mojo, MojoExecution mojoExecution );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java
new file mode 100644
index 00000000..2eb2738b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java
@@ -0,0 +1,78 @@
+package org.apache.maven.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.ArrayList;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+
+public class MavenPluginValidator
+{
+ private final Artifact pluginArtifact;
+
+ private List<String> errors = new ArrayList<String>();
+
+ private boolean firstDescriptor = true;
+
+ public MavenPluginValidator( Artifact pluginArtifact )
+ {
+ this.pluginArtifact = pluginArtifact;
+ }
+
+ public void validate( PluginDescriptor pluginDescriptor )
+ {
+ /*
+ * NOTE: For plugins that depend on other plugin artifacts the plugin realm contains more than one plugin
+ * descriptor. However, only the first descriptor is of interest.
+ */
+ if ( !firstDescriptor )
+ {
+ return;
+ }
+ firstDescriptor = false;
+
+ if ( !pluginArtifact.getGroupId().equals( pluginDescriptor.getGroupId() ) )
+ {
+ errors.add( "Plugin's descriptor contains the wrong group ID: " + pluginDescriptor.getGroupId() );
+ }
+
+ if ( !pluginArtifact.getArtifactId().equals( pluginDescriptor.getArtifactId() ) )
+ {
+ errors.add( "Plugin's descriptor contains the wrong artifact ID: " + pluginDescriptor.getArtifactId() );
+ }
+
+ if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() ) )
+ {
+ errors.add( "Plugin's descriptor contains the wrong version: " + pluginDescriptor.getVersion() );
+ }
+ }
+
+ public boolean hasErrors()
+ {
+ return !errors.isEmpty();
+ }
+
+ public List<String> getErrors()
+ {
+ return errors;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
new file mode 100644
index 00000000..a417219e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
@@ -0,0 +1,237 @@
+package org.apache.maven.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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+public class MojoExecution
+{
+
+ private Plugin plugin;
+
+ private String goal;
+
+ private String executionId;
+
+ private MojoDescriptor mojoDescriptor;
+
+ private Xpp3Dom configuration;
+
+ /**
+ * Describes the source of an execution.
+ */
+ public enum Source
+ {
+
+ /**
+ * An execution that originates from the direct invocation of a goal from the CLI.
+ */
+ CLI,
+
+ /**
+ * An execution that originates from a goal bound to a lifecycle phase.
+ */
+ LIFECYCLE,
+ }
+
+ private Source source = Source.LIFECYCLE;
+
+ /**
+ * The phase may or may not have been bound to a phase but once the plan has been calculated we know what phase
+ * this mojo execution is going to run in.
+ */
+ private String lifecyclePhase;
+
+ /**
+ * The executions to fork before this execution, indexed by the groupId:artifactId:version of the project on which
+ * the forked execution are to be run and in reactor build order.
+ */
+ private Map<String, List<MojoExecution>> forkedExecutions = new LinkedHashMap<String, List<MojoExecution>>();
+
+ public MojoExecution( Plugin plugin, String goal, String executionId )
+ {
+ this.plugin = plugin;
+ this.goal = goal;
+ this.executionId = executionId;
+ }
+
+ public MojoExecution( MojoDescriptor mojoDescriptor )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ this.executionId = null;
+ this.configuration = null;
+ }
+
+ public MojoExecution( MojoDescriptor mojoDescriptor, String executionId, Source source )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ this.executionId = executionId;
+ this.configuration = null;
+ this.source = source;
+ }
+
+ public MojoExecution( MojoDescriptor mojoDescriptor, String executionId )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ this.executionId = executionId;
+ this.configuration = null;
+ }
+
+ public MojoExecution( MojoDescriptor mojoDescriptor, Xpp3Dom configuration )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ this.configuration = configuration;
+ this.executionId = null;
+ }
+
+ /**
+ * Gets the source of this execution.
+ *
+ * @return The source of this execution or {@code null} if unknown.
+ */
+ public Source getSource()
+ {
+ return source;
+ }
+
+ public String getExecutionId()
+ {
+ return executionId;
+ }
+
+ public Plugin getPlugin()
+ {
+ if ( mojoDescriptor != null )
+ {
+ return mojoDescriptor.getPluginDescriptor().getPlugin();
+ }
+
+ return plugin;
+ }
+
+ public MojoDescriptor getMojoDescriptor()
+ {
+ return mojoDescriptor;
+ }
+
+ public Xpp3Dom getConfiguration()
+ {
+ return configuration;
+ }
+
+ public void setConfiguration( Xpp3Dom configuration )
+ {
+ this.configuration = configuration;
+ }
+
+ public String identify()
+ {
+ StringBuilder sb = new StringBuilder( 256 );
+
+ sb.append( executionId );
+ sb.append( configuration.toString() );
+
+ return sb.toString();
+ }
+
+ public String getLifecyclePhase()
+ {
+ return lifecyclePhase;
+ }
+
+ public void setLifecyclePhase( String lifecyclePhase )
+ {
+ this.lifecyclePhase = lifecyclePhase;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ if ( mojoDescriptor != null )
+ {
+ buffer.append( mojoDescriptor.getId() );
+ }
+ buffer.append( " {execution: " ).append( executionId ).append( "}" );
+ return buffer.toString();
+ }
+
+ public String getGroupId()
+ {
+ if ( mojoDescriptor != null )
+ {
+ return mojoDescriptor.getPluginDescriptor().getGroupId();
+ }
+
+ return plugin.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ if ( mojoDescriptor != null )
+ {
+ return mojoDescriptor.getPluginDescriptor().getArtifactId();
+ }
+
+ return plugin.getArtifactId();
+ }
+
+ public String getVersion()
+ {
+ if ( mojoDescriptor != null )
+ {
+ return mojoDescriptor.getPluginDescriptor().getVersion();
+ }
+
+ return plugin.getVersion();
+ }
+
+ public String getGoal()
+ {
+ if ( mojoDescriptor != null )
+ {
+ return mojoDescriptor.getGoal();
+ }
+
+ return goal;
+ }
+
+ public void setMojoDescriptor( MojoDescriptor mojoDescriptor )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ }
+
+ public Map<String, List<MojoExecution>> getForkedExecutions()
+ {
+ return forkedExecutions;
+ }
+
+ public void setForkedExecutions( String projectKey, List<MojoExecution> forkedExecutions )
+ {
+ this.forkedExecutions.put( projectKey, forkedExecutions );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
new file mode 100644
index 00000000..17537a29
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginArtifactsCache.java
@@ -0,0 +1,91 @@
+package org.apache.maven.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.artifact.Artifact;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Caches plugin artifacts. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ */
+public interface PluginArtifactsCache
+{
+
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ static class CacheRecord
+ {
+
+ public final List<Artifact> artifacts;
+
+ public final PluginResolutionException exception;
+
+ public CacheRecord( List<Artifact> artifacts )
+ {
+ this.artifacts = artifacts;
+ this.exception = null;
+ }
+
+ public CacheRecord( PluginResolutionException exception )
+ {
+ this.artifacts = null;
+ this.exception = exception;
+ }
+ }
+
+ Key createKey( Plugin plugin, DependencyFilter extensionFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session );
+
+ CacheRecord get( Key key ) throws PluginResolutionException;
+
+ CacheRecord put( Key key, List<Artifact> pluginArtifacts );
+
+ CacheRecord put( Key key, PluginResolutionException e );
+
+ void flush();
+
+ /**
+ * Registers the specified cache record for usage with the given project. Integrators can use the information
+ * collected from this method in combination with a custom cache implementation to dispose unused records from the
+ * cache.
+ *
+ * @param project The project that employs the plugin realm, must not be {@code null}.
+ * @param record The cache record being used for the project, must not be {@code null}.
+ */
+ void register( MavenProject project, Key cacheKey, CacheRecord record );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
new file mode 100644
index 00000000..f4dcffcd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
@@ -0,0 +1,74 @@
+package org.apache.maven.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.plugin.descriptor.PluginDescriptor;
+import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+/**
+ * @author Jason van Zyl
+ */
+public class PluginConfigurationException
+ extends Exception
+{
+ private PluginDescriptor pluginDescriptor;
+
+ private String originalMessage;
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage )
+ {
+ super( originalMessage );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = originalMessage;
+ }
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage, Throwable cause )
+ {
+ super( originalMessage, cause );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = originalMessage;
+ }
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
+ ExpressionEvaluationException cause )
+ {
+ super( originalMessage, cause );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = originalMessage;
+ }
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
+ ComponentConfigurationException cause )
+ {
+ super( originalMessage, cause );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = originalMessage;
+ }
+
+ public PluginConfigurationException( PluginDescriptor pluginDescriptor, String originalMessage,
+ ComponentLookupException cause )
+ {
+ super( originalMessage, cause );
+ this.pluginDescriptor = pluginDescriptor;
+ this.originalMessage = originalMessage;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java
new file mode 100644
index 00000000..d35ac6c3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java
@@ -0,0 +1,88 @@
+package org.apache.maven.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.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+
+/**
+ * Exception which occurs to indicate that the plugin cannot be initialized due
+ * to some deeper problem with Plexus. Context information includes the groupId,
+ * artifactId, and version for the plugin; at times, the goal name for which
+ * execution failed; a message detailing the problem; the ClassRealm used to
+ * lookup the plugin; and the Plexus exception that caused this error.
+ *
+ * @author jdcasey
+ *
+ */
+public class PluginContainerException
+ extends PluginManagerException
+{
+
+ private ClassRealm pluginRealm;
+
+ public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
+ Throwable e )
+ {
+ super( mojoDescriptor, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
+ public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message,
+ ComponentLookupException e )
+ {
+ super( mojoDescriptor, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
+ public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, Throwable e )
+ {
+ super( plugin, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
+ public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
+ PlexusConfigurationException e )
+ {
+ super( plugin, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
+ public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message,
+ ComponentRepositoryException e )
+ {
+ super( plugin, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
+ public ClassRealm getPluginRealm()
+ {
+ return pluginRealm;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorCache.java
new file mode 100644
index 00000000..08b4f1bc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorCache.java
@@ -0,0 +1,58 @@
+package org.apache.maven.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.Plugin;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Caches raw plugin descriptors. A raw plugin descriptor is a descriptor that has just been extracted from the plugin
+ * artifact and does not contain any runtime specific data. The cache must not be used for descriptors that hold runtime
+ * data like the plugin realm. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginDescriptorCache
+{
+
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ Key createKey( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session );
+
+ void put( Key key, PluginDescriptor pluginDescriptor );
+
+ PluginDescriptor get( Key key );
+
+ void flush();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorParsingException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorParsingException.java
new file mode 100644
index 00000000..7d57b363
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginDescriptorParsingException.java
@@ -0,0 +1,58 @@
+package org.apache.maven.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.Plugin;
+
+/**
+ * @author Jason van Zyl
+ */
+public class PluginDescriptorParsingException
+ extends Exception
+{
+
+ public PluginDescriptorParsingException( Plugin plugin, String descriptorLocation, Throwable e )
+ {
+ super( createMessage( plugin, descriptorLocation, e ), e );
+ }
+
+ private static String createMessage( Plugin plugin, String descriptorLocation, Throwable e )
+ {
+ String message = "Failed to parse plugin descriptor";
+
+ if ( plugin != null )
+ {
+ message += " for " + plugin.getId();
+ }
+
+ if ( descriptorLocation != null )
+ {
+ message += " (" + descriptorLocation + ")";
+ }
+
+ if ( e != null )
+ {
+ message += ": " + e.getMessage();
+ }
+
+ return message;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
new file mode 100644
index 00000000..602d2cb4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginExecutionException.java
@@ -0,0 +1,90 @@
+package org.apache.maven.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.project.DuplicateArtifactAttachmentException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
+
+public class PluginExecutionException
+ extends PluginManagerException
+{
+
+ private final MojoExecution mojoExecution;
+
+ public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, String message )
+ {
+ super( mojoExecution.getMojoDescriptor(), project, message );
+ this.mojoExecution = mojoExecution;
+ }
+
+ public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, String message,
+ Throwable cause )
+ {
+ super( mojoExecution.getMojoDescriptor(), project, message, cause );
+ this.mojoExecution = mojoExecution;
+ }
+
+ public PluginExecutionException( MojoExecution mojoExecution, MavenProject project, Exception cause )
+ {
+ super( mojoExecution.getMojoDescriptor(), project, constructMessage( mojoExecution, cause ), cause );
+ this.mojoExecution = mojoExecution;
+ }
+
+ public PluginExecutionException( MojoExecution mojoExecution, MavenProject project,
+ DuplicateArtifactAttachmentException cause )
+ {
+ super( mojoExecution.getMojoDescriptor(), project, constructMessage( mojoExecution, cause ), cause );
+ this.mojoExecution = mojoExecution;
+ }
+
+ public MojoExecution getMojoExecution()
+ {
+ return mojoExecution;
+ }
+
+ private static String constructMessage( MojoExecution mojoExecution, Throwable cause )
+ {
+ String message;
+
+ if ( mojoExecution != null )
+ {
+ message =
+ "Execution " + mojoExecution.getExecutionId() + " of goal " + mojoExecution.getMojoDescriptor().getId()
+ + " failed";
+ }
+ else
+ {
+ message = "Mojo execution failed";
+ }
+
+ if ( cause != null && StringUtils.isNotEmpty( cause.getMessage() ) )
+ {
+ message += ": " + cause.getMessage();
+ }
+ else
+ {
+ message += ".";
+ }
+
+ return message;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginIncompatibleException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginIncompatibleException.java
new file mode 100644
index 00000000..f7b53ebd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginIncompatibleException.java
@@ -0,0 +1,36 @@
+package org.apache.maven.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.Plugin;
+
+/**
+ * Signals a plugin which is not compatible with the current Maven runtime.
+ */
+public class PluginIncompatibleException
+ extends PluginManagerException
+{
+
+ public PluginIncompatibleException( Plugin plugin, String message )
+ {
+ super( plugin, message, (Throwable) null );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginLoaderException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginLoaderException.java
new file mode 100644
index 00000000..161e1c4e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginLoaderException.java
@@ -0,0 +1,124 @@
+package org.apache.maven.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.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+
+/**
+ * Signifies a failure to load a plugin. This is used to abstract the specific errors which may be
+ * encountered at lower levels, and provide a dependable interface to the plugin-loading framework.
+ *
+ * @author jdcasey
+ *
+ */
+public class PluginLoaderException
+ extends Exception
+{
+
+ private String pluginKey;
+
+ public PluginLoaderException( Plugin plugin, String message, ArtifactResolutionException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, ArtifactNotFoundException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, PluginNotFoundException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, PluginVersionResolutionException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, InvalidVersionSpecificationException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, InvalidPluginException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, PluginManagerException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message, PluginVersionNotFoundException cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( Plugin plugin, String message )
+ {
+ super( message );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( String message )
+ {
+ super( message );
+ }
+
+ public PluginLoaderException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public PluginLoaderException( ReportPlugin plugin, String message, Throwable cause )
+ {
+ super( message, cause );
+ pluginKey = plugin.getKey();
+ }
+
+ public PluginLoaderException( ReportPlugin plugin, String message )
+ {
+ super( message );
+ pluginKey = plugin.getKey();
+ }
+
+ public String getPluginKey()
+ {
+ return pluginKey;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
new file mode 100644
index 00000000..1a3100e9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
@@ -0,0 +1,82 @@
+package org.apache.maven.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.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
+ */
+@Deprecated
+public interface PluginManager
+{
+ String ROLE = PluginManager.class.getName();
+
+ void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
+ throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
+ InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException;
+
+ PluginDescriptor getPluginDescriptorForPrefix( String prefix );
+
+ Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project );
+
+ PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
+ ArtifactRepository localRepository )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException;
+
+ Object getPluginComponent( Plugin plugin, String role, String roleHint )
+ throws PluginManagerException, ComponentLookupException;
+
+ Map getPluginComponents( Plugin plugin, String role )
+ throws ComponentLookupException, PluginManagerException;
+
+ /**
+ * @since 2.2.1
+ */
+ PluginDescriptor loadPluginDescriptor( Plugin plugin, MavenProject project, MavenSession session )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException;
+
+ /**
+ * @since 2.2.1
+ */
+ PluginDescriptor loadPluginFully( Plugin plugin, MavenProject project, MavenSession session )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java
new file mode 100644
index 00000000..dc8f9a20
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java
@@ -0,0 +1,197 @@
+package org.apache.maven.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.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+
+/**
+ * Exception in the plugin manager.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class PluginManagerException
+ extends Exception
+{
+
+ private final String pluginGroupId;
+
+ private final String pluginArtifactId;
+
+ private final String pluginVersion;
+
+ private String goal;
+
+ private MavenProject project;
+
+ protected PluginManagerException( Plugin plugin, String message, MavenProject project, Throwable cause )
+ {
+ super( message, cause );
+
+ this.project = project;
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ public PluginManagerException( Plugin plugin, String message, Throwable cause )
+ {
+ super( message, cause );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ protected PluginManagerException( MojoDescriptor mojoDescriptor, String message, Throwable cause )
+ {
+ super( message, cause );
+ pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
+ pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
+ pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
+ goal = mojoDescriptor.getGoal();
+ }
+
+ protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message )
+ {
+ super( message );
+ this.project = project;
+ pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
+ pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
+ pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
+ goal = mojoDescriptor.getGoal();
+ }
+
+ protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message,
+ Throwable cause )
+ {
+ super( message, cause );
+ this.project = project;
+ pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
+ pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
+ pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
+ goal = mojoDescriptor.getGoal();
+ }
+
+ public PluginManagerException( Plugin plugin, InvalidVersionSpecificationException cause )
+ {
+ super( cause );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ public PluginManagerException( Plugin plugin, String message, PlexusConfigurationException cause )
+ {
+ super( message, cause );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ public PluginManagerException( Plugin plugin, String message, ComponentRepositoryException cause )
+ {
+ super( message, cause );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message,
+ NoSuchRealmException cause )
+ {
+ super( message, cause );
+
+ this.project = project;
+ pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
+ pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
+ pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
+ goal = mojoDescriptor.getGoal();
+ }
+
+ public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project,
+ PlexusContainerException cause )
+ {
+ super( message, cause );
+
+ this.project = project;
+
+ PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
+ pluginGroupId = pd.getGroupId();
+ pluginArtifactId = pd.getArtifactId();
+ pluginVersion = pd.getVersion();
+
+ goal = mojoDescriptor.getGoal();
+ }
+
+ public PluginManagerException( Plugin plugin, String message, PlexusContainerException cause )
+ {
+ super( message, cause );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ }
+
+ public PluginManagerException( Plugin plugin, String message, MavenProject project )
+ {
+ super( message );
+
+ pluginGroupId = plugin.getGroupId();
+ pluginArtifactId = plugin.getArtifactId();
+ pluginVersion = plugin.getVersion();
+ this.project = project;
+ }
+
+ public String getPluginGroupId()
+ {
+ return pluginGroupId;
+ }
+
+ public String getPluginArtifactId()
+ {
+ return pluginArtifactId;
+ }
+
+ public String getPluginVersion()
+ {
+ return pluginVersion;
+ }
+
+ public String getGoal()
+ {
+ return goal;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
new file mode 100644
index 00000000..ef54e2d7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginNotFoundException.java
@@ -0,0 +1,58 @@
+package org.apache.maven.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.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.model.Plugin;
+
+/**
+ * Exception occurring trying to resolve a plugin.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class PluginNotFoundException
+ extends AbstractArtifactResolutionException
+{
+ private Plugin plugin;
+
+ public PluginNotFoundException( Plugin plugin, ArtifactNotFoundException e )
+ {
+ super( "Plugin could not be found - check that the goal name is correct: " + e.getMessage(), e.getGroupId(),
+ e.getArtifactId(), e.getVersion(), "maven-plugin", null, e.getRemoteRepositories(), null, e.getCause() );
+ this.plugin = plugin;
+ }
+
+ public PluginNotFoundException( Plugin plugin, List<ArtifactRepository> remoteRepositories )
+ {
+ super( "Plugin could not be found, please check its coordinates for typos and ensure the required"
+ + " plugin repositories are defined in the POM", plugin.getGroupId(), plugin.getArtifactId(),
+ plugin.getVersion(), "maven-plugin", null, remoteRepositories, null );
+ this.plugin = plugin;
+ }
+
+ public Plugin getPlugin()
+ {
+ return plugin;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
new file mode 100644
index 00000000..dcf459e7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
@@ -0,0 +1,192 @@
+package org.apache.maven.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.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.Parameter;
+import org.codehaus.plexus.util.StringUtils;
+
+public class PluginParameterException
+ extends PluginConfigurationException
+{
+
+ private final List<Parameter> parameters;
+
+ private final MojoDescriptor mojo;
+
+ public PluginParameterException( MojoDescriptor mojo, List<Parameter> parameters )
+ {
+ super( mojo.getPluginDescriptor(), "The parameters " + format( parameters ) + " for goal "
+ + mojo.getRoleHint() + " are missing or invalid" );
+
+ this.mojo = mojo;
+
+ this.parameters = parameters;
+ }
+
+ private static String format( List<Parameter> parameters )
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ if ( parameters != null )
+ {
+ for ( Parameter parameter : parameters )
+ {
+ if ( buffer.length() > 0 )
+ {
+ buffer.append( ", " );
+ }
+ buffer.append( '\'' ).append( parameter.getName() ).append( '\'' );
+ }
+ }
+ return buffer.toString();
+ }
+
+ public MojoDescriptor getMojoDescriptor()
+ {
+ return mojo;
+ }
+
+ public List<Parameter> getParameters()
+ {
+ return parameters;
+ }
+
+ private static void decomposeParameterIntoUserInstructions( MojoDescriptor mojo, Parameter param,
+ StringBuilder messageBuffer )
+ {
+ String expression = param.getExpression();
+
+ if ( param.isEditable() )
+ {
+ boolean isArray = param.getType().endsWith( "[]" );
+ boolean isCollection = false;
+ boolean isMap = false;
+ boolean isProperties = false;
+ if ( !isArray )
+ {
+ try
+ {
+ //assuming Type is available in current ClassLoader
+ isCollection = Collection.class.isAssignableFrom( Class.forName( param.getType() ) );
+ isMap = Map.class.isAssignableFrom( Class.forName( param.getType() ) );
+ isProperties = Properties.class.isAssignableFrom( Class.forName( param.getType() ) );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ // assume it is not assignable from Collection or Map
+ }
+ }
+
+ messageBuffer.append( "Inside the definition for plugin \'" );
+ messageBuffer.append( mojo.getPluginDescriptor().getArtifactId() );
+ messageBuffer.append( "\', specify the following:\n\n<configuration>\n ...\n" );
+ messageBuffer.append( " <" ).append( param.getName() ).append( '>' );
+ if ( isArray || isCollection )
+ {
+ messageBuffer.append( '\n' );
+ messageBuffer.append( " <item>" );
+ }
+ else if ( isProperties )
+ {
+ messageBuffer.append( '\n' );
+ messageBuffer.append( " <property>\n" );
+ messageBuffer.append( " <name>KEY</name>\n" );
+ messageBuffer.append( " <value>" );
+ }
+ else if ( isMap )
+ {
+ messageBuffer.append( '\n' );
+ messageBuffer.append( " <KEY>" );
+ }
+ messageBuffer.append( "VALUE" );
+ if ( isArray || isCollection )
+ {
+ messageBuffer.append( "</item>\n" );
+ messageBuffer.append( " " );
+ }
+ else if ( isProperties )
+ {
+ messageBuffer.append( "</value>\n" );
+ messageBuffer.append( " </property>\n" );
+ messageBuffer.append( " " );
+ }
+ else if ( isMap )
+ {
+ messageBuffer.append( "</KEY>\n" );
+ messageBuffer.append( " " );
+ }
+ messageBuffer.append( "</" ).append( param.getName() ).append( ">\n" );
+ messageBuffer.append( "</configuration>" );
+
+ String alias = param.getAlias();
+ if ( StringUtils.isNotEmpty( alias ) && !alias.equals( param.getName() ) )
+ {
+ messageBuffer.append( "\n\n-OR-\n\n<configuration>\n ...\n <" ).append( alias ).append(
+ ">VALUE</" ).append( alias ).append( ">\n</configuration>\n" );
+ }
+ }
+
+ if ( StringUtils.isEmpty( expression ) )
+ {
+ messageBuffer.append( "." );
+ }
+ else
+ {
+ if ( param.isEditable() )
+ {
+ messageBuffer.append( "\n\n-OR-\n\n" );
+ }
+
+ //addParameterUsageInfo( expression, messageBuffer );
+ }
+ }
+
+ public String buildDiagnosticMessage()
+ {
+ StringBuilder messageBuffer = new StringBuilder( 256 );
+
+ List<Parameter> params = getParameters();
+ MojoDescriptor mojo = getMojoDescriptor();
+
+ messageBuffer.append( "One or more required plugin parameters are invalid/missing for \'" )
+ .append( mojo.getPluginDescriptor().getGoalPrefix() ).append( ":" ).append( mojo.getGoal() )
+ .append( "\'\n" );
+
+ int idx = 0;
+ for ( Iterator<Parameter> it = params.iterator(); it.hasNext(); idx++ )
+ {
+ Parameter param = it.next();
+
+ messageBuffer.append( "\n[" ).append( idx ).append( "] " );
+
+ decomposeParameterIntoUserInstructions( mojo, param, messageBuffer );
+
+ messageBuffer.append( "\n" );
+ }
+
+ return messageBuffer.toString();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
new file mode 100644
index 00000000..9199ba5a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
@@ -0,0 +1,482 @@
+package org.apache.maven.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.io.File;
+import java.util.Properties;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.path.PathTranslator;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.configurator.expression.TypeAwareExpressionEvaluator;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
+
+/**
+ * Evaluator for plugin parameters expressions. Content surrounded by <code>${</code> and <code>}</code> is evaluated.
+ * Recognized values are:<table border="1">
+ * <tr><th>expression</th> <th></th> <th>evaluation result</th></tr>
+ * <tr><td><code>session</code></td> <td></td> <td>the actual {@link MavenSession}</td></tr>
+ * <tr><td><code>session.*</code></td> <td>(since Maven 3)</td><td></td></tr>
+ * <tr><td><code>localRepository</code></td> <td></td>
+ * <td>{@link MavenSession#getLocalRepository()}</td></tr>
+ * <tr><td><code>reactorProjects</code></td> <td></td> <td>{@link MavenSession#getProjects()}</td></tr>
+ * <tr><td><code>repositorySystemSession</code></td><td> (since Maven 3)</td>
+ * <td>{@link MavenSession#getRepositorySession()}</td></tr>
+ * <tr><td><code>project</code></td> <td></td>
+ * <td>{@link MavenSession#getCurrentProject()}</td></tr>
+ * <tr><td><code>project.*</code></td> <td></td> <td></td></tr>
+ * <tr><td><code>pom.*</code></td> <td>(since Maven 3)</td><td>same as <code>project.*</code></td></tr>
+ * <tr><td><code>executedProject</code></td> <td></td>
+ * <td>{@link MavenProject#getExecutionProject()}</td></tr>
+ * <tr><td><code>settings</code></td> <td></td> <td>{@link MavenSession#getSettings()}</td></tr>
+ * <tr><td><code>settings.*</code></td> <td></td> <td></td></tr>
+ * <tr><td><code>basedir</code></td> <td></td>
+ * <td>{@link MavenSession#getExecutionRootDirectory()} or
+ * <code>System.getProperty( "user.dir" )</code> if null</td></tr>
+ * <tr><td><code>mojoExecution</code></td> <td></td> <td>the actual {@link MojoExecution}</td></tr>
+ * <tr><td><code>mojo</code></td> <td>(since Maven 3)</td><td>same as <code>mojoExecution</code></td></tr>
+ * <tr><td><code>mojo.*</code></td> <td>(since Maven 3)</td><td></td></tr>
+ * <tr><td><code>plugin</code></td> <td>(since Maven 3)</td>
+ * <td>{@link MojoExecution#getMojoDescriptor()}.{@link MojoDescriptor#getPluginDescriptor()
+ * getPluginDescriptor()}</td></tr>
+ * <tr><td><code>plugin.*</code></td> <td></td> <td></td></tr>
+ * <tr><td><code>*</code></td> <td></td> <td>system properties</td></tr>
+ * <tr><td><code>*</code></td> <td></td> <td>project properties</td></tr>
+ * </table>
+ * <i>Notice:</i> <code>reports</code> was supported in Maven 2.x but was removed in Maven 3
+ *
+ * @author Jason van Zyl
+ * @see MavenSession
+ * @see MojoExecution
+ */
+public class PluginParameterExpressionEvaluator
+ implements TypeAwareExpressionEvaluator
+{
+ private MavenSession session;
+
+ private MojoExecution mojoExecution;
+
+ private MavenProject project;
+
+ private String basedir;
+
+ private Properties properties;
+
+ @Deprecated //TODO: used by the Enforcer plugin
+ public PluginParameterExpressionEvaluator( MavenSession session, MojoExecution mojoExecution,
+ PathTranslator pathTranslator, Logger logger, MavenProject project,
+ Properties properties )
+ {
+ this( session, mojoExecution );
+ }
+
+ public PluginParameterExpressionEvaluator( MavenSession session )
+ {
+ this( session, null );
+ }
+
+ public PluginParameterExpressionEvaluator( MavenSession session, MojoExecution mojoExecution )
+ {
+ this.session = session;
+ this.mojoExecution = mojoExecution;
+ this.properties = new Properties();
+ this.project = session.getCurrentProject();
+
+ //
+ // Maven4: We may want to evaluate how this is used but we add these separate as the
+ // getExecutionProperties is deprecated in MavenSession.
+ //
+ this.properties.putAll( session.getUserProperties() );
+ this.properties.putAll( session.getSystemProperties() );
+
+ String basedir = null;
+
+ if ( project != null )
+ {
+ File projectFile = project.getBasedir();
+
+ // this should always be the case for non-super POM instances...
+ if ( projectFile != null )
+ {
+ basedir = projectFile.getAbsolutePath();
+ }
+ }
+
+ if ( basedir == null )
+ {
+ basedir = session.getExecutionRootDirectory();
+ }
+
+ if ( basedir == null )
+ {
+ basedir = System.getProperty( "user.dir" );
+ }
+
+ this.basedir = basedir;
+ }
+
+ @Override
+ public Object evaluate( String expr )
+ throws ExpressionEvaluationException
+ {
+ return evaluate( expr, null );
+ }
+
+ @Override
+ public Object evaluate( String expr, Class<?> type )
+ throws ExpressionEvaluationException
+ {
+ Object value = null;
+
+ if ( expr == null )
+ {
+ return null;
+ }
+
+ String expression = stripTokens( expr );
+ if ( expression.equals( expr ) )
+ {
+ int index = expr.indexOf( "${" );
+ if ( index >= 0 )
+ {
+ int lastIndex = expr.indexOf( "}", index );
+ if ( lastIndex >= 0 )
+ {
+ String retVal = expr.substring( 0, index );
+
+ if ( ( index > 0 ) && ( expr.charAt( index - 1 ) == '$' ) )
+ {
+ retVal += expr.substring( index + 1, lastIndex + 1 );
+ }
+ else
+ {
+ Object subResult = evaluate( expr.substring( index, lastIndex + 1 ) );
+
+ if ( subResult != null )
+ {
+ retVal += subResult;
+ }
+ else
+ {
+ retVal += "$" + expr.substring( index + 1, lastIndex + 1 );
+ }
+ }
+
+ retVal += evaluate( expr.substring( lastIndex + 1 ) );
+ return retVal;
+ }
+ }
+
+ // Was not an expression
+ if ( expression.contains( "$$" ) )
+ {
+ return expression.replaceAll( "\\$\\$", "\\$" );
+ }
+ else
+ {
+ return expression;
+ }
+ }
+
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ if ( "localRepository".equals( expression ) )
+ {
+ value = session.getLocalRepository();
+ }
+ else if ( "session".equals( expression ) )
+ {
+ value = session;
+ }
+ else if ( expression.startsWith( "session" ) )
+ {
+ try
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ String pathExpression = expression.substring( 1, pathSeparator );
+ value = ReflectionValueExtractor.evaluate( pathExpression, session );
+ value = value + expression.substring( pathSeparator );
+ }
+ else
+ {
+ value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), session );
+ }
+ }
+ catch ( Exception e )
+ {
+ // TODO: don't catch exception
+ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression,
+ e );
+ }
+ }
+ else if ( "reactorProjects".equals( expression ) )
+ {
+ value = session.getProjects();
+ }
+ else if ( "mojoExecution".equals( expression ) )
+ {
+ value = mojoExecution;
+ }
+ else if ( "project".equals( expression ) )
+ {
+ value = project;
+ }
+ else if ( "executedProject".equals( expression ) )
+ {
+ value = project.getExecutionProject();
+ }
+ else if ( expression.startsWith( "project" ) || expression.startsWith( "pom" ) )
+ {
+ try
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ String pathExpression = expression.substring( 0, pathSeparator );
+ value = ReflectionValueExtractor.evaluate( pathExpression, project );
+ value = value + expression.substring( pathSeparator );
+ }
+ else
+ {
+ value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), project );
+ }
+ }
+ catch ( Exception e )
+ {
+ // TODO: don't catch exception
+ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression,
+ e );
+ }
+ }
+ else if ( expression.equals( "repositorySystemSession" ) )
+ {
+ value = session.getRepositorySession();
+ }
+ else if ( expression.equals( "mojo" ) )
+ {
+ value = mojoExecution;
+ }
+ else if ( expression.startsWith( "mojo" ) )
+ {
+ try
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ String pathExpression = expression.substring( 1, pathSeparator );
+ value = ReflectionValueExtractor.evaluate( pathExpression, mojoExecution );
+ value = value + expression.substring( pathSeparator );
+ }
+ else
+ {
+ value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), mojoExecution );
+ }
+ }
+ catch ( Exception e )
+ {
+ // TODO: don't catch exception
+ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression,
+ e );
+ }
+ }
+ else if ( expression.equals( "plugin" ) )
+ {
+ value = mojoDescriptor.getPluginDescriptor();
+ }
+ else if ( expression.startsWith( "plugin" ) )
+ {
+ try
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+
+ if ( pathSeparator > 0 )
+ {
+ String pathExpression = expression.substring( 1, pathSeparator );
+ value = ReflectionValueExtractor.evaluate( pathExpression, pluginDescriptor );
+ value = value + expression.substring( pathSeparator );
+ }
+ else
+ {
+ value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), pluginDescriptor );
+ }
+ }
+ catch ( Exception e )
+ {
+ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression,
+ e );
+ }
+ }
+ else if ( "settings".equals( expression ) )
+ {
+ value = session.getSettings();
+ }
+ else if ( expression.startsWith( "settings" ) )
+ {
+ try
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ String pathExpression = expression.substring( 1, pathSeparator );
+ value = ReflectionValueExtractor.evaluate( pathExpression, session.getSettings() );
+ value = value + expression.substring( pathSeparator );
+ }
+ else
+ {
+ value = ReflectionValueExtractor.evaluate( expression.substring( 1 ), session.getSettings() );
+ }
+ }
+ catch ( Exception e )
+ {
+ // TODO: don't catch exception
+ throw new ExpressionEvaluationException( "Error evaluating plugin parameter expression: " + expression,
+ e );
+ }
+ }
+ else if ( "basedir".equals( expression ) )
+ {
+ value = basedir;
+ }
+ else if ( expression.startsWith( "basedir" ) )
+ {
+ int pathSeparator = expression.indexOf( "/" );
+
+ if ( pathSeparator > 0 )
+ {
+ value = basedir + expression.substring( pathSeparator );
+ }
+ }
+
+ /*
+ * MNG-4312: We neither have reserved all of the above magic expressions nor is their set fixed/well-known (it
+ * gets occasionally extended by newer Maven versions). This imposes the risk for existing plugins to
+ * unintentionally use such a magic expression for an ordinary system property. So here we check whether we
+ * ended up with a magic value that is not compatible with the type of the configured mojo parameter (a string
+ * could still be converted by the configurator so we leave those alone). If so, back off to evaluating the
+ * expression from properties only.
+ */
+ if ( value != null && type != null && !( value instanceof String ) && !isTypeCompatible( type, value ) )
+ {
+ value = null;
+ }
+
+ if ( value == null )
+ {
+ // The CLI should win for defining properties
+
+ if ( properties != null )
+ {
+ // We will attempt to get nab a system property as a way to specify a
+ // parameter to a plugins. My particular case here is allowing the surefire
+ // plugin to run a single test so I want to specify that class on the cli
+ // as a parameter.
+
+ value = properties.getProperty( expression );
+ }
+
+ if ( ( value == null ) && ( ( project != null ) && ( project.getProperties() != null ) ) )
+ {
+ value = project.getProperties().getProperty( expression );
+ }
+
+ }
+
+ if ( value instanceof String )
+ {
+ // TODO: without #, this could just be an evaluate call...
+
+ String val = (String) value;
+
+ int exprStartDelimiter = val.indexOf( "${" );
+
+ if ( exprStartDelimiter >= 0 )
+ {
+ if ( exprStartDelimiter > 0 )
+ {
+ value = val.substring( 0, exprStartDelimiter ) + evaluate( val.substring( exprStartDelimiter ) );
+ }
+ else
+ {
+ value = evaluate( val.substring( exprStartDelimiter ) );
+ }
+ }
+ }
+
+ return value;
+ }
+
+ private static boolean isTypeCompatible( Class<?> type, Object value )
+ {
+ if ( type.isInstance( value ) )
+ {
+ return true;
+ }
+ // likely Boolean -> boolean, Short -> int etc. conversions, it's not the problem case we try to avoid
+ return ( ( type.isPrimitive() || type.getName().startsWith( "java.lang." ) )
+ && value.getClass().getName().startsWith( "java.lang." ) );
+ }
+
+ private String stripTokens( String expr )
+ {
+ if ( expr.startsWith( "${" ) && ( expr.indexOf( "}" ) == expr.length() - 1 ) )
+ {
+ expr = expr.substring( 2, expr.length() - 1 );
+ }
+ return expr;
+ }
+
+ @Override
+ public File alignToBaseDirectory( File file )
+ {
+ // TODO: Copied from the DefaultInterpolator. We likely want to resurrect the PathTranslator or at least a
+ // similar component for re-usage
+ if ( file != null )
+ {
+ if ( file.isAbsolute() )
+ {
+ // path was already absolute, just normalize file separator and we're done
+ }
+ else if ( file.getPath().startsWith( File.separator ) )
+ {
+ // drive-relative Windows path, don't align with project directory but with drive root
+ file = file.getAbsoluteFile();
+ }
+ else
+ {
+ // an ordinary relative path, align with project directory
+ file = new File( new File( basedir, file.getPath() ).toURI().normalize() ).getAbsoluteFile();
+ }
+ }
+ return file;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
new file mode 100644
index 00000000..1ffa1575
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginRealmCache.java
@@ -0,0 +1,85 @@
+package org.apache.maven.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 java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Caches plugin class realms. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ */
+public interface PluginRealmCache
+{
+
+ static class CacheRecord
+ {
+ public final ClassRealm realm;
+
+ public final List<Artifact> artifacts;
+
+ public CacheRecord( ClassRealm realm, List<Artifact> artifacts )
+ {
+ this.realm = realm;
+ this.artifacts = artifacts;
+ }
+ }
+
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ Key createKey( Plugin plugin, ClassLoader parentRealm, Map<String, ClassLoader> foreignImports,
+ DependencyFilter dependencyFilter, List<RemoteRepository> repositories,
+ RepositorySystemSession session );
+
+ CacheRecord get( Key key );
+
+ CacheRecord put( Key key, ClassRealm pluginRealm, List<Artifact> pluginArtifacts );
+
+ void flush();
+
+ /**
+ * Registers the specified cache record for usage with the given project. Integrators can use the information
+ * collected from this method in combination with a custom cache implementation to dispose unused records from the
+ * cache.
+ *
+ * @param project The project that employs the plugin realm, must not be {@code null}.
+ * @param record The cache record being used for the project, must not be {@code null}.
+ */
+ void register( MavenProject project, Key key, CacheRecord record );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java
new file mode 100644
index 00000000..ab280643
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java
@@ -0,0 +1,47 @@
+package org.apache.maven.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.Plugin;
+
+/**
+ * Exception occurring trying to resolve a plugin.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class PluginResolutionException
+ extends Exception
+{
+
+ private final Plugin plugin;
+
+ public PluginResolutionException( Plugin plugin, Throwable cause )
+ {
+ super( "Plugin " + plugin.getId() + " or one of its dependencies could not be resolved: " + cause.getMessage(),
+ cause );
+ this.plugin = plugin;
+ }
+
+ public Plugin getPlugin()
+ {
+ return plugin;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
new file mode 100644
index 00000000..f397c1e8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultLegacySupport.java
@@ -0,0 +1,74 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.concurrent.atomic.AtomicReference;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.LegacySupport;
+import org.codehaus.plexus.component.annotations.Component;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * Helps to provide backward-compatibility with plugins that use legacy components. <strong>Warning:</strong> This is an
+ * internal utility component that is only public for technical reasons, it is not part of the public API. In
+ * particular, this component can be changed or deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = LegacySupport.class )
+public class DefaultLegacySupport
+ implements LegacySupport
+{
+
+ private static final ThreadLocal<AtomicReference<MavenSession>> SESSION =
+ new InheritableThreadLocal<AtomicReference<MavenSession>>();
+
+ public void setSession( MavenSession session )
+ {
+ AtomicReference<MavenSession> reference = DefaultLegacySupport.SESSION.get();
+ if ( reference != null )
+ {
+ reference.set( null );
+ }
+
+ if ( session == null && reference != null )
+ {
+ DefaultLegacySupport.SESSION.remove();
+ }
+ else
+ {
+ DefaultLegacySupport.SESSION.set( new AtomicReference<MavenSession>( session ) );
+ }
+ }
+
+ public MavenSession getSession()
+ {
+ AtomicReference<MavenSession> currentSession = DefaultLegacySupport.SESSION.get();
+ return currentSession != null ? currentSession.get() : null;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ MavenSession session = getSession();
+ return ( session != null ) ? session.getRepositorySession() : null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
new file mode 100644
index 00000000..d32e04c1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
@@ -0,0 +1,946 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.classrealm.ClassRealmManager;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.scope.internal.MojoExecutionScopeModule;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.monitor.logging.DefaultLog;
+import org.apache.maven.plugin.ContextEnabled;
+import org.apache.maven.plugin.DebugConfigurationListener;
+import org.apache.maven.plugin.ExtensionRealmCache;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.MavenPluginManager;
+import org.apache.maven.plugin.MavenPluginValidator;
+import org.apache.maven.plugin.Mojo;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoNotFoundException;
+import org.apache.maven.plugin.PluginArtifactsCache;
+import org.apache.maven.plugin.PluginConfigurationException;
+import org.apache.maven.plugin.PluginContainerException;
+import org.apache.maven.plugin.PluginDescriptorCache;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginIncompatibleException;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginParameterException;
+import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
+import org.apache.maven.plugin.PluginRealmCache;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.Parameter;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
+import org.apache.maven.plugin.version.DefaultPluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.project.ExtensionDescriptor;
+import org.apache.maven.project.ExtensionDescriptorBuilder;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.rtinfo.RuntimeInformation;
+import org.apache.maven.session.scope.internal.SessionScopeModule;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException;
+import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
+import org.codehaus.plexus.component.configurator.ComponentConfigurator;
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
+import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.configuration.PlexusConfigurationException;
+import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.logging.LoggerManager;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.util.filter.AndDependencyFilter;
+import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
+
+/**
+ * Provides basic services to manage Maven plugins and their mojos. This component is kept general in its design such
+ * that the plugins/mojos can be used in arbitrary contexts. In particular, the mojos can be used for ordinary build
+ * plugins as well as special purpose plugins like reports.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = MavenPluginManager.class )
+public class DefaultMavenPluginManager
+ implements MavenPluginManager
+{
+
+ /**
+ * PluginId=>ExtensionRealmCache.CacheRecord map MavenProject context value key. The map is used to ensure the same
+ * class realm is used to load build extensions and load mojos for extensions=true plugins.
+ *
+ * @noreference this is part of internal implementation and may be changed or removed without notice
+ * @since 3.3.0
+ */
+ public static final String KEY_EXTENSIONS_REALMS = DefaultMavenPluginManager.class.getName() + "/extensionsRealms";
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private LoggerManager loggerManager;
+
+ @Requirement
+ private PlexusContainer container;
+
+ @Requirement
+ private ClassRealmManager classRealmManager;
+
+ @Requirement
+ private PluginDescriptorCache pluginDescriptorCache;
+
+ @Requirement
+ private PluginRealmCache pluginRealmCache;
+
+ @Requirement
+ private PluginDependenciesResolver pluginDependenciesResolver;
+
+ @Requirement
+ private RuntimeInformation runtimeInformation;
+
+ @Requirement
+ private ExtensionRealmCache extensionRealmCache;
+
+ @Requirement
+ private PluginVersionResolver pluginVersionResolver;
+
+ @Requirement
+ private PluginArtifactsCache pluginArtifactsCache;
+
+ private ExtensionDescriptorBuilder extensionDescriptorBuilder = new ExtensionDescriptorBuilder();
+
+ private PluginDescriptorBuilder builder = new PluginDescriptorBuilder();
+
+ public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException
+ {
+ PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session );
+
+ PluginDescriptor pluginDescriptor = pluginDescriptorCache.get( cacheKey );
+
+ if ( pluginDescriptor == null )
+ {
+ org.eclipse.aether.artifact.Artifact artifact =
+ pluginDependenciesResolver.resolve( plugin, repositories, session );
+
+ Artifact pluginArtifact = RepositoryUtils.toArtifact( artifact );
+
+ pluginDescriptor = extractPluginDescriptor( pluginArtifact, plugin );
+
+ pluginDescriptor.setRequiredMavenVersion( artifact.getProperty( "requiredMavenVersion", null ) );
+
+ pluginDescriptorCache.put( cacheKey, pluginDescriptor );
+ }
+
+ pluginDescriptor.setPlugin( plugin );
+
+ return pluginDescriptor;
+ }
+
+ private PluginDescriptor extractPluginDescriptor( Artifact pluginArtifact, Plugin plugin )
+ throws PluginDescriptorParsingException, InvalidPluginDescriptorException
+ {
+ PluginDescriptor pluginDescriptor = null;
+
+ File pluginFile = pluginArtifact.getFile();
+
+ try
+ {
+ if ( pluginFile.isFile() )
+ {
+ JarFile pluginJar = new JarFile( pluginFile, false );
+ try
+ {
+ ZipEntry pluginDescriptorEntry = pluginJar.getEntry( getPluginDescriptorLocation() );
+
+ if ( pluginDescriptorEntry != null )
+ {
+ InputStream is = pluginJar.getInputStream( pluginDescriptorEntry );
+
+ pluginDescriptor = parsePluginDescriptor( is, plugin, pluginFile.getAbsolutePath() );
+ }
+ }
+ finally
+ {
+ pluginJar.close();
+ }
+ }
+ else
+ {
+ File pluginXml = new File( pluginFile, getPluginDescriptorLocation() );
+
+ if ( pluginXml.isFile() )
+ {
+ InputStream is = new BufferedInputStream( new FileInputStream( pluginXml ) );
+ try
+ {
+ pluginDescriptor = parsePluginDescriptor( is, plugin, pluginXml.getAbsolutePath() );
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ }
+
+ if ( pluginDescriptor == null )
+ {
+ throw new IOException( "No plugin descriptor found at " + getPluginDescriptorLocation() );
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new PluginDescriptorParsingException( plugin, pluginFile.getAbsolutePath(), e );
+ }
+
+ MavenPluginValidator validator = new MavenPluginValidator( pluginArtifact );
+
+ validator.validate( pluginDescriptor );
+
+ if ( validator.hasErrors() )
+ {
+ throw new InvalidPluginDescriptorException( "Invalid plugin descriptor for " + plugin.getId() + " ("
+ + pluginFile + ")", validator.getErrors() );
+ }
+
+ pluginDescriptor.setPluginArtifact( pluginArtifact );
+
+ return pluginDescriptor;
+ }
+
+ private String getPluginDescriptorLocation()
+ {
+ return "META-INF/maven/plugin.xml";
+ }
+
+ private PluginDescriptor parsePluginDescriptor( InputStream is, Plugin plugin, String descriptorLocation )
+ throws PluginDescriptorParsingException
+ {
+ try
+ {
+ Reader reader = ReaderFactory.newXmlReader( is );
+
+ PluginDescriptor pluginDescriptor = builder.build( reader, descriptorLocation );
+
+ return pluginDescriptor;
+ }
+ catch ( IOException e )
+ {
+ throw new PluginDescriptorParsingException( plugin, descriptorLocation, e );
+ }
+ catch ( PlexusConfigurationException e )
+ {
+ throw new PluginDescriptorParsingException( plugin, descriptorLocation, e );
+ }
+ }
+
+ public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws MojoNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
+ InvalidPluginDescriptorException
+ {
+ PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin, repositories, session );
+
+ MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
+
+ if ( mojoDescriptor == null )
+ {
+ throw new MojoNotFoundException( goal, pluginDescriptor );
+ }
+
+ return mojoDescriptor;
+ }
+
+ public void checkRequiredMavenVersion( PluginDescriptor pluginDescriptor )
+ throws PluginIncompatibleException
+ {
+ String requiredMavenVersion = pluginDescriptor.getRequiredMavenVersion();
+ if ( StringUtils.isNotBlank( requiredMavenVersion ) )
+ {
+ try
+ {
+ if ( !runtimeInformation.isMavenVersion( requiredMavenVersion ) )
+ {
+ throw new PluginIncompatibleException( pluginDescriptor.getPlugin(), "The plugin "
+ + pluginDescriptor.getId() + " requires Maven version " + requiredMavenVersion );
+ }
+ }
+ catch ( RuntimeException e )
+ {
+ logger.warn( "Could not verify plugin's Maven prerequisite: " + e.getMessage() );
+ }
+ }
+ }
+
+ public synchronized void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session,
+ ClassLoader parent, List<String> imports, DependencyFilter filter )
+ throws PluginResolutionException, PluginContainerException
+ {
+ Plugin plugin = pluginDescriptor.getPlugin();
+ MavenProject project = session.getCurrentProject();
+
+ if ( plugin.isExtensions() )
+ {
+ ExtensionRealmCache.CacheRecord extensionRecord;
+ try
+ {
+ RepositorySystemSession repositorySession = session.getRepositorySession();
+ extensionRecord = setupExtensionsRealm( project, plugin, repositorySession );
+ }
+ catch ( PluginManagerException e )
+ {
+ // extensions realm is expected to be fully setup at this point
+ // any exception means a problem in maven code, not a user error
+ throw new IllegalStateException( e );
+ }
+
+ ClassRealm pluginRealm = extensionRecord.realm;
+ List<Artifact> pluginArtifacts = extensionRecord.artifacts;
+
+ for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
+ {
+ componentDescriptor.setRealm( pluginRealm );
+ }
+
+ pluginDescriptor.setClassRealm( pluginRealm );
+ pluginDescriptor.setArtifacts( pluginArtifacts );
+ }
+ else
+ {
+ Map<String, ClassLoader> foreignImports = calcImports( project, parent, imports );
+
+ PluginRealmCache.Key cacheKey =
+ pluginRealmCache.createKey( plugin, parent, foreignImports, filter,
+ project.getRemotePluginRepositories(), session.getRepositorySession() );
+
+ PluginRealmCache.CacheRecord cacheRecord = pluginRealmCache.get( cacheKey );
+
+ if ( cacheRecord != null )
+ {
+ pluginDescriptor.setClassRealm( cacheRecord.realm );
+ pluginDescriptor.setArtifacts( new ArrayList<Artifact>( cacheRecord.artifacts ) );
+ for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
+ {
+ componentDescriptor.setRealm( cacheRecord.realm );
+ }
+ }
+ else
+ {
+ createPluginRealm( pluginDescriptor, session, parent, foreignImports, filter );
+
+ cacheRecord =
+ pluginRealmCache.put( cacheKey, pluginDescriptor.getClassRealm(), pluginDescriptor.getArtifacts() );
+ }
+
+ pluginRealmCache.register( project, cacheKey, cacheRecord );
+ }
+ }
+
+ private void createPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
+ Map<String, ClassLoader> foreignImports, DependencyFilter filter )
+ throws PluginResolutionException, PluginContainerException
+ {
+ Plugin plugin = pluginDescriptor.getPlugin();
+
+ if ( plugin == null )
+ {
+ throw new IllegalArgumentException( "incomplete plugin descriptor, plugin missing" );
+ }
+
+ Artifact pluginArtifact = pluginDescriptor.getPluginArtifact();
+
+ if ( pluginArtifact == null )
+ {
+ throw new IllegalArgumentException( "incomplete plugin descriptor, plugin artifact missing" );
+ }
+
+ MavenProject project = session.getCurrentProject();
+
+ final ClassRealm pluginRealm;
+ final List<Artifact> pluginArtifacts;
+
+ RepositorySystemSession repositorySession = session.getRepositorySession();
+ DependencyFilter dependencyFilter = project.getExtensionDependencyFilter();
+ dependencyFilter = AndDependencyFilter.newInstance( dependencyFilter, filter );
+
+ DependencyNode root =
+ pluginDependenciesResolver.resolve( plugin, RepositoryUtils.toArtifact( pluginArtifact ),
+ dependencyFilter, project.getRemotePluginRepositories(),
+ repositorySession );
+
+ PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
+ root.accept( nlg );
+
+ pluginArtifacts = toMavenArtifacts( root, nlg );
+
+ pluginRealm =
+ classRealmManager.createPluginRealm( plugin, parent, null, foreignImports,
+ toAetherArtifacts( pluginArtifacts ) );
+
+ discoverPluginComponents( pluginRealm, plugin, pluginDescriptor );
+
+ pluginDescriptor.setClassRealm( pluginRealm );
+ pluginDescriptor.setArtifacts( pluginArtifacts );
+ }
+
+ private void discoverPluginComponents( final ClassRealm pluginRealm, Plugin plugin,
+ PluginDescriptor pluginDescriptor )
+ throws PluginContainerException
+ {
+ try
+ {
+ if ( pluginDescriptor != null )
+ {
+ for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
+ {
+ componentDescriptor.setRealm( pluginRealm );
+ container.addComponentDescriptor( componentDescriptor );
+ }
+ }
+
+ ( (DefaultPlexusContainer) container ).discoverComponents( pluginRealm,
+ new SessionScopeModule( container ),
+ new MojoExecutionScopeModule( container ) );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new PluginContainerException( plugin, pluginRealm, "Error in component graph of plugin "
+ + plugin.getId() + ": " + e.getMessage(), e );
+ }
+ catch ( CycleDetectedInComponentGraphException e )
+ {
+ throw new PluginContainerException( plugin, pluginRealm, "Error in component graph of plugin "
+ + plugin.getId() + ": " + e.getMessage(), e );
+ }
+ }
+
+ private List<org.eclipse.aether.artifact.Artifact> toAetherArtifacts( final List<Artifact> pluginArtifacts )
+ {
+ return new ArrayList<org.eclipse.aether.artifact.Artifact>( RepositoryUtils.toArtifacts( pluginArtifacts ) );
+ }
+
+ private List<Artifact> toMavenArtifacts( DependencyNode root, PreorderNodeListGenerator nlg )
+ {
+ List<Artifact> artifacts = new ArrayList<Artifact>( nlg.getNodes().size() );
+ RepositoryUtils.toArtifacts( artifacts, Collections.singleton( root ), Collections.<String>emptyList(), null );
+ for ( Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
+ {
+ Artifact artifact = it.next();
+ if ( artifact.getFile() == null )
+ {
+ it.remove();
+ }
+ }
+ return artifacts;
+ }
+
+ private Map<String, ClassLoader> calcImports( MavenProject project, ClassLoader parent, List<String> imports )
+ {
+ Map<String, ClassLoader> foreignImports = new HashMap<String, ClassLoader>();
+
+ ClassLoader projectRealm = project.getClassRealm();
+ if ( projectRealm != null )
+ {
+ foreignImports.put( "", projectRealm );
+ }
+ else
+ {
+ foreignImports.put( "", classRealmManager.getMavenApiRealm() );
+ }
+
+ if ( parent != null && imports != null )
+ {
+ for ( String parentImport : imports )
+ {
+ foreignImports.put( parentImport, parent );
+ }
+ }
+
+ return foreignImports;
+ }
+
+ public <T> T getConfiguredMojo( Class<T> mojoInterface, MavenSession session, MojoExecution mojoExecution )
+ throws PluginConfigurationException, PluginContainerException
+ {
+ MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
+
+ PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+
+ ClassRealm pluginRealm = pluginDescriptor.getClassRealm();
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Configuring mojo " + mojoDescriptor.getId() + " from plugin realm " + pluginRealm );
+ }
+
+ // We are forcing the use of the plugin realm for all lookups that might occur during
+ // the lifecycle that is part of the lookup. Here we are specifically trying to keep
+ // lookups that occur in contextualize calls in line with the right realm.
+ ClassRealm oldLookupRealm = container.setLookupRealm( pluginRealm );
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader( pluginRealm );
+
+ try
+ {
+ T mojo;
+
+ try
+ {
+ mojo = container.lookup( mojoInterface, mojoDescriptor.getRoleHint() );
+ }
+ catch ( ComponentLookupException e )
+ {
+ Throwable cause = e.getCause();
+ while ( cause != null && !( cause instanceof LinkageError )
+ && !( cause instanceof ClassNotFoundException ) )
+ {
+ cause = cause.getCause();
+ }
+
+ if ( ( cause instanceof NoClassDefFoundError ) || ( cause instanceof ClassNotFoundException ) )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "Unable to load the mojo '" + mojoDescriptor.getGoal() + "' in the plugin '"
+ + pluginDescriptor.getId() + "'. A required class is missing: " + cause.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), cause );
+ }
+ else if ( cause instanceof LinkageError )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "Unable to load the mojo '" + mojoDescriptor.getGoal() + "' in the plugin '"
+ + pluginDescriptor.getId() + "' due to an API incompatibility: " + e.getClass().getName()
+ + ": " + cause.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), cause );
+ }
+
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to load the mojo '"
+ + mojoDescriptor.getGoal() + "' (or one of its required components) from the plugin '"
+ + pluginDescriptor.getId() + "'", e );
+ }
+
+ if ( mojo instanceof ContextEnabled )
+ {
+ MavenProject project = session.getCurrentProject();
+
+ Map<String, Object> pluginContext = session.getPluginContext( pluginDescriptor, project );
+
+ if ( pluginContext != null )
+ {
+ pluginContext.put( "project", project );
+
+ pluginContext.put( "pluginDescriptor", pluginDescriptor );
+
+ ( (ContextEnabled) mojo ).setPluginContext( pluginContext );
+ }
+ }
+
+ if ( mojo instanceof Mojo )
+ {
+ Logger mojoLogger = loggerManager.getLoggerForComponent( mojoDescriptor.getImplementation() );
+ ( (Mojo) mojo ).setLog( new DefaultLog( mojoLogger ) );
+ }
+
+ Xpp3Dom dom = mojoExecution.getConfiguration();
+
+ PlexusConfiguration pomConfiguration;
+
+ if ( dom == null )
+ {
+ pomConfiguration = new XmlPlexusConfiguration( "configuration" );
+ }
+ else
+ {
+ pomConfiguration = new XmlPlexusConfiguration( dom );
+ }
+
+ ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution );
+
+ populatePluginFields( mojo, mojoDescriptor, pluginRealm, pomConfiguration, expressionEvaluator );
+
+ return mojo;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( oldClassLoader );
+ container.setLookupRealm( oldLookupRealm );
+ }
+ }
+
+ private void populatePluginFields( Object mojo, MojoDescriptor mojoDescriptor, ClassRealm pluginRealm,
+ PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
+ throws PluginConfigurationException
+ {
+ ComponentConfigurator configurator = null;
+
+ String configuratorId = mojoDescriptor.getComponentConfigurator();
+
+ if ( StringUtils.isEmpty( configuratorId ) )
+ {
+ configuratorId = "basic";
+ }
+
+ try
+ {
+ // TODO: could the configuration be passed to lookup and the configurator known to plexus via the descriptor
+ // so that this method could entirely be handled by a plexus lookup?
+ configurator = container.lookup( ComponentConfigurator.class, configuratorId );
+
+ ConfigurationListener listener = new DebugConfigurationListener( logger );
+
+ ValidatingConfigurationListener validator =
+ new ValidatingConfigurationListener( mojo, mojoDescriptor, listener );
+
+ logger.debug( "Configuring mojo '" + mojoDescriptor.getId() + "' with " + configuratorId
+ + " configurator -->" );
+
+ configurator.configureComponent( mojo, configuration, expressionEvaluator, pluginRealm, validator );
+
+ logger.debug( "-- end configuration --" );
+
+ Collection<Parameter> missingParameters = validator.getMissingParameters();
+ if ( !missingParameters.isEmpty() )
+ {
+ if ( "basic".equals( configuratorId ) )
+ {
+ throw new PluginParameterException( mojoDescriptor, new ArrayList<Parameter>( missingParameters ) );
+ }
+ else
+ {
+ /*
+ * NOTE: Other configurators like the map-oriented one don't call into the listener, so do it the
+ * hard way.
+ */
+ validateParameters( mojoDescriptor, configuration, expressionEvaluator );
+ }
+ }
+ }
+ catch ( ComponentConfigurationException e )
+ {
+ String message = "Unable to parse configuration of mojo " + mojoDescriptor.getId();
+ if ( e.getFailedConfiguration() != null )
+ {
+ message += " for parameter " + e.getFailedConfiguration().getName();
+ }
+ message += ": " + e.getMessage();
+
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), message, e );
+ }
+ catch ( ComponentLookupException e )
+ {
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(),
+ "Unable to retrieve component configurator " + configuratorId
+ + " for configuration of mojo " + mojoDescriptor.getId(), e );
+ }
+ catch ( NoClassDefFoundError e )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "A required class was missing during configuration of mojo " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), os.toString(), e );
+ }
+ catch ( LinkageError e )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "An API incompatibility was encountered during configuration of mojo " + mojoDescriptor.getId()
+ + ": " + e.getClass().getName() + ": " + e.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), os.toString(), e );
+ }
+ finally
+ {
+ if ( configurator != null )
+ {
+ try
+ {
+ container.release( configurator );
+ }
+ catch ( ComponentLifecycleException e )
+ {
+ logger.debug( "Failed to release mojo configurator - ignoring." );
+ }
+ }
+ }
+ }
+
+ private void validateParameters( MojoDescriptor mojoDescriptor, PlexusConfiguration configuration,
+ ExpressionEvaluator expressionEvaluator )
+ throws ComponentConfigurationException, PluginParameterException
+ {
+ if ( mojoDescriptor.getParameters() == null )
+ {
+ return;
+ }
+
+ List<Parameter> invalidParameters = new ArrayList<Parameter>();
+
+ for ( Parameter parameter : mojoDescriptor.getParameters() )
+ {
+ if ( !parameter.isRequired() )
+ {
+ continue;
+ }
+
+ Object value = null;
+
+ PlexusConfiguration config = configuration.getChild( parameter.getName(), false );
+ if ( config != null )
+ {
+ String expression = config.getValue( null );
+
+ try
+ {
+ value = expressionEvaluator.evaluate( expression );
+
+ if ( value == null )
+ {
+ value = config.getAttribute( "default-value", null );
+ }
+ }
+ catch ( ExpressionEvaluationException e )
+ {
+ String msg =
+ "Error evaluating the expression '" + expression + "' for configuration value '"
+ + configuration.getName() + "'";
+ throw new ComponentConfigurationException( configuration, msg, e );
+ }
+ }
+
+ if ( value == null && ( config == null || config.getChildCount() <= 0 ) )
+ {
+ invalidParameters.add( parameter );
+ }
+ }
+
+ if ( !invalidParameters.isEmpty() )
+ {
+ throw new PluginParameterException( mojoDescriptor, invalidParameters );
+ }
+ }
+
+ public void releaseMojo( Object mojo, MojoExecution mojoExecution )
+ {
+ if ( mojo != null )
+ {
+ try
+ {
+ container.release( mojo );
+ }
+ catch ( ComponentLifecycleException e )
+ {
+ String goalExecId = mojoExecution.getGoal();
+
+ if ( mojoExecution.getExecutionId() != null )
+ {
+ goalExecId += " {execution: " + mojoExecution.getExecutionId() + "}";
+ }
+
+ logger.debug( "Error releasing mojo for " + goalExecId, e );
+ }
+ }
+ }
+
+ public ExtensionRealmCache.CacheRecord setupExtensionsRealm( MavenProject project, Plugin plugin,
+ RepositorySystemSession session )
+ throws PluginManagerException
+ {
+ @SuppressWarnings( "unchecked" )
+ Map<String, ExtensionRealmCache.CacheRecord> pluginRealms =
+ (Map<String, ExtensionRealmCache.CacheRecord>) project.getContextValue( KEY_EXTENSIONS_REALMS );
+ if ( pluginRealms == null )
+ {
+ pluginRealms = new HashMap<String, ExtensionRealmCache.CacheRecord>();
+ project.setContextValue( KEY_EXTENSIONS_REALMS, pluginRealms );
+ }
+
+ final String pluginKey = plugin.getId();
+
+ ExtensionRealmCache.CacheRecord extensionRecord = pluginRealms.get( pluginKey );
+ if ( extensionRecord != null )
+ {
+ return extensionRecord;
+ }
+
+ final List<RemoteRepository> repositories = project.getRemotePluginRepositories();
+
+ // resolve plugin version as necessary
+ if ( plugin.getVersion() == null )
+ {
+ PluginVersionRequest versionRequest = new DefaultPluginVersionRequest( plugin, session, repositories );
+ try
+ {
+ plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() );
+ }
+ catch ( PluginVersionResolutionException e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+ }
+
+ // resolve plugin artifacts
+ List<Artifact> artifacts;
+ PluginArtifactsCache.Key cacheKey = pluginArtifactsCache.createKey( plugin, null, repositories, session );
+ PluginArtifactsCache.CacheRecord recordArtifacts;
+ try
+ {
+ recordArtifacts = pluginArtifactsCache.get( cacheKey );
+ }
+ catch ( PluginResolutionException e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+ if ( recordArtifacts != null )
+ {
+ artifacts = recordArtifacts.artifacts;
+ }
+ else
+ {
+ try
+ {
+ artifacts = resolveExtensionArtifacts( plugin, repositories, session );
+ recordArtifacts = pluginArtifactsCache.put( cacheKey, artifacts );
+ }
+ catch ( PluginResolutionException e )
+ {
+ pluginArtifactsCache.put( cacheKey, e );
+ pluginArtifactsCache.register( project, cacheKey, recordArtifacts );
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+ }
+ pluginArtifactsCache.register( project, cacheKey, recordArtifacts );
+
+ // create and cache extensions realms
+ final ExtensionRealmCache.Key extensionKey = extensionRealmCache.createKey( artifacts );
+ extensionRecord = extensionRealmCache.get( extensionKey );
+ if ( extensionRecord == null )
+ {
+ ClassRealm extensionRealm = classRealmManager.createExtensionRealm( plugin,
+ toAetherArtifacts( artifacts ) );
+
+ // TODO figure out how to use the same PluginDescriptor when running mojos
+
+ PluginDescriptor pluginDescriptor = null;
+ if ( plugin.isExtensions() && !artifacts.isEmpty() )
+ {
+ // ignore plugin descriptor parsing errors at this point
+ // these errors will reported during calculation of project build execution plan
+ try
+ {
+ pluginDescriptor = extractPluginDescriptor( artifacts.get( 0 ), plugin );
+ }
+ catch ( PluginDescriptorParsingException e )
+ {
+ // ignore, see above
+ }
+ catch ( InvalidPluginDescriptorException e )
+ {
+ // ignore, see above
+ }
+ }
+
+ discoverPluginComponents( extensionRealm, plugin, pluginDescriptor );
+
+ ExtensionDescriptor extensionDescriptor = null;
+ Artifact extensionArtifact = artifacts.get( 0 );
+ try
+ {
+ extensionDescriptor = extensionDescriptorBuilder.build( extensionArtifact.getFile() );
+ }
+ catch ( IOException e )
+ {
+ String message = "Invalid extension descriptor for " + plugin.getId() + ": " + e.getMessage();
+ if ( logger.isDebugEnabled() )
+ {
+ logger.error( message, e );
+ }
+ else
+ {
+ logger.error( message );
+ }
+ }
+ extensionRecord = extensionRealmCache.put( extensionKey, extensionRealm, extensionDescriptor, artifacts );
+ }
+ extensionRealmCache.register( project, extensionKey, extensionRecord );
+ pluginRealms.put( pluginKey, extensionRecord );
+
+ return extensionRecord;
+ }
+
+ private List<Artifact> resolveExtensionArtifacts( Plugin extensionPlugin, List<RemoteRepository> repositories,
+ RepositorySystemSession session )
+ throws PluginResolutionException
+ {
+ DependencyNode root = pluginDependenciesResolver.resolve( extensionPlugin, null, null, repositories, session );
+ PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
+ root.accept( nlg );
+ return toMavenArtifacts( root, nlg );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
new file mode 100644
index 00000000..5b0c2712
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginDependenciesResolver.java
@@ -0,0 +1,256 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.collection.DependencyCollectionException;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.DependencyVisitor;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactDescriptorException;
+import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
+import org.eclipse.aether.resolution.ArtifactDescriptorResult;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.DependencyRequest;
+import org.eclipse.aether.resolution.DependencyResolutionException;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.filter.AndDependencyFilter;
+import org.eclipse.aether.util.filter.ScopeDependencyFilter;
+import org.eclipse.aether.util.graph.selector.AndDependencySelector;
+import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
+import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
+
+/**
+ * Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility class that
+ * is only public for technical reasons, it is not part of the public API. In particular, this class can be changed or
+ * deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginDependenciesResolver.class )
+public class DefaultPluginDependenciesResolver
+ implements PluginDependenciesResolver
+{
+
+ private static final String REPOSITORY_CONTEXT = "plugin";
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private RepositorySystem repoSystem;
+
+ private Artifact toArtifact( Plugin plugin, RepositorySystemSession session )
+ {
+ return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), null, "jar", plugin.getVersion(),
+ session.getArtifactTypeRegistry().get( "maven-plugin" ) );
+ }
+
+ public Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException
+ {
+ RequestTrace trace = RequestTrace.newChild( null, plugin );
+
+ Artifact pluginArtifact = toArtifact( plugin, session );
+
+ try
+ {
+ DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
+ pluginSession.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, false ) );
+
+ ArtifactDescriptorRequest request =
+ new ArtifactDescriptorRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
+ request.setTrace( trace );
+ ArtifactDescriptorResult result = repoSystem.readArtifactDescriptor( pluginSession, request );
+
+ pluginArtifact = result.getArtifact();
+
+ String requiredMavenVersion = (String) result.getProperties().get( "prerequisites.maven" );
+ if ( requiredMavenVersion != null )
+ {
+ Map<String, String> props = new LinkedHashMap<String, String>( pluginArtifact.getProperties() );
+ props.put( "requiredMavenVersion", requiredMavenVersion );
+ pluginArtifact = pluginArtifact.setProperties( props );
+ }
+ }
+ catch ( ArtifactDescriptorException e )
+ {
+ throw new PluginResolutionException( plugin, e );
+ }
+
+ try
+ {
+ ArtifactRequest request = new ArtifactRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
+ request.setTrace( trace );
+ pluginArtifact = repoSystem.resolveArtifact( session, request ).getArtifact();
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new PluginResolutionException( plugin, e );
+ }
+
+ return pluginArtifact;
+ }
+
+ /**
+ * @since 3.3.0
+ */
+ public DependencyNode resolveCoreExtension( Plugin plugin, DependencyFilter dependencyFilter,
+ List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException
+ {
+ return resolveInternal( plugin, null /* pluginArtifact */, dependencyFilter, null /* transformer */,
+ repositories, session );
+ }
+
+ public DependencyNode resolve( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
+ List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException
+ {
+ return resolveInternal( plugin, pluginArtifact, dependencyFilter, new PlexusUtilsInjector(), repositories,
+ session );
+ }
+
+ private DependencyNode resolveInternal( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
+ DependencyGraphTransformer transformer,
+ List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException
+ {
+ RequestTrace trace = RequestTrace.newChild( null, plugin );
+
+ if ( pluginArtifact == null )
+ {
+ pluginArtifact = toArtifact( plugin, session );
+ }
+
+ DependencyFilter collectionFilter = new ScopeDependencyFilter( "provided", "test" );
+ DependencyFilter resolutionFilter = AndDependencyFilter.newInstance( collectionFilter, dependencyFilter );
+
+ DependencyNode node;
+
+ try
+ {
+ DependencySelector selector =
+ AndDependencySelector.newInstance( session.getDependencySelector(), new WagonExcluder() );
+
+ transformer =
+ ChainedDependencyGraphTransformer.newInstance( session.getDependencyGraphTransformer(), transformer );
+
+ DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
+ pluginSession.setDependencySelector( selector );
+ pluginSession.setDependencyGraphTransformer( transformer );
+
+ CollectRequest request = new CollectRequest();
+ request.setRequestContext( REPOSITORY_CONTEXT );
+ request.setRepositories( repositories );
+ request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) );
+ for ( Dependency dependency : plugin.getDependencies() )
+ {
+ org.eclipse.aether.graph.Dependency pluginDep =
+ RepositoryUtils.toDependency( dependency, session.getArtifactTypeRegistry() );
+ if ( !JavaScopes.SYSTEM.equals( pluginDep.getScope() ) )
+ {
+ pluginDep = pluginDep.setScope( JavaScopes.RUNTIME );
+ }
+ request.addDependency( pluginDep );
+ }
+
+ DependencyRequest depRequest = new DependencyRequest( request, resolutionFilter );
+ depRequest.setTrace( trace );
+
+ request.setTrace( RequestTrace.newChild( trace, depRequest ) );
+
+ node = repoSystem.collectDependencies( pluginSession, request ).getRoot();
+
+ if ( logger.isDebugEnabled() )
+ {
+ node.accept( new GraphLogger() );
+ }
+
+ depRequest.setRoot( node );
+ repoSystem.resolveDependencies( session, depRequest );
+ }
+ catch ( DependencyCollectionException e )
+ {
+ throw new PluginResolutionException( plugin, e );
+ }
+ catch ( DependencyResolutionException e )
+ {
+ throw new PluginResolutionException( plugin, e.getCause() );
+ }
+
+ return node;
+ }
+
+ class GraphLogger
+ implements DependencyVisitor
+ {
+
+ private String indent = "";
+
+ public boolean visitEnter( DependencyNode node )
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ buffer.append( indent );
+ org.eclipse.aether.graph.Dependency dep = node.getDependency();
+ if ( dep != null )
+ {
+ Artifact art = dep.getArtifact();
+
+ buffer.append( art );
+ buffer.append( ':' ).append( dep.getScope() );
+ }
+
+ logger.debug( buffer.toString() );
+ indent += " ";
+ return true;
+ }
+
+ public boolean visitLeave( DependencyNode node )
+ {
+ indent = indent.substring( 0, indent.length() - 3 );
+ return true;
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java
new file mode 100644
index 00000000..015060f6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java
@@ -0,0 +1,261 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.Map;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.InvalidPluginDescriptorException;
+import org.apache.maven.plugin.InvalidPluginException;
+import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.plugin.MavenPluginManager;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.PluginConfigurationException;
+import org.apache.maven.plugin.PluginDescriptorParsingException;
+import org.apache.maven.plugin.PluginManager;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.prefix.DefaultPluginPrefixRequest;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.prefix.PluginPrefixRequest;
+import org.apache.maven.plugin.prefix.PluginPrefixResolver;
+import org.apache.maven.plugin.prefix.PluginPrefixResult;
+import org.apache.maven.plugin.version.DefaultPluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
+import org.apache.maven.plugin.version.PluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.settings.Settings;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginManager.class )
+public class DefaultPluginManager
+ implements PluginManager
+{
+
+ @Requirement
+ private PlexusContainer container;
+
+ @Requirement
+ private MavenPluginManager pluginManager;
+
+ @Requirement
+ private PluginVersionResolver pluginVersionResolver;
+
+ @Requirement
+ private PluginPrefixResolver pluginPrefixResolver;
+
+ @Requirement
+ private LegacySupport legacySupport;
+
+ public void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
+ throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
+ InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getPluginComponent( Plugin plugin, String role, String roleHint )
+ throws PluginManagerException, ComponentLookupException
+ {
+ MavenSession session = legacySupport.getSession();
+
+ PluginDescriptor pluginDescriptor;
+ try
+ {
+ pluginDescriptor =
+ pluginManager.getPluginDescriptor( plugin, session.getCurrentProject().getRemotePluginRepositories(),
+ session.getRepositorySession() );
+
+ pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
+ }
+ catch ( Exception e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader( pluginDescriptor.getClassRealm() );
+
+ return container.lookup( role, roleHint );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( oldClassLoader );
+ }
+ }
+
+ public Map getPluginComponents( Plugin plugin, String role )
+ throws ComponentLookupException, PluginManagerException
+ {
+ MavenSession session = legacySupport.getSession();
+
+ PluginDescriptor pluginDescriptor;
+ try
+ {
+ pluginDescriptor =
+ pluginManager.getPluginDescriptor( plugin, session.getCurrentProject().getRemotePluginRepositories(),
+ session.getRepositorySession() );
+
+ pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
+ }
+ catch ( Exception e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader( pluginDescriptor.getClassRealm() );
+
+ return container.lookupMap( role );
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( oldClassLoader );
+ }
+ }
+
+ public Plugin getPluginDefinitionForPrefix( String prefix, MavenSession session, MavenProject project )
+ {
+ PluginPrefixRequest request = new DefaultPluginPrefixRequest( prefix, session );
+ request.setPom( project.getModel() );
+
+ try
+ {
+ PluginPrefixResult result = pluginPrefixResolver.resolve( request );
+
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( result.getGroupId() );
+ plugin.setArtifactId( result.getArtifactId() );
+
+ return plugin;
+ }
+ catch ( NoPluginFoundForPrefixException e )
+ {
+ return null;
+ }
+ }
+
+ public PluginDescriptor getPluginDescriptorForPrefix( String prefix )
+ {
+ MavenSession session = legacySupport.getSession();
+
+ PluginPrefixRequest request = new DefaultPluginPrefixRequest( prefix, session );
+
+ try
+ {
+ PluginPrefixResult result = pluginPrefixResolver.resolve( request );
+
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( result.getGroupId() );
+ plugin.setArtifactId( result.getArtifactId() );
+
+ return loadPluginDescriptor( plugin, session.getCurrentProject(), session );
+ }
+ catch ( Exception e )
+ {
+ return null;
+ }
+ }
+
+ public PluginDescriptor loadPluginDescriptor( Plugin plugin, MavenProject project, MavenSession session )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException
+ {
+ return verifyPlugin( plugin, project, session.getSettings(), session.getLocalRepository() );
+ }
+
+ public PluginDescriptor loadPluginFully( Plugin plugin, MavenProject project, MavenSession session )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException
+ {
+ PluginDescriptor pluginDescriptor = loadPluginDescriptor( plugin, project, session );
+
+ try
+ {
+ pluginManager.setupPluginRealm( pluginDescriptor, session, null, null, null );
+ }
+ catch ( PluginResolutionException e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+
+ return pluginDescriptor;
+ }
+
+ public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
+ ArtifactRepository localRepository )
+ throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
+ InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+ PluginVersionNotFoundException
+ {
+ MavenSession session = legacySupport.getSession();
+
+ if ( plugin.getVersion() == null )
+ {
+ PluginVersionRequest versionRequest =
+ new DefaultPluginVersionRequest( plugin, session.getRepositorySession(),
+ project.getRemotePluginRepositories() );
+ plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() );
+ }
+
+ try
+ {
+ return pluginManager.getPluginDescriptor( plugin, project.getRemotePluginRepositories(),
+ session.getRepositorySession() );
+ }
+ catch ( PluginResolutionException e )
+ {
+ throw new PluginNotFoundException( plugin, project.getPluginArtifactRepositories() );
+ }
+ catch ( PluginDescriptorParsingException e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+ catch ( InvalidPluginDescriptorException e )
+ {
+ throw new PluginManagerException( plugin, e.getMessage(), e );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
new file mode 100644
index 00000000..16a0b63c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PlexusUtilsInjector.java
@@ -0,0 +1,87 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.eclipse.aether.RepositoryException;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.collection.DependencyGraphTransformationContext;
+import org.eclipse.aether.collection.DependencyGraphTransformer;
+import org.eclipse.aether.graph.DefaultDependencyNode;
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.util.artifact.JavaScopes;
+
+/**
+ * Injects plexus-utils:1.1 into a plugin's class path if it doesn't already declare a dependency on plexus-utils. This
+ * is another legacy bit to provide backward-compat with Maven 2.x.
+ *
+ * @author Benjamin Bentmann
+ */
+class PlexusUtilsInjector
+ implements DependencyGraphTransformer
+{
+
+ private static final String GID = "org.codehaus.plexus";
+
+ private static final String AID = "plexus-utils";
+
+ private static final String VER = "1.1";
+
+ private static final String EXT = "jar";
+
+ public DependencyNode transformGraph( DependencyNode node, DependencyGraphTransformationContext context )
+ throws RepositoryException
+ {
+ if ( findPlexusUtils( node ) == null )
+ {
+ Artifact pu = new DefaultArtifact( GID, AID, null, EXT, VER );
+ DefaultDependencyNode child = new DefaultDependencyNode( new Dependency( pu, JavaScopes.RUNTIME ) );
+ child.setRepositories( node.getRepositories() );
+ child.setRequestContext( node.getRequestContext() );
+ node.getChildren().add( child );
+ }
+
+ return node;
+ }
+
+ private DependencyNode findPlexusUtils( DependencyNode node )
+ {
+ Artifact artifact = node.getDependency().getArtifact();
+
+ if ( AID.equals( artifact.getArtifactId() ) && GID.equals( artifact.getGroupId() )
+ && EXT.equals( artifact.getExtension() ) && "".equals( artifact.getClassifier() ) )
+ {
+ return node;
+ }
+
+ for ( DependencyNode child : node.getChildren() )
+ {
+ DependencyNode result = findPlexusUtils( child );
+ if ( result != null )
+ {
+ return result;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java
new file mode 100644
index 00000000..41942978
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependenciesResolver.java
@@ -0,0 +1,71 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.Plugin;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface
+ * that is only public for technical reasons, it is not part of the public API. In particular, this interface can be
+ * changed or deleted without prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginDependenciesResolver
+{
+
+ /**
+ * Resolves the main artifact of the specified plugin.
+ *
+ * @param plugin The plugin for which to resolve the main artifact, must not be {@code null}.
+ * @param repositories The plugin repositories to use for resolving the plugin's main artifact, must not be {@code
+ * null}.
+ * @param session The repository session to use for resolving the plugin's main artifact, must not be {@code null}.
+ * @return The resolved plugin artifact, never {@code null}.
+ * @throws PluginResolutionException If the plugin artifact could not be resolved.
+ */
+ Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException;
+
+ /**
+ * Resolves the runtime dependencies of the specified plugin.
+ *
+ * @param plugin The plugin for which to resolve the dependencies, must not be {@code null}.
+ * @param pluginArtifact The plugin's main artifact, may be {@code null}.
+ * @param dependencyFilter A filter to exclude artifacts from resolution (but not collection), may be {@code null}.
+ * @param repositories The plugin repositories to use for resolving the plugin artifacts, must not be {@code null}.
+ * @param session The repository session to use for resolving the plugin artifacts, must not be {@code null}.
+ * @return The dependency tree denoting the resolved plugin class path, never {@code null}.
+ * @throws PluginResolutionException If any dependency could not be resolved.
+ */
+ DependencyNode resolve( Plugin plugin, Artifact pluginArtifact, DependencyFilter dependencyFilter,
+ List<RemoteRepository> repositories, RepositorySystemSession session )
+ throws PluginResolutionException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java
new file mode 100644
index 00000000..533920a8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/PluginDependencyResolutionListener.java
@@ -0,0 +1,158 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ResolutionListener;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+/**
+ * Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g.
+ * maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons
+ * for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not
+ * intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the
+ * core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+class PluginDependencyResolutionListener
+ implements ResolutionListener
+{
+
+ private ArtifactFilter coreFilter;
+
+ private LinkedList<Artifact> coreArtifacts = new LinkedList<Artifact>();
+
+ private Artifact wagonProvider;
+
+ private Map<Artifact, Object> bannedArtifacts = new IdentityHashMap<Artifact, Object>();
+
+ public PluginDependencyResolutionListener( ArtifactFilter coreFilter )
+ {
+ this.coreFilter = coreFilter;
+ }
+
+ public void removeBannedDependencies( Collection<Artifact> artifacts )
+ {
+ if ( !bannedArtifacts.isEmpty() && artifacts != null )
+ {
+ for ( Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); )
+ {
+ Artifact artifact = it.next();
+ if ( bannedArtifacts.containsKey( artifact ) )
+ {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public void startProcessChildren( Artifact artifact )
+ {
+ if ( wagonProvider == null )
+ {
+ if ( isLegacyCoreArtifact( artifact ) )
+ {
+ coreArtifacts.addFirst( artifact );
+ }
+ else if ( !coreArtifacts.isEmpty() && isWagonProvider( artifact ) )
+ {
+ wagonProvider = artifact;
+ bannedArtifacts.put( artifact, null );
+ }
+ }
+ }
+
+ private boolean isLegacyCoreArtifact( Artifact artifact )
+ {
+ String version = artifact.getVersion();
+ return version != null && version.startsWith( "2." ) && !coreFilter.include( artifact );
+ }
+
+ public void endProcessChildren( Artifact artifact )
+ {
+ if ( wagonProvider == artifact )
+ {
+ wagonProvider = null;
+ }
+ else if ( coreArtifacts.peek() == artifact )
+ {
+ coreArtifacts.removeFirst();
+ }
+ }
+
+ public void includeArtifact( Artifact artifact )
+ {
+ if ( wagonProvider != null )
+ {
+ bannedArtifacts.put( artifact, null );
+ }
+ }
+
+ private boolean isWagonProvider( Artifact artifact )
+ {
+ if ( "org.apache.maven.wagon".equals( artifact.getGroupId() ) )
+ {
+ return artifact.getArtifactId().startsWith( "wagon-" );
+ }
+ return false;
+ }
+
+ public void manageArtifact( Artifact artifact, Artifact replacement )
+ {
+ }
+
+ public void omitForCycle( Artifact artifact )
+ {
+ }
+
+ public void omitForNearer( Artifact omitted, Artifact kept )
+ {
+ }
+
+ public void restrictRange( Artifact artifact, Artifact replacement, VersionRange newRange )
+ {
+ }
+
+ public void selectVersionFromRange( Artifact artifact )
+ {
+ }
+
+ public void testArtifact( Artifact node )
+ {
+ }
+
+ public void updateScope( Artifact artifact, String scope )
+ {
+ }
+
+ public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
+ {
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java
new file mode 100644
index 00000000..706694b8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/ValidatingConfigurationListener.java
@@ -0,0 +1,97 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.Parameter;
+import org.codehaus.plexus.component.configurator.ConfigurationListener;
+
+/**
+ * A configuration listener to help validate the plugin configuration. For instance, check for required but missing
+ * parameters.
+ *
+ * @author Benjamin Bentmann
+ */
+class ValidatingConfigurationListener
+ implements ConfigurationListener
+{
+
+ private final Object mojo;
+
+ private final ConfigurationListener delegate;
+
+ private final Map<String, Parameter> missingParameters;
+
+ public ValidatingConfigurationListener( Object mojo, MojoDescriptor mojoDescriptor, ConfigurationListener delegate )
+ {
+ this.mojo = mojo;
+ this.delegate = delegate;
+ this.missingParameters = new HashMap<String, Parameter>();
+
+ if ( mojoDescriptor.getParameters() != null )
+ {
+ for ( Parameter param : mojoDescriptor.getParameters() )
+ {
+ if ( param.isRequired() )
+ {
+ missingParameters.put( param.getName(), param );
+ }
+ }
+ }
+ }
+
+ public Collection<Parameter> getMissingParameters()
+ {
+ return missingParameters.values();
+ }
+
+ public void notifyFieldChangeUsingSetter( String fieldName, Object value, Object target )
+ {
+ delegate.notifyFieldChangeUsingSetter( fieldName, value, target );
+
+ if ( mojo == target )
+ {
+ notify( fieldName, value );
+ }
+ }
+
+ public void notifyFieldChangeUsingReflection( String fieldName, Object value, Object target )
+ {
+ delegate.notifyFieldChangeUsingReflection( fieldName, value, target );
+
+ if ( mojo == target )
+ {
+ notify( fieldName, value );
+ }
+ }
+
+ private void notify( String fieldName, Object value )
+ {
+ if ( value != null )
+ {
+ missingParameters.remove( fieldName );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java
new file mode 100644
index 00000000..43e8cfc4
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/internal/WagonExcluder.java
@@ -0,0 +1,109 @@
+package org.apache.maven.plugin.internal;
+
+/*
+ * 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.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.collection.DependencyCollectionContext;
+import org.eclipse.aether.collection.DependencySelector;
+import org.eclipse.aether.graph.Dependency;
+
+/**
+ * Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g.
+ * maven-core:2.0.6) and excluding them. A plugin should be able to explicitly declare dependencies on specific wagons
+ * for its use. However, the (old) wagons pulled in transitively via legacy Maven core artifacts are usually not
+ * intended as dependencies and more importantly screw up artifact resolution because they would get preferred over the
+ * core wagon versions. This is a hack to provide backward-compat with Maven 2 (MNG-4528, MNG-4561).
+ *
+ * @author Benjamin Bentmann
+ */
+class WagonExcluder
+ implements DependencySelector
+{
+
+ private final boolean coreArtifact;
+
+ public WagonExcluder()
+ {
+ this( false );
+ }
+
+ private WagonExcluder( boolean coreArtifact )
+ {
+ this.coreArtifact = coreArtifact;
+ }
+
+ public boolean selectDependency( Dependency dependency )
+ {
+ return !coreArtifact || !isWagonProvider( dependency.getArtifact() );
+ }
+
+ public DependencySelector deriveChildSelector( DependencyCollectionContext context )
+ {
+ if ( coreArtifact || !isLegacyCoreArtifact( context.getDependency().getArtifact() ) )
+ {
+ return this;
+ }
+ else
+ {
+ return new WagonExcluder( true );
+ }
+ }
+
+ private boolean isLegacyCoreArtifact( Artifact artifact )
+ {
+ String version = artifact.getVersion();
+ return version != null && version.startsWith( "2." ) && artifact.getArtifactId().startsWith( "maven-" )
+ && artifact.getGroupId().equals( "org.apache.maven" );
+ }
+
+ private boolean isWagonProvider( Artifact artifact )
+ {
+ if ( "org.apache.maven.wagon".equals( artifact.getGroupId() ) )
+ {
+ return artifact.getArtifactId().startsWith( "wagon-" );
+ }
+ return false;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( obj == this )
+ {
+ return true;
+ }
+ else if ( obj == null || !getClass().equals( obj.getClass() ) )
+ {
+ return false;
+ }
+
+ WagonExcluder that = (WagonExcluder) obj;
+ return coreArtifact == that.coreArtifact;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = getClass().hashCode();
+ hash = hash * 31 + ( coreArtifact ? 1 : 0 );
+ return hash;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/DefaultPluginPrefixRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/DefaultPluginPrefixRequest.java
new file mode 100644
index 00000000..7ab86cfd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/DefaultPluginPrefixRequest.java
@@ -0,0 +1,156 @@
+package org.apache.maven.plugin.prefix;
+
+/*
+ * 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.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Model;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Collects settings required to resolve a plugin prefix.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public class DefaultPluginPrefixRequest
+ implements PluginPrefixRequest
+{
+
+ private String prefix;
+
+ private List<String> pluginGroups = Collections.emptyList();
+
+ private Model pom;
+
+ private List<RemoteRepository> repositories = Collections.emptyList();
+
+ private RepositorySystemSession session;
+
+ /**
+ * Creates an empty request.
+ */
+ public DefaultPluginPrefixRequest()
+ {
+ }
+
+ /**
+ * Creates a request for the specified plugin prefix and build session. The provided build session will be used to
+ * configure repository settings. If the session has a current project, its plugin repositories and model will be
+ * used as well.
+ *
+ * @param prefix The plugin prefix to resolve, must not be {@code null}.
+ * @param session The build session from which to derive further settings, must not be {@code null}.
+ */
+ public DefaultPluginPrefixRequest( String prefix, MavenSession session )
+ {
+ setPrefix( prefix );
+
+ setRepositorySession( session.getRepositorySession() );
+
+ MavenProject project = session.getCurrentProject();
+ if ( project != null )
+ {
+ setRepositories( project.getRemotePluginRepositories() );
+ setPom( project.getModel() );
+ }
+
+ setPluginGroups( session.getPluginGroups() );
+ }
+
+ public String getPrefix()
+ {
+ return prefix;
+ }
+
+ public DefaultPluginPrefixRequest setPrefix( String prefix )
+ {
+ this.prefix = prefix;
+
+ return this;
+ }
+
+ public List<String> getPluginGroups()
+ {
+ return pluginGroups;
+ }
+
+ public DefaultPluginPrefixRequest setPluginGroups( List<String> pluginGroups )
+ {
+ if ( pluginGroups != null )
+ {
+ this.pluginGroups = pluginGroups;
+ }
+ else
+ {
+ this.pluginGroups = Collections.emptyList();
+ }
+
+ return this;
+ }
+
+ public Model getPom()
+ {
+ return pom;
+ }
+
+ public DefaultPluginPrefixRequest setPom( Model pom )
+ {
+ this.pom = pom;
+
+ return this;
+ }
+
+ public List<RemoteRepository> getRepositories()
+ {
+ return repositories;
+ }
+
+ public DefaultPluginPrefixRequest setRepositories( List<RemoteRepository> repositories )
+ {
+ if ( repositories != null )
+ {
+ this.repositories = repositories;
+ }
+ else
+ {
+ this.repositories = Collections.emptyList();
+ }
+
+ return this;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ return session;
+ }
+
+ public DefaultPluginPrefixRequest setRepositorySession( RepositorySystemSession session )
+ {
+ this.session = session;
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/NoPluginFoundForPrefixException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/NoPluginFoundForPrefixException.java
new file mode 100644
index 00000000..32870217
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/NoPluginFoundForPrefixException.java
@@ -0,0 +1,65 @@
+package org.apache.maven.plugin.prefix;
+
+/*
+ * 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.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+
+public class NoPluginFoundForPrefixException
+ extends Exception
+{
+
+ public NoPluginFoundForPrefixException( String prefix, List<String> pluginGroups, LocalRepository localRepository,
+ List<RemoteRepository> remoteRepositories )
+ {
+ super( "No plugin found for prefix '" + prefix + "' in the current project and in the plugin groups "
+ + pluginGroups + " available from the repositories " + format( localRepository, remoteRepositories ) );
+ }
+
+ private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
+ {
+ String repos = "[";
+
+ if ( localRepository != null )
+ {
+ repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
+ }
+
+ if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
+ {
+ for ( RemoteRepository repository : remoteRepositories )
+ {
+ repos += ", ";
+
+ if ( repository != null )
+ {
+ repos += repository.getId() + " (" + repository.getUrl() + ")";
+ }
+ }
+ }
+
+ repos += "]";
+
+ return repos;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixRequest.java
new file mode 100644
index 00000000..23df66ee
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixRequest.java
@@ -0,0 +1,115 @@
+package org.apache.maven.plugin.prefix;
+
+/*
+ * 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.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Collects settings required to resolve a plugin prefix.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginPrefixRequest
+{
+
+ /**
+ * Gets the prefix of the plugin.
+ *
+ * @return The prefix of the plugin.
+ */
+ String getPrefix();
+
+ /**
+ * Sets the prefix of the plugin.
+ *
+ * @param prefix The prefix of the plugin.
+ * @return This request, never {@code null}.
+ */
+ PluginPrefixRequest setPrefix( String prefix );
+
+ /**
+ * Gets the list of group ids to scan for the plugin prefix.
+ *
+ * @return The list of group ids to scan for the plugin prefix, never {@code null}.
+ */
+ List<String> getPluginGroups();
+
+ /**
+ * Sets the list of group ids to scan for the plugin prefix.
+ *
+ * @param pluginGroups The list of group ids to scan for the plugin prefix, may be {@code null}.
+ * @return This request, never {@code null}.
+ */
+ PluginPrefixRequest setPluginGroups( List<String> pluginGroups );
+
+ /**
+ * Gets the POM whose build plugins are to be scanned for the prefix.
+ *
+ * @return The POM whose build plugins are to be scanned for the prefix or {@code null} to only search the plugin
+ * repositories.
+ */
+ Model getPom();
+
+ /**
+ * Sets the POM whose build plugins are to be scanned for the prefix.
+ *
+ * @param pom The POM whose build plugins are to be scanned for the prefix, may be {@code null} to only search the
+ * plugin repositories.
+ * @return This request, never {@code null}.
+ */
+ PluginPrefixRequest setPom( Model pom );
+
+ /**
+ * Gets the remote repositories to use.
+ *
+ * @return The remote repositories to use, never {@code null}.
+ */
+ List<RemoteRepository> getRepositories();
+
+ /**
+ * Sets the remote repositories to use. <em>Note:</em> When creating a request from a project, be sure to use the
+ * plugin repositories and not the regular project repositories.
+ *
+ * @param repositories The remote repositories to use.
+ * @return This request, never {@code null}.
+ */
+ PluginPrefixRequest setRepositories( List<RemoteRepository> repositories );
+
+ /**
+ * Gets the session to use for repository access.
+ *
+ * @return The repository session or {@code null} if not set.
+ */
+ RepositorySystemSession getRepositorySession();
+
+ /**
+ * Sets the session to use for repository access.
+ *
+ * @param repositorySession The repository session to use.
+ * @return This request, never {@code null}.
+ */
+ PluginPrefixRequest setRepositorySession( RepositorySystemSession repositorySession );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResolver.java
new file mode 100644
index 00000000..943e6833
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResolver.java
@@ -0,0 +1,42 @@
+package org.apache.maven.plugin.prefix;
+
+/*
+ * 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.
+ */
+
+/**
+ * Resolves a plugin prefix.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginPrefixResolver
+{
+
+ /**
+ * Resolves the plugin prefix for the specified request.
+ *
+ * @param request The request that holds the details about the plugin and the repositories to consult, must not be
+ * {@code null}.
+ * @return The result of the prefix resolution, never {@code null}.
+ * @throws NoPluginFoundForPrefixException If the plugin prefix could not be resolved.
+ */
+ PluginPrefixResult resolve( PluginPrefixRequest request )
+ throws NoPluginFoundForPrefixException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java
new file mode 100644
index 00000000..8fe1a71a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/PluginPrefixResult.java
@@ -0,0 +1,55 @@
+package org.apache.maven.plugin.prefix;
+
+/*
+ * 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.eclipse.aether.repository.ArtifactRepository;
+
+/**
+ * Describes the result of a plugin prefix resolution request.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginPrefixResult
+{
+
+ /**
+ * The resolved group id for the plugin.
+ *
+ * @return The resolved group id for the plugin, never {@code null}.
+ */
+ String getGroupId();
+
+ /**
+ * The resolved artifact id for the plugin.
+ *
+ * @return The resolved artifact id for the plugin, never {@code null}.
+ */
+ String getArtifactId();
+
+ /**
+ * The repository from which the plugin prefix was resolved.
+ *
+ * @return The repository from which the plugin prefix was resolved or {@code null} if the prefix was resolved from
+ * the supplied POM.
+ */
+ ArtifactRepository getRepository();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java
new file mode 100644
index 00000000..8d2ad0f7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResolver.java
@@ -0,0 +1,294 @@
+package org.apache.maven.plugin.prefix.internal;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.io.MetadataReader;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.BuildPluginManager;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.prefix.PluginPrefixRequest;
+import org.apache.maven.plugin.prefix.PluginPrefixResolver;
+import org.apache.maven.plugin.prefix.PluginPrefixResult;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryListener;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.metadata.DefaultMetadata;
+import org.eclipse.aether.repository.ArtifactRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.resolution.MetadataRequest;
+import org.eclipse.aether.resolution.MetadataResult;
+
+/**
+ * Resolves a plugin prefix.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginPrefixResolver.class )
+public class DefaultPluginPrefixResolver
+ implements PluginPrefixResolver
+{
+
+ private static final String REPOSITORY_CONTEXT = "plugin";
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private BuildPluginManager pluginManager;
+
+ @Requirement
+ private RepositorySystem repositorySystem;
+
+ @Requirement
+ private MetadataReader metadataReader;
+
+ public PluginPrefixResult resolve( PluginPrefixRequest request )
+ throws NoPluginFoundForPrefixException
+ {
+ logger.debug( "Resolving plugin prefix " + request.getPrefix() + " from " + request.getPluginGroups() );
+
+ PluginPrefixResult result = resolveFromProject( request );
+
+ if ( result == null )
+ {
+ result = resolveFromRepository( request );
+
+ if ( result == null )
+ {
+ throw new NoPluginFoundForPrefixException( request.getPrefix(), request.getPluginGroups(),
+ request.getRepositorySession().getLocalRepository(),
+ request.getRepositories() );
+ }
+ else if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Resolved plugin prefix " + request.getPrefix() + " to " + result.getGroupId() + ":"
+ + result.getArtifactId() + " from repository "
+ + ( result.getRepository() != null ? result.getRepository().getId() : "null" ) );
+ }
+ }
+ else if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Resolved plugin prefix " + request.getPrefix() + " to " + result.getGroupId() + ":"
+ + result.getArtifactId() + " from POM " + request.getPom() );
+ }
+
+ return result;
+ }
+
+ private PluginPrefixResult resolveFromProject( PluginPrefixRequest request )
+ {
+ PluginPrefixResult result = null;
+
+ if ( request.getPom() != null && request.getPom().getBuild() != null )
+ {
+ Build build = request.getPom().getBuild();
+
+ result = resolveFromProject( request, build.getPlugins() );
+
+ if ( result == null && build.getPluginManagement() != null )
+ {
+ result = resolveFromProject( request, build.getPluginManagement().getPlugins() );
+ }
+ }
+
+ return result;
+ }
+
+ private PluginPrefixResult resolveFromProject( PluginPrefixRequest request, List<Plugin> plugins )
+ {
+ for ( Plugin plugin : plugins )
+ {
+ try
+ {
+ PluginDescriptor pluginDescriptor =
+ pluginManager.loadPlugin( plugin, request.getRepositories(), request.getRepositorySession() );
+
+ if ( request.getPrefix().equals( pluginDescriptor.getGoalPrefix() ) )
+ {
+ return new DefaultPluginPrefixResult( plugin );
+ }
+ }
+ catch ( Exception e )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.warn( "Failed to retrieve plugin descriptor for " + plugin.getId() + ": " + e.getMessage(),
+ e );
+ }
+ else
+ {
+ logger.warn( "Failed to retrieve plugin descriptor for " + plugin.getId() + ": " + e.getMessage() );
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request )
+ {
+ RequestTrace trace = RequestTrace.newChild( null, request );
+
+ List<MetadataRequest> requests = new ArrayList<MetadataRequest>();
+
+ for ( String pluginGroup : request.getPluginGroups() )
+ {
+ org.eclipse.aether.metadata.Metadata metadata =
+ new DefaultMetadata( pluginGroup, "maven-metadata.xml", DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );
+
+ requests.add( new MetadataRequest( metadata, null, REPOSITORY_CONTEXT ).setTrace( trace ) );
+
+ for ( RemoteRepository repository : request.getRepositories() )
+ {
+ requests.add( new MetadataRequest( metadata, repository, REPOSITORY_CONTEXT ).setTrace( trace ) );
+ }
+ }
+
+ // initial try, use locally cached metadata
+
+ List<MetadataResult> results = repositorySystem.resolveMetadata( request.getRepositorySession(), requests );
+ requests.clear();
+
+ PluginPrefixResult result = processResults( request, trace, results, requests );
+
+ if ( result != null )
+ {
+ return result;
+ }
+
+ // second try, refetch all (possibly outdated) metadata that wasn't updated in the first attempt
+
+ if ( !request.getRepositorySession().isOffline() && !requests.isEmpty() )
+ {
+ DefaultRepositorySystemSession session =
+ new DefaultRepositorySystemSession( request.getRepositorySession() );
+ session.setUpdatePolicy( RepositoryPolicy.UPDATE_POLICY_ALWAYS );
+
+ results = repositorySystem.resolveMetadata( session, requests );
+
+ return processResults( request, trace, results, null );
+ }
+
+ return null;
+ }
+
+ private PluginPrefixResult processResults( PluginPrefixRequest request, RequestTrace trace,
+ List<MetadataResult> results, List<MetadataRequest> requests )
+ {
+ for ( MetadataResult res : results )
+ {
+ org.eclipse.aether.metadata.Metadata metadata = res.getMetadata();
+
+ if ( metadata != null )
+ {
+ ArtifactRepository repository = res.getRequest().getRepository();
+ if ( repository == null )
+ {
+ repository = request.getRepositorySession().getLocalRepository();
+ }
+
+ PluginPrefixResult result =
+ resolveFromRepository( request, trace, metadata.getGroupId(), metadata, repository );
+
+ if ( result != null )
+ {
+ return result;
+ }
+ }
+
+ if ( requests != null && !res.isUpdated() )
+ {
+ requests.add( res.getRequest() );
+ }
+ }
+
+ return null;
+ }
+
+ private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request, RequestTrace trace,
+ String pluginGroup,
+ org.eclipse.aether.metadata.Metadata metadata,
+ ArtifactRepository repository )
+ {
+ if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
+ {
+ try
+ {
+ Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE );
+
+ Metadata pluginGroupMetadata = metadataReader.read( metadata.getFile(), options );
+
+ List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
+
+ if ( plugins != null )
+ {
+ for ( org.apache.maven.artifact.repository.metadata.Plugin plugin : plugins )
+ {
+ if ( request.getPrefix().equals( plugin.getPrefix() ) )
+ {
+ return new DefaultPluginPrefixResult( pluginGroup, plugin.getArtifactId(), repository );
+ }
+ }
+ }
+ }
+ catch ( IOException e )
+ {
+ invalidMetadata( request.getRepositorySession(), trace, metadata, repository, e );
+ }
+ }
+
+ return null;
+ }
+
+ private void invalidMetadata( RepositorySystemSession session, RequestTrace trace,
+ org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository,
+ Exception exception )
+ {
+ RepositoryListener listener = session.getRepositoryListener();
+ if ( listener != null )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
+ event.setTrace( trace );
+ event.setMetadata( metadata );
+ event.setException( exception );
+ event.setRepository( repository );
+ listener.metadataInvalid( event.build() );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResult.java
new file mode 100644
index 00000000..6a248bff
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/prefix/internal/DefaultPluginPrefixResult.java
@@ -0,0 +1,90 @@
+package org.apache.maven.plugin.prefix.internal;
+
+/*
+ * 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.Plugin;
+import org.apache.maven.plugin.prefix.PluginPrefixResult;
+import org.eclipse.aether.repository.ArtifactRepository;
+
+/**
+ * Describes the result of a plugin prefix resolution request.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+class DefaultPluginPrefixResult
+ implements PluginPrefixResult
+{
+
+ private String groupId;
+
+ private String artifactId;
+
+ private ArtifactRepository repository;
+
+ public DefaultPluginPrefixResult()
+ {
+ // does nothing
+ }
+
+ public DefaultPluginPrefixResult( Plugin plugin )
+ {
+ groupId = plugin.getGroupId();
+ artifactId = plugin.getArtifactId();
+ }
+
+ public DefaultPluginPrefixResult( String groupId, String artifactId, ArtifactRepository repository )
+ {
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.repository = repository;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public ArtifactRepository getRepository()
+ {
+ return repository;
+ }
+
+ public void setRepository( ArtifactRepository repository )
+ {
+ this.repository = repository;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionRequest.java
new file mode 100644
index 00000000..9907066b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionRequest.java
@@ -0,0 +1,165 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.List;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Collects settings required to resolve the version for a plugin.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public class DefaultPluginVersionRequest
+ implements PluginVersionRequest
+{
+
+ private String groupId;
+
+ private String artifactId;
+
+ private Model pom;
+
+ private List<RemoteRepository> repositories = Collections.emptyList();
+
+ private RepositorySystemSession session;
+
+ /**
+ * Creates an empty request.
+ */
+ public DefaultPluginVersionRequest()
+ {
+ }
+
+ /**
+ * Creates a request for the specified plugin by copying settings from the specified build session. If the session
+ * has a current project, its plugin repositories will be used as well.
+ *
+ * @param plugin The plugin for which to resolve a version, must not be {@code null}.
+ * @param session The Maven session to use, must not be {@code null}.
+ */
+ public DefaultPluginVersionRequest( Plugin plugin, MavenSession session )
+ {
+ setGroupId( plugin.getGroupId() );
+ setArtifactId( plugin.getArtifactId() );
+
+ setRepositorySession( session.getRepositorySession() );
+
+ MavenProject project = session.getCurrentProject();
+ if ( project != null )
+ {
+ setRepositories( project.getRemotePluginRepositories() );
+ }
+ }
+
+ /**
+ * Creates a request for the specified plugin using the given repository session and plugin repositories.
+ *
+ * @param plugin The plugin for which to resolve a version, must not be {@code null}.
+ * @param session The repository session to use, must not be {@code null}.
+ * @param repositories The plugin repositories to query, may be {@code null}.
+ */
+ public DefaultPluginVersionRequest( Plugin plugin, RepositorySystemSession session,
+ List<RemoteRepository> repositories )
+ {
+ setGroupId( plugin.getGroupId() );
+ setArtifactId( plugin.getArtifactId() );
+
+ setRepositorySession( session );
+
+ setRepositories( repositories );
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public DefaultPluginVersionRequest setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+
+ return this;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public DefaultPluginVersionRequest setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+
+ return this;
+ }
+
+ public Model getPom()
+ {
+ return pom;
+ }
+
+ public DefaultPluginVersionRequest setPom( Model pom )
+ {
+ this.pom = pom;
+
+ return this;
+ }
+
+ public List<RemoteRepository> getRepositories()
+ {
+ return repositories;
+ }
+
+ public DefaultPluginVersionRequest setRepositories( List<RemoteRepository> repositories )
+ {
+ if ( repositories != null )
+ {
+ this.repositories = repositories;
+ }
+ else
+ {
+ this.repositories = Collections.emptyList();
+ }
+
+ return this;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ return session;
+ }
+
+ public DefaultPluginVersionRequest setRepositorySession( RepositorySystemSession session )
+ {
+ this.session = session;
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
new file mode 100644
index 00000000..b5539be0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
@@ -0,0 +1,47 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.
+ */
+
+public class PluginVersionNotFoundException
+ extends Exception
+{
+ private final String groupId;
+
+ private final String artifactId;
+
+ public PluginVersionNotFoundException( String groupId, String artifactId )
+ {
+ super( "The plugin \'" + groupId + ":" + artifactId + "\' does not exist or no valid version could be found" );
+
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionRequest.java
new file mode 100644
index 00000000..b22f9e1d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionRequest.java
@@ -0,0 +1,115 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * Collects settings required to resolve the version for a plugin.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginVersionRequest
+{
+
+ /**
+ * Gets the group id of the plugin.
+ *
+ * @return The group id of the plugin.
+ */
+ String getGroupId();
+
+ /**
+ * Sets the group id of the plugin.
+ *
+ * @param groupId The group id of the plugin.
+ * @return This request, never {@code null}.
+ */
+ PluginVersionRequest setGroupId( String groupId );
+
+ /**
+ * Gets the artifact id of the plugin.
+ *
+ * @return The artifact id of the plugin.
+ */
+ String getArtifactId();
+
+ /**
+ * Sets the artifact id of the plugin.
+ *
+ * @param artifactId The artifact id of the plugin.
+ * @return This request, never {@code null}.
+ */
+ PluginVersionRequest setArtifactId( String artifactId );
+
+ /**
+ * Gets the POM whose build plugins are to be scanned for the version.
+ *
+ * @return The POM whose build plugins are to be scanned for the verion or {@code null} to only search the plugin
+ * repositories.
+ */
+ Model getPom();
+
+ /**
+ * Sets the POM whose build plugins are to be scanned for the version.
+ *
+ * @param pom The POM whose build plugins are to be scanned for the version, may be {@code null} to only search the
+ * plugin repositories.
+ * @return This request, never {@code null}.
+ */
+ PluginVersionRequest setPom( Model pom );
+
+ /**
+ * Gets the remote repositories to use.
+ *
+ * @return The remote repositories to use, never {@code null}.
+ */
+ List<RemoteRepository> getRepositories();
+
+ /**
+ * Sets the remote repositories to use. <em>Note:</em> When creating a request from a project, be sure to use the
+ * plugin repositories and not the regular project repositories.
+ *
+ * @param repositories The remote repositories to use.
+ * @return This request, never {@code null}.
+ */
+ PluginVersionRequest setRepositories( List<RemoteRepository> repositories );
+
+ /**
+ * Gets the session to use for repository access.
+ *
+ * @return The repository session or {@code null} if not set.
+ */
+ RepositorySystemSession getRepositorySession();
+
+ /**
+ * Sets the session to use for repository access.
+ *
+ * @param repositorySession The repository session to use.
+ * @return This request, never {@code null}.
+ */
+ PluginVersionRequest setRepositorySession( RepositorySystemSession repositorySession );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java
new file mode 100644
index 00000000..84ec0967
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java
@@ -0,0 +1,107 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.eclipse.aether.repository.LocalRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+
+public class PluginVersionResolutionException
+ extends Exception
+{
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String baseMessage;
+
+ public PluginVersionResolutionException( String groupId, String artifactId, String baseMessage, Throwable cause )
+ {
+ super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\': " + baseMessage, cause );
+
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.baseMessage = baseMessage;
+ }
+
+ public PluginVersionResolutionException( String groupId, String artifactId, String baseMessage )
+ {
+ super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\': " + baseMessage );
+
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.baseMessage = baseMessage;
+ }
+
+ public PluginVersionResolutionException( String groupId, String artifactId, LocalRepository localRepository,
+ List<RemoteRepository> remoteRepositories, String baseMessage )
+ {
+ super( "Error resolving version for plugin \'" + groupId + ":" + artifactId + "\' from the repositories "
+ + format( localRepository, remoteRepositories ) + ": " + baseMessage );
+
+ this.groupId = groupId;
+ this.artifactId = artifactId;
+ this.baseMessage = baseMessage;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public String getBaseMessage()
+ {
+ return baseMessage;
+ }
+
+ private static String format( LocalRepository localRepository, List<RemoteRepository> remoteRepositories )
+ {
+ String repos = "[";
+
+ if ( localRepository != null )
+ {
+ repos += localRepository.getId() + " (" + localRepository.getBasedir() + ")";
+ }
+
+ if ( remoteRepositories != null && !remoteRepositories.isEmpty() )
+ {
+ for ( RemoteRepository repository : remoteRepositories )
+ {
+ repos += ", ";
+
+ if ( repository != null )
+ {
+ repos += repository.getId() + " (" + repository.getUrl() + ")";
+ }
+ }
+ }
+
+ repos += "]";
+
+ return repos;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolver.java
new file mode 100644
index 00000000..935fdfc5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolver.java
@@ -0,0 +1,42 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.
+ */
+
+/**
+ * Resolves a version for a plugin.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginVersionResolver
+{
+
+ /**
+ * Resolves the version for the specified request.
+ *
+ * @param request The request that holds the details about the plugin and the repositories to consult, must not be
+ * {@code null}.
+ * @return The result of the version resolution, never {@code null}.
+ * @throws PluginVersionResolutionException If the plugin version could not be resolved.
+ */
+ PluginVersionResult resolve( PluginVersionRequest request )
+ throws PluginVersionResolutionException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResult.java
new file mode 100644
index 00000000..09a69e96
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResult.java
@@ -0,0 +1,47 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * 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.eclipse.aether.repository.ArtifactRepository;
+
+/**
+ * Describes the result of a plugin version resolution request.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public interface PluginVersionResult
+{
+
+ /**
+ * The resolved plugin version.
+ *
+ * @return The resolved plugin version, never {@code null}.
+ */
+ String getVersion();
+
+ /**
+ * The repository from which the plugin version was resolved.
+ *
+ * @return The repository from which the plugin version was resolved, never {@code null}.
+ */
+ ArtifactRepository getRepository();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
new file mode 100644
index 00000000..76b6bfd6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResolver.java
@@ -0,0 +1,408 @@
+package org.apache.maven.plugin.version.internal;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.Versioning;
+import org.apache.maven.artifact.repository.metadata.io.MetadataReader;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MavenPluginManager;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.version.PluginVersionRequest;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolver;
+import org.apache.maven.plugin.version.PluginVersionResult;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.RepositoryEvent.EventType;
+import org.eclipse.aether.RepositoryEvent;
+import org.eclipse.aether.RepositoryListener;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.metadata.DefaultMetadata;
+import org.eclipse.aether.repository.ArtifactRepository;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.MetadataRequest;
+import org.eclipse.aether.resolution.MetadataResult;
+import org.eclipse.aether.util.version.GenericVersionScheme;
+import org.eclipse.aether.version.InvalidVersionSpecificationException;
+import org.eclipse.aether.version.Version;
+import org.eclipse.aether.version.VersionScheme;
+
+/**
+ * Resolves a version for a plugin.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginVersionResolver.class )
+public class DefaultPluginVersionResolver
+ implements PluginVersionResolver
+{
+
+ private static final String REPOSITORY_CONTEXT = "plugin";
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private RepositorySystem repositorySystem;
+
+ @Requirement
+ private MetadataReader metadataReader;
+
+ @Requirement
+ private MavenPluginManager pluginManager;
+
+ public PluginVersionResult resolve( PluginVersionRequest request )
+ throws PluginVersionResolutionException
+ {
+ logger.debug( "Resolving plugin version for " + request.getGroupId() + ":" + request.getArtifactId() );
+
+ PluginVersionResult result = resolveFromProject( request );
+
+ if ( result == null )
+ {
+ result = resolveFromRepository( request );
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Resolved plugin version for " + request.getGroupId() + ":" + request.getArtifactId()
+ + " to " + result.getVersion() + " from repository " + result.getRepository() );
+ }
+ }
+ else if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Resolved plugin version for " + request.getGroupId() + ":" + request.getArtifactId()
+ + " to " + result.getVersion() + " from POM " + request.getPom() );
+ }
+
+ return result;
+ }
+
+ private PluginVersionResult resolveFromRepository( PluginVersionRequest request )
+ throws PluginVersionResolutionException
+ {
+ RequestTrace trace = RequestTrace.newChild( null, request );
+
+ DefaultPluginVersionResult result = new DefaultPluginVersionResult();
+
+ org.eclipse.aether.metadata.Metadata metadata =
+ new DefaultMetadata( request.getGroupId(), request.getArtifactId(), "maven-metadata.xml",
+ DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );
+
+ List<MetadataRequest> requests = new ArrayList<MetadataRequest>();
+
+ requests.add( new MetadataRequest( metadata, null, REPOSITORY_CONTEXT ).setTrace( trace ) );
+
+ for ( RemoteRepository repository : request.getRepositories() )
+ {
+ requests.add( new MetadataRequest( metadata, repository, REPOSITORY_CONTEXT ).setTrace( trace ) );
+ }
+
+ List<MetadataResult> results = repositorySystem.resolveMetadata( request.getRepositorySession(), requests );
+
+ Versions versions = new Versions();
+
+ for ( MetadataResult res : results )
+ {
+ ArtifactRepository repository = res.getRequest().getRepository();
+ if ( repository == null )
+ {
+ repository = request.getRepositorySession().getLocalRepository();
+ }
+
+ mergeMetadata( request.getRepositorySession(), trace, versions, res.getMetadata(), repository );
+ }
+
+ selectVersion( result, request, versions );
+
+ return result;
+ }
+
+ private void selectVersion( DefaultPluginVersionResult result, PluginVersionRequest request, Versions versions )
+ throws PluginVersionResolutionException
+ {
+ String version = null;
+ ArtifactRepository repo = null;
+
+ if ( StringUtils.isNotEmpty( versions.releaseVersion ) )
+ {
+ version = versions.releaseVersion;
+ repo = versions.releaseRepository;
+ }
+ else if ( StringUtils.isNotEmpty( versions.latestVersion ) )
+ {
+ version = versions.latestVersion;
+ repo = versions.latestRepository;
+ }
+ if ( version != null && !isCompatible( request, version ) )
+ {
+ versions.versions.remove( version );
+ version = null;
+ }
+
+ if ( version == null )
+ {
+ VersionScheme versionScheme = new GenericVersionScheme();
+
+ TreeSet<Version> releases = new TreeSet<Version>( Collections.reverseOrder() );
+ TreeSet<Version> snapshots = new TreeSet<Version>( Collections.reverseOrder() );
+
+ for ( String ver : versions.versions.keySet() )
+ {
+ try
+ {
+ Version v = versionScheme.parseVersion( ver );
+
+ if ( ver.endsWith( "-SNAPSHOT" ) )
+ {
+ snapshots.add( v );
+ }
+ else
+ {
+ releases.add( v );
+ }
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ // ignore
+ }
+ }
+
+ for ( Version v : releases )
+ {
+ String ver = v.toString();
+ if ( isCompatible( request, ver ) )
+ {
+ version = ver;
+ repo = versions.versions.get( version );
+ break;
+ }
+ }
+
+ if ( version == null )
+ {
+ for ( Version v : snapshots )
+ {
+ String ver = v.toString();
+ if ( isCompatible( request, ver ) )
+ {
+ version = ver;
+ repo = versions.versions.get( version );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( version != null )
+ {
+ result.setVersion( version );
+ result.setRepository( repo );
+ }
+ else
+ {
+ throw new PluginVersionResolutionException( request.getGroupId(), request.getArtifactId(),
+ request.getRepositorySession().getLocalRepository(),
+ request.getRepositories(),
+ "Plugin not found in any plugin repository" );
+ }
+ }
+
+ private boolean isCompatible( PluginVersionRequest request, String version )
+ {
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( request.getGroupId() );
+ plugin.setArtifactId( request.getArtifactId() );
+ plugin.setVersion( version );
+
+ PluginDescriptor pluginDescriptor;
+
+ try
+ {
+ pluginDescriptor =
+ pluginManager.getPluginDescriptor( plugin, request.getRepositories(), request.getRepositorySession() );
+ }
+ catch ( PluginResolutionException e )
+ {
+ logger.debug( "Ignoring unresolvable plugin version " + version, e );
+ return false;
+ }
+ catch ( Exception e )
+ {
+ // ignore for now and delay failure to higher level processing
+ return true;
+ }
+
+ try
+ {
+ pluginManager.checkRequiredMavenVersion( pluginDescriptor );
+ }
+ catch ( Exception e )
+ {
+ logger.debug( "Ignoring incompatible plugin version " + version + ": " + e.getMessage() );
+ return false;
+ }
+
+ return true;
+ }
+
+ private void mergeMetadata( RepositorySystemSession session, RequestTrace trace, Versions versions,
+ org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository )
+ {
+ if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
+ {
+ try
+ {
+ Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE );
+
+ Metadata repoMetadata = metadataReader.read( metadata.getFile(), options );
+
+ mergeMetadata( versions, repoMetadata, repository );
+ }
+ catch ( IOException e )
+ {
+ invalidMetadata( session, trace, metadata, repository, e );
+ }
+ }
+ }
+
+ private void invalidMetadata( RepositorySystemSession session, RequestTrace trace,
+ org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository,
+ Exception exception )
+ {
+ RepositoryListener listener = session.getRepositoryListener();
+ if ( listener != null )
+ {
+ RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
+ event.setTrace( trace );
+ event.setMetadata( metadata );
+ event.setException( exception );
+ event.setRepository( repository );
+ listener.metadataInvalid( event.build() );
+ }
+ }
+
+ private void mergeMetadata( Versions versions, Metadata source, ArtifactRepository repository )
+ {
+ Versioning versioning = source.getVersioning();
+ if ( versioning != null )
+ {
+ String timestamp = StringUtils.clean( versioning.getLastUpdated() );
+
+ if ( StringUtils.isNotEmpty( versioning.getRelease() )
+ && timestamp.compareTo( versions.releaseTimestamp ) > 0 )
+ {
+ versions.releaseVersion = versioning.getRelease();
+ versions.releaseTimestamp = timestamp;
+ versions.releaseRepository = repository;
+ }
+
+ if ( StringUtils.isNotEmpty( versioning.getLatest() )
+ && timestamp.compareTo( versions.latestTimestamp ) > 0 )
+ {
+ versions.latestVersion = versioning.getLatest();
+ versions.latestTimestamp = timestamp;
+ versions.latestRepository = repository;
+ }
+
+ for ( String version : versioning.getVersions() )
+ {
+ if ( !versions.versions.containsKey( version ) )
+ {
+ versions.versions.put( version, repository );
+ }
+ }
+ }
+ }
+
+ private PluginVersionResult resolveFromProject( PluginVersionRequest request )
+ {
+ PluginVersionResult result = null;
+
+ if ( request.getPom() != null && request.getPom().getBuild() != null )
+ {
+ Build build = request.getPom().getBuild();
+
+ result = resolveFromProject( request, build.getPlugins() );
+
+ if ( result == null && build.getPluginManagement() != null )
+ {
+ result = resolveFromProject( request, build.getPluginManagement().getPlugins() );
+ }
+ }
+
+ return result;
+ }
+
+ private PluginVersionResult resolveFromProject( PluginVersionRequest request, List<Plugin> plugins )
+ {
+ for ( Plugin plugin : plugins )
+ {
+ if ( request.getGroupId().equals( plugin.getGroupId() )
+ && request.getArtifactId().equals( plugin.getArtifactId() ) )
+ {
+ if ( plugin.getVersion() != null )
+ {
+ return new DefaultPluginVersionResult( plugin.getVersion() );
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
+ static class Versions
+ {
+
+ String releaseVersion = "";
+
+ String releaseTimestamp = "";
+
+ ArtifactRepository releaseRepository;
+
+ String latestVersion = "";
+
+ String latestTimestamp = "";
+
+ ArtifactRepository latestRepository;
+
+ Map<String, ArtifactRepository> versions = new LinkedHashMap<String, ArtifactRepository>();
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResult.java
new file mode 100644
index 00000000..9027a532
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/plugin/version/internal/DefaultPluginVersionResult.java
@@ -0,0 +1,69 @@
+package org.apache.maven.plugin.version.internal;
+
+/*
+ * 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.plugin.version.PluginVersionResult;
+import org.eclipse.aether.repository.ArtifactRepository;
+
+/**
+ * Describes the result of a plugin version resolution request.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+class DefaultPluginVersionResult
+ implements PluginVersionResult
+{
+
+ private String version;
+
+ private ArtifactRepository repository;
+
+ public DefaultPluginVersionResult()
+ {
+ // does nothing
+ }
+
+ public DefaultPluginVersionResult( String version )
+ {
+ this.version = version;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public ArtifactRepository getRepository()
+ {
+ return repository;
+ }
+
+ public void setRepository( ArtifactRepository repository )
+ {
+ this.repository = repository;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java
new file mode 100644
index 00000000..cf5b0d70
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionRequest.java
@@ -0,0 +1,82 @@
+package org.apache.maven.project;
+
+/*
+ * 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.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class DefaultDependencyResolutionRequest
+ implements DependencyResolutionRequest
+{
+
+ private MavenProject project;
+
+ private DependencyFilter filter;
+
+ private RepositorySystemSession session;
+
+ public DefaultDependencyResolutionRequest()
+ {
+ // enables default constructor
+ }
+
+ public DefaultDependencyResolutionRequest( MavenProject project, RepositorySystemSession session )
+ {
+ setMavenProject( project );
+ setRepositorySession( session );
+ }
+
+ public DependencyFilter getResolutionFilter()
+ {
+ return filter;
+ }
+
+ public MavenProject getMavenProject()
+ {
+ return project;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ return session;
+ }
+
+ public DependencyResolutionRequest setResolutionFilter( DependencyFilter filter )
+ {
+ this.filter = filter;
+ return this;
+ }
+
+ public DependencyResolutionRequest setMavenProject( MavenProject project )
+ {
+ this.project = project;
+ return this;
+ }
+
+ public DependencyResolutionRequest setRepositorySession( RepositorySystemSession repositorySession )
+ {
+ this.session = repositorySession;
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java
new file mode 100644
index 00000000..07c6a2f9
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultDependencyResolutionResult.java
@@ -0,0 +1,111 @@
+package org.apache.maven.project;
+
+/*
+ * 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.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+
+/**
+ * @author Benjamin Bentmann
+ */
+class DefaultDependencyResolutionResult
+ implements DependencyResolutionResult
+{
+
+ private DependencyNode root;
+
+ private List<Dependency> dependencies = new ArrayList<Dependency>();
+
+ private List<Dependency> resolvedDependencies = new ArrayList<Dependency>();
+
+ private List<Dependency> unresolvedDependencies = new ArrayList<Dependency>();
+
+ private List<Exception> collectionErrors = new ArrayList<Exception>();
+
+ private Map<Dependency, List<Exception>> resolutionErrors = new IdentityHashMap<Dependency, List<Exception>>();
+
+ public DependencyNode getDependencyGraph()
+ {
+ return root;
+ }
+
+ public void setDependencyGraph( DependencyNode root )
+ {
+ this.root = root;
+ }
+
+ public List<Dependency> getDependencies()
+ {
+ return dependencies;
+ }
+
+ public List<Dependency> getResolvedDependencies()
+ {
+ return resolvedDependencies;
+ }
+
+ public void addResolvedDependency( Dependency dependency )
+ {
+ dependencies.add( dependency );
+ resolvedDependencies.add( dependency );
+ }
+
+ public List<Dependency> getUnresolvedDependencies()
+ {
+ return unresolvedDependencies;
+ }
+
+ public List<Exception> getCollectionErrors()
+ {
+ return collectionErrors;
+ }
+
+ public void setCollectionErrors( List<Exception> exceptions )
+ {
+ if ( exceptions != null )
+ {
+ this.collectionErrors = exceptions;
+ }
+ else
+ {
+ this.collectionErrors = new ArrayList<Exception>();
+ }
+ }
+
+ public List<Exception> getResolutionErrors( Dependency dependency )
+ {
+ List<Exception> errors = resolutionErrors.get( dependency );
+ return ( errors != null ) ? errors : Collections.<Exception>emptyList();
+ }
+
+ public void setResolutionErrors( Dependency dependency, List<Exception> errors )
+ {
+ dependencies.add( dependency );
+ unresolvedDependencies.add( dependency );
+ resolutionErrors.put( dependency, errors );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java
new file mode 100644
index 00000000..2cce9f6a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java
@@ -0,0 +1,128 @@
+package org.apache.maven.project;
+
+/*
+ * 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 org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.model.Resource;
+import org.apache.maven.project.artifact.AttachedArtifact;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+@SuppressWarnings( "deprecation" )
+@Component( role = MavenProjectHelper.class )
+public class DefaultMavenProjectHelper
+ extends AbstractLogEnabled
+ implements MavenProjectHelper
+{
+ @Requirement
+ private ArtifactHandlerManager artifactHandlerManager;
+
+ public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
+ File artifactFile )
+ {
+ String type = artifactType;
+
+ ArtifactHandler handler = null;
+
+ if ( type != null )
+ {
+ handler = artifactHandlerManager.getArtifactHandler( artifactType );
+ }
+
+ if ( handler == null )
+ {
+ handler = artifactHandlerManager.getArtifactHandler( "jar" );
+ }
+
+ Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );
+
+ artifact.setFile( artifactFile );
+ artifact.setResolved( true );
+
+ attachArtifact( project, artifact );
+ }
+
+ public void attachArtifact( MavenProject project, String artifactType, File artifactFile )
+ {
+ ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType );
+
+ Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler );
+
+ artifact.setFile( artifactFile );
+ artifact.setResolved( true );
+
+ attachArtifact( project, artifact );
+ }
+
+ public void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier )
+ {
+ Artifact projectArtifact = project.getArtifact();
+
+ Artifact artifact =
+ new AttachedArtifact( projectArtifact, projectArtifact.getType(), artifactClassifier,
+ projectArtifact.getArtifactHandler() );
+
+ artifact.setFile( artifactFile );
+ artifact.setResolved( true );
+
+ attachArtifact( project, artifact );
+ }
+
+ /**
+ * Add an attached artifact or replace the file for an existing artifact.
+ *
+ * @see MavenProject#addAttachedArtifact(org.apache.maven.artifact.Artifact)
+ * @param project project reference.
+ * @param artifact artifact to add or replace.
+ */
+ public void attachArtifact( MavenProject project, Artifact artifact )
+ {
+ project.addAttachedArtifact( artifact );
+ }
+
+ public void addResource( MavenProject project, String resourceDirectory, List<String> includes,
+ List<String> excludes )
+ {
+ Resource resource = new Resource();
+ resource.setDirectory( resourceDirectory );
+ resource.setIncludes( includes );
+ resource.setExcludes( excludes );
+
+ project.addResource( resource );
+ }
+
+ public void addTestResource( MavenProject project, String resourceDirectory, List<String> includes,
+ List<String> excludes )
+ {
+ Resource resource = new Resource();
+ resource.setDirectory( resourceDirectory );
+ resource.setIncludes( includes );
+ resource.setExcludes( excludes );
+
+ project.addTestResource( resource );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
new file mode 100644
index 00000000..a5365621
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
@@ -0,0 +1,155 @@
+package org.apache.maven.project;
+
+/*
+ * 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.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.AbstractModelBuildingListener;
+import org.apache.maven.model.building.ModelBuildingEvent;
+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.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+
+/**
+ * Processes events from the model builder while building the effective model for a {@link MavenProject} instance.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultModelBuildingListener
+ extends AbstractModelBuildingListener
+{
+
+ private MavenProject project;
+
+ private ProjectBuildingHelper projectBuildingHelper;
+
+ private ProjectBuildingRequest projectBuildingRequest;
+
+ private List<ArtifactRepository> remoteRepositories;
+
+ private List<ArtifactRepository> pluginRepositories;
+
+ public DefaultModelBuildingListener( MavenProject project, ProjectBuildingHelper projectBuildingHelper,
+ ProjectBuildingRequest projectBuildingRequest )
+ {
+ if ( project == null )
+ {
+ throw new IllegalArgumentException( "project missing" );
+ }
+ this.project = project;
+
+ if ( projectBuildingHelper == null )
+ {
+ throw new IllegalArgumentException( "project building helper missing" );
+ }
+ this.projectBuildingHelper = projectBuildingHelper;
+
+ if ( projectBuildingRequest == null )
+ {
+ throw new IllegalArgumentException( "project building request missing" );
+ }
+ this.projectBuildingRequest = projectBuildingRequest;
+ this.remoteRepositories = projectBuildingRequest.getRemoteRepositories();
+ this.pluginRepositories = projectBuildingRequest.getPluginArtifactRepositories();
+ }
+
+ /**
+ * Gets the project whose model is being built.
+ *
+ * @return The project, never {@code null}.
+ */
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ @Override
+ public void buildExtensionsAssembled( ModelBuildingEvent event )
+ {
+ Model model = event.getModel();
+
+ try
+ {
+ pluginRepositories =
+ projectBuildingHelper.createArtifactRepositories( model.getPluginRepositories(), pluginRepositories,
+ projectBuildingRequest );
+ }
+ catch ( Exception e )
+ {
+ event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Invalid plugin repository: " + e.getMessage() )
+ .setException( e ) );
+ }
+ project.setPluginArtifactRepositories( pluginRepositories );
+
+ if ( event.getRequest().isProcessPlugins() )
+ {
+ try
+ {
+ ProjectRealmCache.CacheRecord record =
+ projectBuildingHelper.createProjectRealm( project, model, projectBuildingRequest );
+
+ project.setClassRealm( record.realm );
+ project.setExtensionDependencyFilter( record.extensionArtifactFilter );
+ }
+ catch ( PluginResolutionException e )
+ {
+ event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Unresolveable build extension: " + e.getMessage() )
+ .setException( e ) );
+ }
+ catch ( PluginVersionResolutionException e )
+ {
+ event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Unresolveable build extension: " + e.getMessage() )
+ .setException( e ) );
+ }
+ catch ( PluginManagerException e )
+ {
+ event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Unresolveable build extension: " + e.getMessage() )
+ .setException( e ) );
+ }
+
+ projectBuildingHelper.selectProjectRealm( project );
+ }
+
+ // build the regular repos after extensions are loaded to allow for custom layouts
+ try
+ {
+ remoteRepositories =
+ projectBuildingHelper.createArtifactRepositories( model.getRepositories(), remoteRepositories,
+ projectBuildingRequest );
+ }
+ catch ( Exception e )
+ {
+ event.getProblems().add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
+ .setMessage( "Invalid artifact repository: " + e.getMessage() )
+ .setException( e ) );
+ }
+ project.setRemoteArtifactRepositories( remoteRepositories );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
new file mode 100644
index 00000000..99edc802
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
@@ -0,0 +1,929 @@
+package org.apache.maven.project;
+
+/*
+ * 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.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager;
+import org.apache.maven.bridge.MavenRepositorySystem;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.building.DefaultModelBuildingRequest;
+import org.apache.maven.model.building.DefaultModelProblem;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelBuilder;
+import org.apache.maven.model.building.ModelBuildingException;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelBuildingResult;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.model.building.ModelSource;
+import org.apache.maven.model.building.StringModelSource;
+import org.apache.maven.model.resolution.ModelResolver;
+import org.apache.maven.repository.internal.ArtifactDescriptorUtils;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.Os;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.repository.LocalRepositoryManager;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.repository.WorkspaceRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResolutionException;
+import org.eclipse.aether.resolution.VersionRangeResult;
+
+/**
+ */
+@Component( role = ProjectBuilder.class )
+public class DefaultProjectBuilder
+ implements ProjectBuilder
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private ModelBuilder modelBuilder;
+
+ @Requirement
+ private ModelProcessor modelProcessor;
+
+ @Requirement
+ private ProjectBuildingHelper projectBuildingHelper;
+
+ @Requirement
+ private MavenRepositorySystem repositorySystem;
+
+ @Requirement
+ private org.eclipse.aether.RepositorySystem repoSystem;
+
+ @Requirement
+ private RemoteRepositoryManager repositoryManager;
+
+ @Requirement
+ private ProjectDependenciesResolver dependencyResolver;
+
+ // ----------------------------------------------------------------------
+ // MavenProjectBuilder Implementation
+ // ----------------------------------------------------------------------
+
+ @Override
+ public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest request )
+ throws ProjectBuildingException
+ {
+ return build( pomFile, new FileModelSource( pomFile ), new InternalConfig( request, null ) );
+ }
+
+ @Override
+ public ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request )
+ throws ProjectBuildingException
+ {
+ return build( null, modelSource, new InternalConfig( request, null ) );
+ }
+
+ private ProjectBuildingResult build( File pomFile, ModelSource modelSource, InternalConfig config )
+ throws ProjectBuildingException
+ {
+ ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ ProjectBuildingRequest projectBuildingRequest = config.request;
+
+ MavenProject project = projectBuildingRequest.getProject();
+
+ List<ModelProblem> modelProblems = null;
+ Throwable error = null;
+
+ if ( project == null )
+ {
+ ModelBuildingRequest request = getModelBuildingRequest( config );
+
+ project = new MavenProject();
+ project.setFile( pomFile );
+
+ DefaultModelBuildingListener listener =
+ new DefaultModelBuildingListener( project, projectBuildingHelper, projectBuildingRequest );
+ request.setModelBuildingListener( listener );
+
+ request.setPomFile( pomFile );
+ request.setModelSource( modelSource );
+ request.setLocationTracking( true );
+
+ ModelBuildingResult result;
+ try
+ {
+ result = modelBuilder.build( request );
+ }
+ catch ( ModelBuildingException e )
+ {
+ result = e.getResult();
+ if ( result == null || result.getEffectiveModel() == null )
+ {
+ throw new ProjectBuildingException( e.getModelId(), e.getMessage(), pomFile, e );
+ }
+ // validation error, continue project building and delay failing to help IDEs
+ error = e;
+ }
+
+ modelProblems = result.getProblems();
+
+ initProject( project, Collections.<String, MavenProject>emptyMap(), result,
+ new HashMap<File, Boolean>(), projectBuildingRequest );
+ }
+ else if ( projectBuildingRequest.isResolveDependencies() )
+ {
+ projectBuildingHelper.selectProjectRealm( project );
+ }
+
+ DependencyResolutionResult resolutionResult = null;
+
+ if ( projectBuildingRequest.isResolveDependencies() )
+ {
+ resolutionResult = resolveDependencies( project, config.session );
+ }
+
+ ProjectBuildingResult result = new DefaultProjectBuildingResult( project, modelProblems, resolutionResult );
+
+ if ( error != null )
+ {
+ ProjectBuildingException e = new ProjectBuildingException( Arrays.asList( result ) );
+ e.initCause( error );
+ throw e;
+ }
+
+ return result;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( oldContextClassLoader );
+ }
+ }
+
+ private DependencyResolutionResult resolveDependencies( MavenProject project, RepositorySystemSession session )
+ {
+ DependencyResolutionResult resolutionResult;
+
+ try
+ {
+ DefaultDependencyResolutionRequest resolution = new DefaultDependencyResolutionRequest( project, session );
+ resolutionResult = dependencyResolver.resolve( resolution );
+ }
+ catch ( DependencyResolutionException e )
+ {
+ resolutionResult = e.getResult();
+ }
+
+ Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
+ if ( resolutionResult.getDependencyGraph() != null )
+ {
+ RepositoryUtils.toArtifacts( artifacts, resolutionResult.getDependencyGraph().getChildren(),
+ Collections.singletonList( project.getArtifact().getId() ), null );
+
+ // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not
+ LocalRepositoryManager lrm = session.getLocalRepositoryManager();
+ for ( Artifact artifact : artifacts )
+ {
+ if ( !artifact.isResolved() )
+ {
+ String path = lrm.getPathForLocalArtifact( RepositoryUtils.toArtifact( artifact ) );
+ artifact.setFile( new File( lrm.getRepository().getBasedir(), path ) );
+ }
+ }
+ }
+ project.setResolvedArtifacts( artifacts );
+ project.setArtifacts( artifacts );
+
+ return resolutionResult;
+ }
+
+ private List<String> getProfileIds( List<Profile> profiles )
+ {
+ List<String> ids = new ArrayList<String>( profiles.size() );
+
+ for ( Profile profile : profiles )
+ {
+ ids.add( profile.getId() );
+ }
+
+ return ids;
+ }
+
+ private ModelBuildingRequest getModelBuildingRequest( InternalConfig config )
+ {
+ ProjectBuildingRequest configuration = config.request;
+
+ ModelBuildingRequest request = new DefaultModelBuildingRequest();
+
+ RequestTrace trace = RequestTrace.newChild( null, configuration ).newChild( request );
+
+ ModelResolver resolver =
+ new ProjectModelResolver( config.session, trace, repoSystem, repositoryManager, config.repositories,
+ configuration.getRepositoryMerging(), config.modelPool );
+
+ request.setValidationLevel( configuration.getValidationLevel() );
+ request.setProcessPlugins( configuration.isProcessPlugins() );
+ request.setProfiles( configuration.getProfiles() );
+ request.setActiveProfileIds( configuration.getActiveProfileIds() );
+ request.setInactiveProfileIds( configuration.getInactiveProfileIds() );
+ request.setSystemProperties( configuration.getSystemProperties() );
+ request.setUserProperties( configuration.getUserProperties() );
+ request.setBuildStartTime( configuration.getBuildStartTime() );
+ request.setModelResolver( resolver );
+ request.setModelCache( new ReactorModelCache() );
+
+ return request;
+ }
+
+ @Override
+ public ProjectBuildingResult build( Artifact artifact, ProjectBuildingRequest request )
+ throws ProjectBuildingException
+ {
+ return build( artifact, false, request );
+ }
+
+ @Override
+ public ProjectBuildingResult build( Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request )
+ throws ProjectBuildingException
+ {
+ org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact );
+ pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact );
+
+ InternalConfig config = new InternalConfig( request, null );
+
+ boolean localProject;
+
+ if ( request.isResolveVersionRanges() )
+ {
+ VersionRangeRequest versionRangeRequest = new VersionRangeRequest( pomArtifact, config.repositories, null );
+
+ try
+ {
+ VersionRangeResult versionRangeResult =
+ repoSystem.resolveVersionRange( config.session, versionRangeRequest );
+
+ if ( versionRangeResult.getHighestVersion() == null )
+ {
+ throw new ProjectBuildingException(
+ artifact.getId(), "Error resolving project artifact: No versions matched the requested range",
+ (Throwable) null );
+
+ }
+
+ if ( versionRangeResult.getVersionConstraint() != null
+ && versionRangeResult.getVersionConstraint().getRange() != null
+ && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null )
+ {
+ throw new ProjectBuildingException(
+ artifact.getId(),
+ "Error resolving project artifact: The requested version range does not specify an upper bound",
+ (Throwable) null );
+
+ }
+
+ pomArtifact = pomArtifact.setVersion( versionRangeResult.getHighestVersion().toString() );
+ }
+ catch ( VersionRangeResolutionException e )
+ {
+ throw new ProjectBuildingException(
+ artifact.getId(), "Error resolving project artifact: " + e.getMessage(), e );
+
+ }
+ }
+
+ try
+ {
+ ArtifactRequest pomRequest = new ArtifactRequest();
+ pomRequest.setArtifact( pomArtifact );
+ pomRequest.setRepositories( config.repositories );
+ ArtifactResult pomResult = repoSystem.resolveArtifact( config.session, pomRequest );
+
+ pomArtifact = pomResult.getArtifact();
+ localProject = pomResult.getRepository() instanceof WorkspaceRepository;
+ }
+ catch ( org.eclipse.aether.resolution.ArtifactResolutionException e )
+ {
+ if ( e.getResults().get( 0 ).isMissing() && allowStubModel )
+ {
+ return build( null, createStubModelSource( artifact ), config );
+ }
+ throw new ProjectBuildingException( artifact.getId(),
+ "Error resolving project artifact: " + e.getMessage(), e );
+ }
+
+ File pomFile = pomArtifact.getFile();
+
+ if ( "pom".equals( artifact.getType() ) )
+ {
+ artifact.selectVersion( pomArtifact.getVersion() );
+ artifact.setFile( pomFile );
+ artifact.setResolved( true );
+ }
+
+ return build( localProject ? pomFile : null, new FileModelSource( pomFile ), config );
+ }
+
+ private ModelSource createStubModelSource( Artifact artifact )
+ {
+ StringBuilder buffer = new StringBuilder( 1024 );
+
+ buffer.append( "<?xml version='1.0'?>" );
+ buffer.append( "<project>" );
+ buffer.append( "<modelVersion>4.0.0</modelVersion>" );
+ buffer.append( "<groupId>" ).append( artifact.getGroupId() ).append( "</groupId>" );
+ buffer.append( "<artifactId>" ).append( artifact.getArtifactId() ).append( "</artifactId>" );
+ buffer.append( "<version>" ).append( artifact.getBaseVersion() ).append( "</version>" );
+ buffer.append( "<packaging>" ).append( artifact.getType() ).append( "</packaging>" );
+ buffer.append( "</project>" );
+
+ return new StringModelSource( buffer, artifact.getId() );
+ }
+
+ @Override
+ public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request )
+ throws ProjectBuildingException
+ {
+ List<ProjectBuildingResult> results = new ArrayList<ProjectBuildingResult>();
+
+ List<InterimResult> interimResults = new ArrayList<InterimResult>();
+
+ ReactorModelPool modelPool = new ReactorModelPool();
+
+ InternalConfig config = new InternalConfig( request, modelPool );
+
+ Map<String, MavenProject> projectIndex = new HashMap<String, MavenProject>( 256 );
+
+ boolean noErrors =
+ build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive,
+ config );
+
+ populateReactorModelPool( modelPool, interimResults );
+
+ ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();
+
+ try
+ {
+ noErrors =
+ build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request,
+ new HashMap<File, Boolean>() ) && noErrors;
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader( oldContextClassLoader );
+ }
+
+ if ( !noErrors )
+ {
+ throw new ProjectBuildingException( results );
+ }
+
+ return results;
+ }
+
+ private boolean build( List<ProjectBuildingResult> results, List<InterimResult> interimResults,
+ Map<String, MavenProject> projectIndex, List<File> pomFiles, Set<File> aggregatorFiles,
+ boolean isRoot, boolean recursive, InternalConfig config )
+ {
+ boolean noErrors = true;
+
+ for ( File pomFile : pomFiles )
+ {
+ aggregatorFiles.add( pomFile );
+
+ if ( !build( results, interimResults, projectIndex, pomFile, aggregatorFiles, isRoot, recursive, config ) )
+ {
+ noErrors = false;
+ }
+
+ aggregatorFiles.remove( pomFile );
+ }
+
+ return noErrors;
+ }
+
+ private boolean build( List<ProjectBuildingResult> results, List<InterimResult> interimResults,
+ Map<String, MavenProject> projectIndex, File pomFile, Set<File> aggregatorFiles,
+ boolean isRoot, boolean recursive, InternalConfig config )
+ {
+ boolean noErrors = true;
+
+ ModelBuildingRequest request = getModelBuildingRequest( config );
+
+ MavenProject project = new MavenProject();
+
+ request.setPomFile( pomFile );
+ request.setTwoPhaseBuilding( true );
+ request.setLocationTracking( true );
+
+ DefaultModelBuildingListener listener =
+ new DefaultModelBuildingListener( project, projectBuildingHelper, config.request );
+ request.setModelBuildingListener( listener );
+
+ try
+ {
+ ModelBuildingResult result = modelBuilder.build( request );
+
+ Model model = result.getEffectiveModel();
+
+ projectIndex.put( result.getModelIds().get( 0 ), project );
+
+ InterimResult interimResult = new InterimResult( pomFile, request, result, listener, isRoot );
+ interimResults.add( interimResult );
+
+ if ( recursive && !model.getModules().isEmpty() )
+ {
+ File basedir = pomFile.getParentFile();
+
+ List<File> moduleFiles = new ArrayList<File>();
+
+ for ( String module : model.getModules() )
+ {
+ if ( StringUtils.isEmpty( module ) )
+ {
+ continue;
+ }
+
+ module = module.replace( '\\', File.separatorChar ).replace( '/', File.separatorChar );
+
+ File moduleFile = new File( basedir, module );
+
+ if ( moduleFile.isDirectory() )
+ {
+ moduleFile = modelProcessor.locatePom( moduleFile );
+ }
+
+ if ( !moduleFile.isFile() )
+ {
+ ModelProblem problem =
+ new DefaultModelProblem( "Child module " + moduleFile + " of " + pomFile
+ + " does not exist", ModelProblem.Severity.ERROR, ModelProblem.Version.BASE, model, -1,
+ -1, null );
+ result.getProblems().add( problem );
+
+ noErrors = false;
+
+ continue;
+ }
+
+ if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
+ {
+ // we don't canonicalize on unix to avoid interfering with symlinks
+ try
+ {
+ moduleFile = moduleFile.getCanonicalFile();
+ }
+ catch ( IOException e )
+ {
+ moduleFile = moduleFile.getAbsoluteFile();
+ }
+ }
+ else
+ {
+ moduleFile = new File( moduleFile.toURI().normalize() );
+ }
+
+ if ( aggregatorFiles.contains( moduleFile ) )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ for ( File aggregatorFile : aggregatorFiles )
+ {
+ buffer.append( aggregatorFile ).append( " -> " );
+ }
+ buffer.append( moduleFile );
+
+ ModelProblem problem =
+ new DefaultModelProblem( "Child module " + moduleFile + " of " + pomFile
+ + " forms aggregation cycle " + buffer, ModelProblem.Severity.ERROR,
+ ModelProblem.Version.BASE, model, -1, -1, null );
+ result.getProblems().add( problem );
+
+ noErrors = false;
+
+ continue;
+ }
+
+ moduleFiles.add( moduleFile );
+ }
+
+ interimResult.modules = new ArrayList<InterimResult>();
+
+ if ( !build( results, interimResult.modules, projectIndex, moduleFiles, aggregatorFiles, false,
+ recursive, config ) )
+ {
+ noErrors = false;
+ }
+ }
+ }
+ catch ( ModelBuildingException e )
+ {
+ results.add( new DefaultProjectBuildingResult( e.getModelId(), pomFile, e.getProblems() ) );
+
+ noErrors = false;
+ }
+
+ return noErrors;
+ }
+
+ static class InterimResult
+ {
+
+ File pomFile;
+
+ ModelBuildingRequest request;
+
+ ModelBuildingResult result;
+
+ DefaultModelBuildingListener listener;
+
+ boolean root;
+
+ List<InterimResult> modules = Collections.emptyList();
+
+ InterimResult( File pomFile, ModelBuildingRequest request, ModelBuildingResult result,
+ DefaultModelBuildingListener listener, boolean root )
+ {
+ this.pomFile = pomFile;
+ this.request = request;
+ this.result = result;
+ this.listener = listener;
+ this.root = root;
+ }
+
+ }
+
+ private void populateReactorModelPool( ReactorModelPool reactorModelPool, List<InterimResult> interimResults )
+ {
+ for ( InterimResult interimResult : interimResults )
+ {
+ Model model = interimResult.result.getEffectiveModel();
+ reactorModelPool.put( model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getPomFile() );
+
+ populateReactorModelPool( reactorModelPool, interimResult.modules );
+ }
+ }
+
+ private boolean build( List<ProjectBuildingResult> results, List<MavenProject> projects,
+ Map<String, MavenProject> projectIndex, List<InterimResult> interimResults,
+ ProjectBuildingRequest request, Map<File, Boolean> profilesXmls )
+ {
+ boolean noErrors = true;
+
+ for ( InterimResult interimResult : interimResults )
+ {
+ try
+ {
+ ModelBuildingResult result = modelBuilder.build( interimResult.request, interimResult.result );
+
+ MavenProject project = interimResult.listener.getProject();
+ initProject( project, projectIndex, result, profilesXmls, request );
+
+ List<MavenProject> modules = new ArrayList<MavenProject>();
+ noErrors =
+ build( results, modules, projectIndex, interimResult.modules, request, profilesXmls ) && noErrors;
+
+ projects.addAll( modules );
+ projects.add( project );
+
+ project.setExecutionRoot( interimResult.root );
+ project.setCollectedProjects( modules );
+
+ results.add( new DefaultProjectBuildingResult( project, result.getProblems(), null ) );
+ }
+ catch ( ModelBuildingException e )
+ {
+ results.add( new DefaultProjectBuildingResult( e.getModelId(), interimResult.pomFile,
+ e.getProblems() ) );
+
+ noErrors = false;
+ }
+ }
+
+ return noErrors;
+ }
+
+ private void initProject( MavenProject project, Map<String, MavenProject> projects, ModelBuildingResult result,
+ Map<File, Boolean> profilesXmls, ProjectBuildingRequest projectBuildingRequest )
+ {
+ Model model = result.getEffectiveModel();
+
+ project.setModel( model );
+ project.setOriginalModel( result.getRawModel() );
+ project.setFile( model.getPomFile() );
+ Parent p = model.getParent();
+ if ( p != null )
+ {
+ project.setParentArtifact( repositorySystem.createProjectArtifact( p.getGroupId(), p.getArtifactId(),
+ p.getVersion() ) );
+ // org.apache.maven.its.mng4834:parent:0.1
+ String parentModelId = result.getModelIds().get( 1 );
+ File parentPomFile = result.getRawModel( parentModelId ).getPomFile();
+ MavenProject parent = projects.get( parentModelId );
+ if ( parent == null )
+ {
+ //
+ // At this point the DefaultModelBuildingListener has fired and it populates the
+ // remote repositories with those found in the pom.xml, along with the existing externally
+ // defined repositories.
+ //
+ projectBuildingRequest.setRemoteRepositories( project.getRemoteArtifactRepositories() );
+ if ( parentPomFile != null )
+ {
+ project.setParentFile( parentPomFile );
+ try
+ {
+ parent = build( parentPomFile, projectBuildingRequest ).getProject();
+ }
+ catch ( ProjectBuildingException e )
+ {
+ // MNG-4488 where let invalid parents slide on by
+ logger.warn( "Failed to build parent project for " + project.getId() );
+ }
+ }
+ else
+ {
+ Artifact parentArtifact = project.getParentArtifact();
+ try
+ {
+ parent = build( parentArtifact, projectBuildingRequest ).getProject();
+ }
+ catch ( ProjectBuildingException e )
+ {
+ // MNG-4488 where let invalid parents slide on by
+ logger.warn( "Failed to build parent project for " + project.getId() );
+ }
+ }
+ }
+ project.setParent( parent );
+ }
+
+ Artifact projectArtifact =
+ repositorySystem.createArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), null,
+ project.getPackaging() );
+ project.setArtifact( projectArtifact );
+
+ if ( project.getFile() != null )
+ {
+ Build build = project.getBuild();
+ project.addScriptSourceRoot( build.getScriptSourceDirectory() );
+ project.addCompileSourceRoot( build.getSourceDirectory() );
+ project.addTestCompileSourceRoot( build.getTestSourceDirectory() );
+ }
+
+ List<Profile> activeProfiles = new ArrayList<Profile>();
+ activeProfiles.addAll( result.getActivePomProfiles( result.getModelIds().get( 0 ) ) );
+ activeProfiles.addAll( result.getActiveExternalProfiles() );
+ project.setActiveProfiles( activeProfiles );
+
+ project.setInjectedProfileIds( "external", getProfileIds( result.getActiveExternalProfiles() ) );
+ for ( String modelId : result.getModelIds() )
+ {
+ project.setInjectedProfileIds( modelId, getProfileIds( result.getActivePomProfiles( modelId ) ) );
+ }
+
+ String modelId = findProfilesXml( result, profilesXmls );
+ if ( modelId != null )
+ {
+ ModelProblem problem =
+ new DefaultModelProblem( "Detected profiles.xml alongside " + modelId
+ + ", this file is no longer supported and was ignored" + ", please use the settings.xml instead",
+ ModelProblem.Severity.WARNING, ModelProblem.Version.V30, model, -1, -1, null );
+ result.getProblems().add( problem );
+ }
+
+ //
+ // All the parts that were taken out of MavenProject for Maven 4.0.0
+ //
+
+ project.setProjectBuildingRequest( projectBuildingRequest );
+
+ // pluginArtifacts
+ Set<Artifact> pluginArtifacts = new HashSet<Artifact>();
+ for ( Plugin plugin : project.getBuildPlugins() )
+ {
+ Artifact artifact = repositorySystem.createPluginArtifact( plugin );
+
+ if ( artifact != null )
+ {
+ pluginArtifacts.add( artifact );
+ }
+ }
+ project.setPluginArtifacts( pluginArtifacts );
+
+ // reportArtifacts
+ Set<Artifact> reportArtifacts = new HashSet<Artifact>();
+ for ( ReportPlugin report : project.getReportPlugins() )
+ {
+ Plugin pp = new Plugin();
+ pp.setGroupId( report.getGroupId() );
+ pp.setArtifactId( report.getArtifactId() );
+ pp.setVersion( report.getVersion() );
+
+ Artifact artifact = repositorySystem.createPluginArtifact( pp );
+
+ if ( artifact != null )
+ {
+ reportArtifacts.add( artifact );
+ }
+ }
+ project.setReportArtifacts( reportArtifacts );
+
+ // extensionArtifacts
+ Set<Artifact> extensionArtifacts = new HashSet<Artifact>();
+ List<Extension> extensions = project.getBuildExtensions();
+ if ( extensions != null )
+ {
+ for ( Extension ext : extensions )
+ {
+ String version;
+ if ( StringUtils.isEmpty( ext.getVersion() ) )
+ {
+ version = "RELEASE";
+ }
+ else
+ {
+ version = ext.getVersion();
+ }
+
+ Artifact artifact =
+ repositorySystem.createArtifact( ext.getGroupId(), ext.getArtifactId(), version, null, "jar" );
+
+ if ( artifact != null )
+ {
+ extensionArtifacts.add( artifact );
+ }
+ }
+ }
+ project.setExtensionArtifacts( extensionArtifacts );
+
+ // managedVersionMap
+ Map<String, Artifact> map = null;
+ if ( repositorySystem != null )
+ {
+ List<Dependency> deps;
+ DependencyManagement dependencyManagement = project.getDependencyManagement();
+ if ( ( dependencyManagement != null ) && ( ( deps = dependencyManagement.getDependencies() ) != null )
+ && ( deps.size() > 0 ) )
+ {
+ map = new HashMap<String, Artifact>();
+ for ( Dependency d : dependencyManagement.getDependencies() )
+ {
+ Artifact artifact = repositorySystem.createDependencyArtifact( d );
+
+ if ( artifact != null )
+ {
+ map.put( d.getManagementKey(), artifact );
+ }
+ }
+ }
+ else
+ {
+ map = Collections.emptyMap();
+ }
+ }
+ project.setManagedVersionMap( map );
+
+ // release artifact repository
+ if ( project.getDistributionManagement() != null
+ && project.getDistributionManagement().getRepository() != null )
+ {
+ try
+ {
+ DeploymentRepository r = project.getDistributionManagement().getRepository();
+ if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) )
+ {
+ ArtifactRepository repo = repositorySystem.buildArtifactRepository( r );
+ repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(),
+ Arrays.asList( repo ) );
+ repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(),
+ Arrays.asList( repo ) );
+ project.setReleaseArtifactRepository( repo );
+ }
+ }
+ catch ( InvalidRepositoryException e )
+ {
+ throw new IllegalStateException( "Failed to create release distribution repository for "
+ + project.getId(), e );
+ }
+ }
+
+ // snapshot artifact repository
+ if ( project.getDistributionManagement() != null
+ && project.getDistributionManagement().getSnapshotRepository() != null )
+ {
+ try
+ {
+ DeploymentRepository r = project.getDistributionManagement().getSnapshotRepository();
+ if ( !StringUtils.isEmpty( r.getId() ) && !StringUtils.isEmpty( r.getUrl() ) )
+ {
+ ArtifactRepository repo = repositorySystem.buildArtifactRepository( r );
+ repositorySystem.injectProxy( projectBuildingRequest.getRepositorySession(),
+ Arrays.asList( repo ) );
+ repositorySystem.injectAuthentication( projectBuildingRequest.getRepositorySession(),
+ Arrays.asList( repo ) );
+ project.setSnapshotArtifactRepository( repo );
+ }
+ }
+ catch ( InvalidRepositoryException e )
+ {
+ throw new IllegalStateException( "Failed to create snapshot distribution repository for "
+ + project.getId(), e );
+ }
+ }
+ }
+
+ private String findProfilesXml( ModelBuildingResult result, Map<File, Boolean> profilesXmls )
+ {
+ for ( String modelId : result.getModelIds() )
+ {
+ Model model = result.getRawModel( modelId );
+
+ File basedir = model.getProjectDirectory();
+ if ( basedir == null )
+ {
+ break;
+ }
+
+ Boolean profilesXml = profilesXmls.get( basedir );
+ if ( profilesXml == null )
+ {
+ profilesXml = new File( basedir, "profiles.xml" ).exists();
+ profilesXmls.put( basedir, profilesXml );
+ }
+ if ( profilesXml )
+ {
+ return modelId;
+ }
+ }
+
+ return null;
+ }
+
+ class InternalConfig
+ {
+
+ public final ProjectBuildingRequest request;
+
+ public final RepositorySystemSession session;
+
+ public final List<RemoteRepository> repositories;
+
+ public final ReactorModelPool modelPool;
+
+ InternalConfig( ProjectBuildingRequest request, ReactorModelPool modelPool )
+ {
+ this.request = request;
+ this.modelPool = modelPool;
+ session =
+ LegacyLocalRepositoryManager.overlay( request.getLocalRepository(), request.getRepositorySession(),
+ repoSystem );
+ repositories = RepositoryUtils.toRepos( request.getRemoteRepositories() );
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
new file mode 100644
index 00000000..aea8fdbe
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingHelper.java
@@ -0,0 +1,295 @@
+package org.apache.maven.project;
+
+/*
+ * 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.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.classrealm.ClassRealmManager;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Repository;
+import org.apache.maven.plugin.ExtensionRealmCache;
+import org.apache.maven.plugin.MavenPluginManager;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.repository.RepositorySystem;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
+
+/**
+ * Assists the project builder. <strong>Warning:</strong> This is an internal utility class that is only public for
+ * technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without
+ * prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ProjectBuildingHelper.class )
+public class DefaultProjectBuildingHelper
+ implements ProjectBuildingHelper
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private PlexusContainer container;
+
+ @Requirement
+ private ClassRealmManager classRealmManager;
+
+ @Requirement
+ private ProjectRealmCache projectRealmCache;
+
+ @Requirement
+ private RepositorySystem repositorySystem;
+
+ @Requirement
+ private MavenPluginManager pluginManager;
+
+ public List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
+ List<ArtifactRepository> externalRepositories,
+ ProjectBuildingRequest request )
+ throws InvalidRepositoryException
+ {
+ List<ArtifactRepository> internalRepositories = new ArrayList<ArtifactRepository>();
+
+ for ( Repository repository : pomRepositories )
+ {
+ internalRepositories.add( repositorySystem.buildArtifactRepository( repository ) );
+ }
+
+ repositorySystem.injectMirror( request.getRepositorySession(), internalRepositories );
+
+ repositorySystem.injectProxy( request.getRepositorySession(), internalRepositories );
+
+ repositorySystem.injectAuthentication( request.getRepositorySession(), internalRepositories );
+
+ List<ArtifactRepository> dominantRepositories;
+ List<ArtifactRepository> recessiveRepositories;
+
+ if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( request.getRepositoryMerging() ) )
+ {
+ dominantRepositories = externalRepositories;
+ recessiveRepositories = internalRepositories;
+ }
+ else
+ {
+ dominantRepositories = internalRepositories;
+ recessiveRepositories = externalRepositories;
+ }
+
+ List<ArtifactRepository> artifactRepositories = new ArrayList<ArtifactRepository>();
+ Collection<String> repoIds = new HashSet<String>();
+
+ if ( dominantRepositories != null )
+ {
+ for ( ArtifactRepository repository : dominantRepositories )
+ {
+ repoIds.add( repository.getId() );
+ artifactRepositories.add( repository );
+ }
+ }
+
+ if ( recessiveRepositories != null )
+ {
+ for ( ArtifactRepository repository : recessiveRepositories )
+ {
+ if ( repoIds.add( repository.getId() ) )
+ {
+ artifactRepositories.add( repository );
+ }
+ }
+ }
+
+ artifactRepositories = repositorySystem.getEffectiveRepositories( artifactRepositories );
+
+ return artifactRepositories;
+ }
+
+ public synchronized ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
+ ProjectBuildingRequest request )
+ throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException
+ {
+ ClassRealm projectRealm;
+
+ List<Plugin> extensionPlugins = new ArrayList<Plugin>();
+
+ Build build = model.getBuild();
+
+ if ( build != null )
+ {
+ for ( Extension extension : build.getExtensions() )
+ {
+ Plugin plugin = new Plugin();
+ plugin.setGroupId( extension.getGroupId() );
+ plugin.setArtifactId( extension.getArtifactId() );
+ plugin.setVersion( extension.getVersion() );
+ extensionPlugins.add( plugin );
+ }
+
+ for ( Plugin plugin : build.getPlugins() )
+ {
+ if ( plugin.isExtensions() )
+ {
+ extensionPlugins.add( plugin );
+ }
+ }
+ }
+
+ if ( extensionPlugins.isEmpty() )
+ {
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Extension realms for project " + model.getId() + ": (none)" );
+ }
+
+ return new ProjectRealmCache.CacheRecord( null, null );
+ }
+
+ List<ClassRealm> extensionRealms = new ArrayList<ClassRealm>();
+
+ Map<ClassRealm, List<String>> exportedPackages = new HashMap<ClassRealm, List<String>>();
+
+ Map<ClassRealm, List<String>> exportedArtifacts = new HashMap<ClassRealm, List<String>>();
+
+ List<Artifact> publicArtifacts = new ArrayList<Artifact>();
+
+ for ( Plugin plugin : extensionPlugins )
+ {
+ ExtensionRealmCache.CacheRecord recordRealm =
+ pluginManager.setupExtensionsRealm( project, plugin, request.getRepositorySession() );
+
+ final ClassRealm extensionRealm = recordRealm.realm;
+ final ExtensionDescriptor extensionDescriptor = recordRealm.desciptor;
+ final List<Artifact> artifacts = recordRealm.artifacts;
+
+ extensionRealms.add( extensionRealm );
+ if ( extensionDescriptor != null )
+ {
+ exportedPackages.put( extensionRealm, extensionDescriptor.getExportedPackages() );
+ exportedArtifacts.put( extensionRealm, extensionDescriptor.getExportedArtifacts() );
+ }
+
+ if ( !plugin.isExtensions() && artifacts.size() == 2 && artifacts.get( 0 ).getFile() != null
+ && "plexus-utils".equals( artifacts.get( 1 ).getArtifactId() ) )
+ {
+ /*
+ * This is purely for backward-compat with 2.x where <extensions> consisting of a single artifact where
+ * loaded into the core and hence available to plugins, in contrast to bigger extensions that were
+ * loaded into a dedicated realm which is invisible to plugins (MNG-2749).
+ */
+ publicArtifacts.add( artifacts.get( 0 ) );
+ }
+ }
+
+ if ( logger.isDebugEnabled() )
+ {
+ logger.debug( "Extension realms for project " + model.getId() + ": " + extensionRealms );
+ }
+
+ ProjectRealmCache.Key projectRealmKey = projectRealmCache.createKey( extensionRealms );
+
+ ProjectRealmCache.CacheRecord record = projectRealmCache.get( projectRealmKey );
+
+ if ( record == null )
+ {
+ projectRealm = classRealmManager.createProjectRealm( model, toAetherArtifacts( publicArtifacts ) );
+
+ Set<String> exclusions = new LinkedHashSet<String>();
+
+ for ( ClassRealm extensionRealm : extensionRealms )
+ {
+ List<String> excludes = exportedArtifacts.get( extensionRealm );
+
+ if ( excludes != null )
+ {
+ exclusions.addAll( excludes );
+ }
+
+ List<String> exports = exportedPackages.get( extensionRealm );
+
+ if ( exports == null || exports.isEmpty() )
+ {
+ /*
+ * Most existing extensions don't define exported packages, i.e. no classes are to be exposed to
+ * plugins, yet the components provided by the extension (e.g. artifact handlers) must be
+ * accessible, i.e. we still must import the extension realm into the project realm.
+ */
+ exports = Arrays.asList( extensionRealm.getId() );
+ }
+
+ for ( String export : exports )
+ {
+ projectRealm.importFrom( extensionRealm, export );
+ }
+ }
+
+ DependencyFilter extensionArtifactFilter = null;
+ if ( !exclusions.isEmpty() )
+ {
+ extensionArtifactFilter = new ExclusionsDependencyFilter( exclusions );
+ }
+
+ record = projectRealmCache.put( projectRealmKey, projectRealm, extensionArtifactFilter );
+ }
+
+ projectRealmCache.register( project, projectRealmKey, record );
+
+ return record;
+ }
+
+ public void selectProjectRealm( MavenProject project )
+ {
+ ClassLoader projectRealm = project.getClassRealm();
+
+ if ( projectRealm == null )
+ {
+ projectRealm = classRealmManager.getCoreRealm();
+ }
+
+ Thread.currentThread().setContextClassLoader( projectRealm );
+ }
+
+ private List<org.eclipse.aether.artifact.Artifact> toAetherArtifacts( final List<Artifact> pluginArtifacts )
+ {
+ return new ArrayList<org.eclipse.aether.artifact.Artifact>( RepositoryUtils.toArtifacts( pluginArtifacts ) );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
new file mode 100644
index 00000000..185e4ca7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingRequest.java
@@ -0,0 +1,339 @@
+package org.apache.maven.project;
+
+/*
+ * 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.Date;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.eclipse.aether.RepositorySystemSession;
+
+public class DefaultProjectBuildingRequest
+ implements ProjectBuildingRequest
+{
+
+ private RepositorySystemSession repositorySession;
+
+ private ArtifactRepository localRepository;
+
+ private List<ArtifactRepository> remoteRepositories;
+
+ private List<ArtifactRepository> pluginArtifactRepositories;
+
+ private MavenProject project;
+
+ private int validationLevel = ModelBuildingRequest.VALIDATION_LEVEL_STRICT;
+
+ private boolean processPlugins;
+
+ private List<Profile> profiles;
+
+ private List<String> activeProfileIds;
+
+ private List<String> inactiveProfileIds;
+
+ private Properties systemProperties;
+
+ private Properties userProperties;
+
+ private Date buildStartTime;
+
+ private boolean resolveDependencies;
+
+ private boolean resolveVersionRanges;
+
+ private RepositoryMerging repositoryMerging = RepositoryMerging.POM_DOMINANT;
+
+ public DefaultProjectBuildingRequest()
+ {
+ processPlugins = true;
+ profiles = new ArrayList<Profile>();
+ activeProfileIds = new ArrayList<String>();
+ inactiveProfileIds = new ArrayList<String>();
+ systemProperties = new Properties();
+ userProperties = new Properties();
+ remoteRepositories = new ArrayList<ArtifactRepository>();
+ pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
+ }
+
+ public DefaultProjectBuildingRequest( ProjectBuildingRequest request )
+ {
+ this();
+ setProcessPlugins( request.isProcessPlugins() );
+ setProfiles( request.getProfiles() );
+ setActiveProfileIds( request.getActiveProfileIds() );
+ setInactiveProfileIds( request.getInactiveProfileIds() );
+ setSystemProperties( request.getSystemProperties() );
+ setUserProperties( request.getUserProperties() );
+ setRemoteRepositories( request.getRemoteRepositories() );
+ setPluginArtifactRepositories( request.getPluginArtifactRepositories() );
+ setRepositorySession( request.getRepositorySession() );
+ setLocalRepository( request.getLocalRepository() );
+ setBuildStartTime( request.getBuildStartTime() );
+ setProject( request.getProject() );
+ setResolveDependencies( request.isResolveDependencies() );
+ setValidationLevel( request.getValidationLevel() );
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public void setProject( MavenProject mavenProject )
+ {
+ this.project = mavenProject;
+ }
+
+ public ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository )
+ {
+ this.localRepository = localRepository;
+ return this;
+ }
+
+ public ArtifactRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ return remoteRepositories;
+ }
+
+ public ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
+ {
+ if ( remoteRepositories != null )
+ {
+ this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
+ }
+ else
+ {
+ this.remoteRepositories.clear();
+ }
+
+ return this;
+ }
+
+ public List<ArtifactRepository> getPluginArtifactRepositories()
+ {
+ return pluginArtifactRepositories;
+ }
+
+ public ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
+ {
+ if ( pluginArtifactRepositories != null )
+ {
+ this.pluginArtifactRepositories = new ArrayList<ArtifactRepository>( pluginArtifactRepositories );
+ }
+ else
+ {
+ this.pluginArtifactRepositories.clear();
+ }
+
+ return this;
+ }
+
+ public Properties getSystemProperties()
+ {
+ return systemProperties;
+ }
+
+ public ProjectBuildingRequest setSystemProperties( Properties systemProperties )
+ {
+ if ( systemProperties != null )
+ {
+ this.systemProperties = new Properties();
+ synchronized ( systemProperties )
+ { // avoid concurrentmodification if someone else sets/removes an unrelated system property
+ this.systemProperties.putAll( systemProperties );
+ }
+ }
+ else
+ {
+ this.systemProperties.clear();
+ }
+
+ return this;
+ }
+
+ public Properties getUserProperties()
+ {
+ return userProperties;
+ }
+
+ public ProjectBuildingRequest setUserProperties( Properties userProperties )
+ {
+ if ( userProperties != null )
+ {
+ this.userProperties = new Properties();
+ this.userProperties.putAll( userProperties );
+ }
+ else
+ {
+ this.userProperties.clear();
+ }
+
+ return this;
+ }
+
+ public boolean isProcessPlugins()
+ {
+ return processPlugins;
+ }
+
+ public ProjectBuildingRequest setProcessPlugins( boolean processPlugins )
+ {
+ this.processPlugins = processPlugins;
+ return this;
+ }
+
+ public ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies )
+ {
+ this.resolveDependencies = resolveDependencies;
+ return this;
+ }
+
+ public boolean isResolveDependencies()
+ {
+ return resolveDependencies;
+ }
+
+ /** @since 3.2.2 */
+ public ProjectBuildingRequest setResolveVersionRanges( boolean value )
+ {
+ this.resolveVersionRanges = value;
+ return this;
+ }
+
+ /** @since 3.2.2 */
+ public boolean isResolveVersionRanges()
+ {
+ return this.resolveVersionRanges;
+ }
+
+ public ProjectBuildingRequest setValidationLevel( int validationLevel )
+ {
+ this.validationLevel = validationLevel;
+ return this;
+ }
+
+ public int getValidationLevel()
+ {
+ return validationLevel;
+ }
+
+ public List<String> getActiveProfileIds()
+ {
+ return activeProfileIds;
+ }
+
+ public void setActiveProfileIds( List<String> activeProfileIds )
+ {
+ if ( activeProfileIds != null )
+ {
+ this.activeProfileIds = new ArrayList<String>( activeProfileIds );
+ }
+ else
+ {
+ this.activeProfileIds.clear();
+ }
+ }
+
+ public List<String> getInactiveProfileIds()
+ {
+ return inactiveProfileIds;
+ }
+
+ public void setInactiveProfileIds( List<String> inactiveProfileIds )
+ {
+ if ( inactiveProfileIds != null )
+ {
+ this.inactiveProfileIds = new ArrayList<String>( inactiveProfileIds );
+ }
+ else
+ {
+ this.inactiveProfileIds.clear();
+ }
+ }
+
+ public void setProfiles( List<Profile> profiles )
+ {
+ if ( profiles != null )
+ {
+ this.profiles = new ArrayList<Profile>( profiles );
+ }
+ else
+ {
+ this.profiles.clear();
+ }
+ }
+
+ public void addProfile( Profile profile )
+ {
+ profiles.add( profile );
+ }
+
+ public List<Profile> getProfiles()
+ {
+ return profiles;
+ }
+
+ public Date getBuildStartTime()
+ {
+ return buildStartTime;
+ }
+
+ public void setBuildStartTime( Date buildStartTime )
+ {
+ this.buildStartTime = buildStartTime;
+ }
+
+ public RepositorySystemSession getRepositorySession()
+ {
+ return repositorySession;
+ }
+
+ public DefaultProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession )
+ {
+ this.repositorySession = repositorySession;
+ return this;
+ }
+
+ public DefaultProjectBuildingRequest setRepositoryMerging( RepositoryMerging repositoryMerging )
+ {
+ if ( repositoryMerging == null )
+ {
+ throw new IllegalArgumentException( "repository merge mode not specified" );
+ }
+ this.repositoryMerging = repositoryMerging;
+ return this;
+ }
+
+ public RepositoryMerging getRepositoryMerging()
+ {
+ return repositoryMerging;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java
new file mode 100644
index 00000000..b64a395d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuildingResult.java
@@ -0,0 +1,110 @@
+package org.apache.maven.project;
+
+/*
+ * 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.building.ModelProblem;
+
+/**
+ * Collects the output of the project builder.
+ *
+ * @author Benjamin Bentmann
+ */
+class DefaultProjectBuildingResult
+ implements ProjectBuildingResult
+{
+
+ private String projectId;
+
+ private File pomFile;
+
+ private MavenProject project;
+
+ private List<ModelProblem> problems;
+
+ private DependencyResolutionResult dependencyResolutionResult;
+
+ /**
+ * Creates a new result with the specified contents.
+ *
+ * @param project The project that was built, may be {@code null}.
+ * @param problems The problems that were encouterned, may be {@code null}.
+ * @param dependencyResolutionResult The result of the resolution for the project dependencies, may be {@code null}.
+ */
+ public DefaultProjectBuildingResult( MavenProject project, List<ModelProblem> problems,
+ DependencyResolutionResult dependencyResolutionResult )
+ {
+ this.projectId =
+ ( project != null ) ? project.getGroupId() + ':' + project.getArtifactId() + ':' + project.getVersion()
+ : "";
+ this.pomFile = ( project != null ) ? project.getFile() : null;
+ this.project = project;
+ this.problems = problems;
+ this.dependencyResolutionResult = dependencyResolutionResult;
+ }
+
+ /**
+ * Creates a new result with the specified contents.
+ *
+ * @param projectId The identifier of the project, may be {@code null}.
+ * @param pomFile The POM file from which the project was built, may be {@code null}.
+ * @param problems The problems that were encouterned, may be {@code null}.
+ */
+ public DefaultProjectBuildingResult( String projectId, File pomFile, List<ModelProblem> problems )
+ {
+ this.projectId = ( projectId != null ) ? projectId : "";
+ this.pomFile = pomFile;
+ this.problems = problems;
+ }
+
+ public String getProjectId()
+ {
+ return projectId;
+ }
+
+ public File getPomFile()
+ {
+ return pomFile;
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public List<ModelProblem> getProblems()
+ {
+ if ( problems == null )
+ {
+ problems = new ArrayList<ModelProblem>();
+ }
+
+ return problems;
+ }
+
+ public DependencyResolutionResult getDependencyResolutionResult()
+ {
+ return dependencyResolutionResult;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
new file mode 100644
index 00000000..1287eb14
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
@@ -0,0 +1,333 @@
+package org.apache.maven.project;
+
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Exclusion;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.InputSource;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.artifact.ArtifactProperties;
+import org.eclipse.aether.artifact.ArtifactType;
+import org.eclipse.aether.artifact.ArtifactTypeRegistry;
+import org.eclipse.aether.collection.CollectRequest;
+import org.eclipse.aether.collection.DependencyCollectionException;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.graph.DependencyNode;
+import org.eclipse.aether.graph.DependencyVisitor;
+import org.eclipse.aether.resolution.ArtifactResult;
+import org.eclipse.aether.resolution.DependencyRequest;
+import org.eclipse.aether.util.artifact.ArtifactIdUtils;
+import org.eclipse.aether.util.artifact.JavaScopes;
+import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
+
+/**
+ * @author Benjamin Bentmann
+ */
+@Component( role = ProjectDependenciesResolver.class )
+public class DefaultProjectDependenciesResolver
+ implements ProjectDependenciesResolver
+{
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private RepositorySystem repoSystem;
+
+ @Requirement
+ private List<RepositorySessionDecorator> decorators;
+
+ public DependencyResolutionResult resolve( DependencyResolutionRequest request )
+ throws DependencyResolutionException
+ {
+ final RequestTrace trace = RequestTrace.newChild( null, request );
+
+ final DefaultDependencyResolutionResult result = new DefaultDependencyResolutionResult();
+
+ final MavenProject project = request.getMavenProject();
+ final DependencyFilter filter = request.getResolutionFilter();
+ RepositorySystemSession session = request.getRepositorySession();
+ ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
+
+ if ( logger.isDebugEnabled()
+ && session.getConfigProperties().get( DependencyManagerUtils.CONFIG_PROP_VERBOSE ) == null )
+ {
+ DefaultRepositorySystemSession verbose = new DefaultRepositorySystemSession( session );
+ verbose.setConfigProperty( DependencyManagerUtils.CONFIG_PROP_VERBOSE, Boolean.TRUE );
+ session = verbose;
+ }
+
+ for ( RepositorySessionDecorator decorator : decorators )
+ {
+ RepositorySystemSession decorated = decorator.decorate( project, session );
+ if ( decorated != null )
+ {
+ session = decorated;
+ }
+ }
+
+ CollectRequest collect = new CollectRequest();
+ collect.setRootArtifact( RepositoryUtils.toArtifact( project.getArtifact() ) );
+ collect.setRequestContext( "project" );
+ collect.setRepositories( project.getRemoteProjectRepositories() );
+
+ if ( project.getDependencyArtifacts() == null )
+ {
+ for ( Dependency dependency : project.getDependencies() )
+ {
+ if ( StringUtils.isEmpty( dependency.getGroupId() ) || StringUtils.isEmpty( dependency.getArtifactId() )
+ || StringUtils.isEmpty( dependency.getVersion() ) )
+ {
+ // guard against case where best-effort resolution for invalid models is requested
+ continue;
+ }
+ collect.addDependency( RepositoryUtils.toDependency( dependency, stereotypes ) );
+ }
+ }
+ else
+ {
+ Map<String, Dependency> dependencies = new HashMap<String, Dependency>();
+ for ( Dependency dependency : project.getDependencies() )
+ {
+ String classifier = dependency.getClassifier();
+ if ( classifier == null )
+ {
+ ArtifactType type = stereotypes.get( dependency.getType() );
+ if ( type != null )
+ {
+ classifier = type.getClassifier();
+ }
+ }
+ String key =
+ ArtifactIdUtils.toVersionlessId( dependency.getGroupId(), dependency.getArtifactId(),
+ dependency.getType(), classifier );
+ dependencies.put( key, dependency );
+ }
+ for ( Artifact artifact : project.getDependencyArtifacts() )
+ {
+ String key = artifact.getDependencyConflictId();
+ Dependency dependency = dependencies.get( key );
+ Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null;
+ org.eclipse.aether.graph.Dependency dep = RepositoryUtils.toDependency( artifact, exclusions );
+ if ( !JavaScopes.SYSTEM.equals( dep.getScope() ) && dep.getArtifact().getFile() != null )
+ {
+ // enable re-resolution
+ org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
+ art = art.setFile( null ).setVersion( art.getBaseVersion() );
+ dep = dep.setArtifact( art );
+ }
+ collect.addDependency( dep );
+ }
+ }
+
+ DependencyManagement depMngt = project.getDependencyManagement();
+ if ( depMngt != null )
+ {
+ for ( Dependency dependency : depMngt.getDependencies() )
+ {
+ collect.addManagedDependency( RepositoryUtils.toDependency( dependency, stereotypes ) );
+ }
+ }
+
+ DependencyRequest depRequest = new DependencyRequest( collect, filter );
+ depRequest.setTrace( trace );
+
+ DependencyNode node;
+ try
+ {
+ collect.setTrace( RequestTrace.newChild( trace, depRequest ) );
+ node = repoSystem.collectDependencies( session, collect ).getRoot();
+ result.setDependencyGraph( node );
+ }
+ catch ( DependencyCollectionException e )
+ {
+ result.setDependencyGraph( e.getResult().getRoot() );
+ result.setCollectionErrors( e.getResult().getExceptions() );
+
+ throw new DependencyResolutionException( result, "Could not resolve dependencies for project "
+ + project.getId() + ": " + e.getMessage(), e );
+ }
+
+ depRequest.setRoot( node );
+
+ if ( logger.isWarnEnabled() )
+ {
+ for ( DependencyNode child : node.getChildren() )
+ {
+ if ( !child.getRelocations().isEmpty() )
+ {
+ logger.warn( "The artifact " + child.getRelocations().get( 0 ) + " has been relocated to "
+ + child.getDependency().getArtifact() );
+ }
+ }
+ }
+
+ if ( logger.isDebugEnabled() )
+ {
+ node.accept( new GraphLogger( project ) );
+ }
+
+ try
+ {
+ process( result, repoSystem.resolveDependencies( session, depRequest ).getArtifactResults() );
+ }
+ catch ( org.eclipse.aether.resolution.DependencyResolutionException e )
+ {
+ process( result, e.getResult().getArtifactResults() );
+
+ throw new DependencyResolutionException( result, "Could not resolve dependencies for project "
+ + project.getId() + ": " + e.getMessage(), e );
+ }
+
+ return result;
+ }
+
+ private void process( DefaultDependencyResolutionResult result, Collection<ArtifactResult> results )
+ {
+ for ( ArtifactResult ar : results )
+ {
+ DependencyNode node = ar.getRequest().getDependencyNode();
+ if ( ar.isResolved() )
+ {
+ result.addResolvedDependency( node.getDependency() );
+ }
+ else
+ {
+ result.setResolutionErrors( node.getDependency(), ar.getExceptions() );
+ }
+ }
+ }
+
+ class GraphLogger
+ implements DependencyVisitor
+ {
+
+ private final MavenProject project;
+
+ private String indent = "";
+
+ private Map<String, Dependency> managed;
+
+ public GraphLogger( MavenProject project )
+ {
+ this.project = project;
+ }
+
+ public boolean visitEnter( DependencyNode node )
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ buffer.append( indent );
+ org.eclipse.aether.graph.Dependency dep = node.getDependency();
+ if ( dep != null )
+ {
+ org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
+
+ buffer.append( art );
+ buffer.append( ':' ).append( dep.getScope() );
+
+ String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
+ if ( premanagedScope != null && !premanagedScope.equals( dep.getScope() ) )
+ {
+ buffer.append( " (scope managed from " ).append( premanagedScope );
+ appendManagementSource( buffer, art, "scope" );
+ buffer.append( ")" );
+ }
+
+ String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
+ if ( premanagedVersion != null && !premanagedVersion.equals( art.getVersion() ) )
+ {
+ buffer.append( " (version managed from " ).append( premanagedVersion );
+ appendManagementSource( buffer, art, "version" );
+ buffer.append( ")" );
+ }
+ }
+ else
+ {
+ buffer.append( project.getGroupId() );
+ buffer.append( ':' ).append( project.getArtifactId() );
+ buffer.append( ':' ).append( project.getPackaging() );
+ buffer.append( ':' ).append( project.getVersion() );
+ }
+
+ logger.debug( buffer.toString() );
+ indent += " ";
+ return true;
+ }
+
+ public boolean visitLeave( DependencyNode node )
+ {
+ indent = indent.substring( 0, indent.length() - 3 );
+ return true;
+ }
+
+ private void appendManagementSource( StringBuilder buffer, org.eclipse.aether.artifact.Artifact artifact,
+ String field )
+ {
+ if ( managed == null )
+ {
+ managed = new HashMap<String, Dependency>();
+ if ( project.getDependencyManagement() != null )
+ {
+ for ( Dependency dep : project.getDependencyManagement().getDependencies() )
+ {
+ managed.put( dep.getManagementKey(), dep );
+ }
+ }
+ }
+
+ String key =
+ ArtifactIdUtils.toVersionlessId( artifact.getGroupId(), artifact.getArtifactId(),
+ artifact.getProperty( ArtifactProperties.TYPE, "jar" ),
+ artifact.getClassifier() );
+
+ Dependency dependency = managed.get( key );
+ if ( dependency != null )
+ {
+ InputLocation location = dependency.getLocation( field );
+ if ( location != null )
+ {
+ InputSource source = location.getSource();
+ if ( source != null )
+ {
+ buffer.append( " by " ).append( source.getModelId() );
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java
new file mode 100644
index 00000000..53b82bcf
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DefaultProjectRealmCache.java
@@ -0,0 +1,147 @@
+package org.apache.maven.project;
+
+/*
+ * 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.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
+import org.eclipse.aether.graph.DependencyFilter;
+
+/**
+ * Default project realm cache implementation. Assumes cached data does not change.
+ */
+@Component( role = ProjectRealmCache.class )
+public class DefaultProjectRealmCache
+ implements ProjectRealmCache, Disposable
+{
+
+ protected static class CacheKey
+ implements Key
+ {
+
+ private final List<? extends ClassRealm> extensionRealms;
+
+ private final int hashCode;
+
+ public CacheKey( List<? extends ClassRealm> extensionRealms )
+ {
+ this.extensionRealms = ( extensionRealms != null ) ? extensionRealms : Collections.<ClassRealm>emptyList();
+
+ this.hashCode = this.extensionRealms.hashCode();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey other = (CacheKey) o;
+
+ return extensionRealms.equals( other.extensionRealms );
+ }
+
+ @Override
+ public String toString()
+ {
+ return extensionRealms.toString();
+ }
+ }
+
+ protected final Map<Key, CacheRecord> cache = new ConcurrentHashMap<Key, CacheRecord>();
+
+ @Override
+ public Key createKey( List<? extends ClassRealm> extensionRealms )
+ {
+ return new CacheKey( extensionRealms );
+ }
+
+ public CacheRecord get( Key key )
+ {
+ return cache.get( key );
+ }
+
+ public CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter )
+ {
+ if ( projectRealm == null )
+ {
+ throw new NullPointerException();
+ }
+
+ if ( cache.containsKey( key ) )
+ {
+ throw new IllegalStateException( "Duplicate project realm for extensions " + key );
+ }
+
+ CacheRecord record = new CacheRecord( projectRealm, extensionArtifactFilter );
+
+ cache.put( key, record );
+
+ return record;
+ }
+
+ public void flush()
+ {
+ for ( CacheRecord record : cache.values() )
+ {
+ ClassRealm realm = record.realm;
+ try
+ {
+ realm.getWorld().disposeRealm( realm.getId() );
+ }
+ catch ( NoSuchRealmException e )
+ {
+ // ignore
+ }
+ }
+ cache.clear();
+ }
+
+ public void register( MavenProject project, Key key, CacheRecord record )
+ {
+ // default cache does not track record usage
+ }
+
+ @Override
+ public void dispose()
+ {
+ flush();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java
new file mode 100644
index 00000000..50e601e7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionException.java
@@ -0,0 +1,42 @@
+package org.apache.maven.project;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class DependencyResolutionException
+ extends Exception
+{
+
+ private DependencyResolutionResult result;
+
+ public DependencyResolutionException( DependencyResolutionResult result, String message, Throwable cause )
+ {
+ super( message, cause );
+ this.result = result;
+ }
+
+ public DependencyResolutionResult getResult()
+ {
+ return result;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java
new file mode 100644
index 00000000..c120a137
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionRequest.java
@@ -0,0 +1,81 @@
+package org.apache.maven.project;
+
+/*
+ * 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.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.graph.DependencyFilter;
+
+/**
+ * A request to resolve the dependencies of a project.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface DependencyResolutionRequest
+{
+
+ /**
+ * Gets the project to resolve dependencies for.
+ *
+ * @return The project to resolve dependencies for or {@code null} if not set.
+ */
+ MavenProject getMavenProject();
+
+ /**
+ * Sets the project to resolve dependencies for.
+ *
+ * @param project The project to resolve dependencies for, may be {@code null}.
+ * @return This request for chaining, never {@code null}.
+ */
+ DependencyResolutionRequest setMavenProject( MavenProject project );
+
+ /**
+ * Gets the filter used to exclude some dependencies from resolution.
+ *
+ * @return The filter to exclude dependencies from resolution or {@code null} to resolve all dependencies.
+ */
+ DependencyFilter getResolutionFilter();
+
+ /**
+ * Sets the filter used to exclude some dependencies from resolution. Note that this filter only controls the
+ * resolution/download of dependency artifacts, not the inclusion of dependency nodes in the resolved dependency
+ * graph.
+ *
+ * @param filter The filter to exclude dependencies from resolution, may be {@code null} to resolve all
+ * dependencies.
+ * @return This request for chaining, never {@code null}.
+ */
+ DependencyResolutionRequest setResolutionFilter( DependencyFilter filter );
+
+ /**
+ * Gets the session to use for repository access.
+ *
+ * @return The repository session or {@code null} if not set.
+ */
+ RepositorySystemSession getRepositorySession();
+
+ /**
+ * Sets the session to use for repository access.
+ *
+ * @param repositorySession The repository session to use.
+ * @return This request for chaining, never {@code null}.
+ */
+ DependencyResolutionRequest setRepositorySession( RepositorySystemSession repositorySession );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java
new file mode 100644
index 00000000..6ad55fae
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DependencyResolutionResult.java
@@ -0,0 +1,80 @@
+package org.apache.maven.project;
+
+/*
+ * 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.eclipse.aether.graph.Dependency;
+import org.eclipse.aether.graph.DependencyNode;
+
+/**
+ * The result of a project dependency resolution.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface DependencyResolutionResult
+{
+
+ /**
+ * Gets the dependency graph of the project.
+ *
+ * @return The dependency graph or {@code null} if not available.
+ */
+ DependencyNode getDependencyGraph();
+
+ /**
+ * Gets the transitive dependencies of the project that were not excluded by
+ * {@link DependencyResolutionRequest#getResolutionFilter()}. This list is a union of the results from
+ * {@link #getResolvedDependencies()} and {@link #getUnresolvedDependencies()}.
+ *
+ * @return The transitive dependencies, never {@code null}.
+ */
+ List<Dependency> getDependencies();
+
+ /**
+ * Gets the dependencies that were successfully resolved.
+ *
+ * @return The resolved dependencies, never {@code null}.
+ */
+ List<Dependency> getResolvedDependencies();
+
+ /**
+ * Gets the dependencies that could not be resolved.
+ *
+ * @return The unresolved dependencies, never {@code null}.
+ */
+ List<Dependency> getUnresolvedDependencies();
+
+ /**
+ * Gets the errors that occurred while building the dependency graph.
+ *
+ * @return The errors that occurred while building the dependency graph, never {@code null}.
+ */
+ List<Exception> getCollectionErrors();
+
+ /**
+ * Gets the errors that occurred while resolving the specified dependency.
+ *
+ * @param dependency The dependency for which to retrieve the errors, must not be {@code null}.
+ * @return The resolution errors for the specified dependency, never {@code null}.
+ */
+ List<Exception> getResolutionErrors( Dependency dependency );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java
new file mode 100644
index 00000000..6121473d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateArtifactAttachmentException.java
@@ -0,0 +1,64 @@
+package org.apache.maven.project;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * This exception is thrown if an application attempts to attach
+ * two of the same artifacts to a single project.
+ *
+ * @author pgier
+ * @author jdcasey
+ * @todo Make this a checked exception, and modify the API of MavenProjectHelper.
+ * Currently, this modification would create compatibility problems for existing plugins.
+ */
+public class DuplicateArtifactAttachmentException
+ extends RuntimeException
+{
+
+ private static final String DEFAULT_MESSAGE = "Duplicate artifact attachment detected.";
+
+ private Artifact artifact;
+
+ private final MavenProject project;
+
+ public DuplicateArtifactAttachmentException( MavenProject project, Artifact artifact )
+ {
+ super( constructMessage( project, artifact ) );
+ this.project = project;
+ this.artifact = artifact;
+ }
+
+ private static String constructMessage( MavenProject project, Artifact artifact )
+ {
+ return DEFAULT_MESSAGE + " (project: " + project.getId() + "; illegal attachment: " + artifact.getId() + ")";
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java
new file mode 100644
index 00000000..f73c46b2
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/DuplicateProjectException.java
@@ -0,0 +1,80 @@
+package org.apache.maven.project;
+
+/*
+ * 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;
+
+/**
+ * Exception that occurs when the project list contains duplicate projects instead of ignoring one.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class DuplicateProjectException
+ extends Exception
+{
+ private final String projectId;
+
+ private final File existingProjectFile;
+
+ private final File conflictingProjectFile;
+
+ /**
+ * @deprecated use {@link #DuplicateProjectException(String, File, File, String)}
+ */
+ public DuplicateProjectException( String message )
+ {
+ this( null, null, null, message );
+ }
+
+ /**
+ * @deprecated use {@link #DuplicateProjectException(String, File, File, String)}
+ */
+ public DuplicateProjectException( String message, Exception e )
+ {
+ super( message, e );
+ this.projectId = null;
+ this.existingProjectFile = null;
+ this.conflictingProjectFile = null;
+ }
+
+ public DuplicateProjectException( String projectId, File existingProjectFile, File conflictingProjectFile,
+ String message )
+ {
+ super( message );
+ this.projectId = projectId;
+ this.existingProjectFile = existingProjectFile;
+ this.conflictingProjectFile = conflictingProjectFile;
+ }
+
+ public String getProjectId()
+ {
+ return projectId;
+ }
+
+ public File getExistingProjectFile()
+ {
+ return existingProjectFile;
+ }
+
+ public File getConflictingProjectFile()
+ {
+ return conflictingProjectFile;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java
new file mode 100644
index 00000000..062b8b77
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptor.java
@@ -0,0 +1,88 @@
+package org.apache.maven.project;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Provides metadata about a build extension. <strong>Warning:</strong> This is an internal utility class that is only
+ * public for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted
+ * without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public class ExtensionDescriptor
+{
+
+ private List<String> exportedPackages;
+
+ private List<String> exportedArtifacts;
+
+ ExtensionDescriptor()
+ {
+ // hide constructor
+ }
+
+ public List<String> getExportedPackages()
+ {
+ if ( exportedPackages == null )
+ {
+ exportedPackages = new ArrayList<String>();
+ }
+
+ return exportedPackages;
+ }
+
+ public void setExportedPackages( List<String> exportedPackages )
+ {
+ if ( exportedPackages == null )
+ {
+ this.exportedPackages = null;
+ }
+ else
+ {
+ this.exportedPackages = new ArrayList<String>( exportedPackages );
+ }
+ }
+
+ public List<String> getExportedArtifacts()
+ {
+ if ( exportedArtifacts == null )
+ {
+ exportedArtifacts = new ArrayList<String>();
+ }
+
+ return exportedArtifacts;
+ }
+
+ public void setExportedArtifacts( List<String> exportedArtifacts )
+ {
+ if ( exportedArtifacts == null )
+ {
+ this.exportedArtifacts = null;
+ }
+ else
+ {
+ this.exportedArtifacts = new ArrayList<String>( exportedArtifacts );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java
new file mode 100644
index 00000000..c835eff5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java
@@ -0,0 +1,168 @@
+package org.apache.maven.project;
+
+/*
+ * 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.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Creates an extension descriptor from some XML stream.
+ *
+ * @author Benjamin Bentmann
+ */
+public class ExtensionDescriptorBuilder
+{
+
+ /**
+ * @since 3.3.0
+ */
+ public String getExtensionDescriptorLocation()
+ {
+ return "META-INF/maven/extension.xml";
+ }
+
+ /**
+ * Extracts the extension descriptor (if any) from the specified JAR file.
+ *
+ * @param extensionJar The JAR file or directory to extract the descriptor from, must not be {@code null}.
+ * @return The extracted descriptor or {@code null} if no descriptor was found.
+ * @throws IOException If the descriptor is present but could not be parsed.
+ */
+ public ExtensionDescriptor build( File extensionJar )
+ throws IOException
+ {
+ ExtensionDescriptor extensionDescriptor = null;
+
+ if ( extensionJar.isFile() )
+ {
+ JarFile pluginJar = new JarFile( extensionJar, false );
+ try
+ {
+ ZipEntry pluginDescriptorEntry = pluginJar.getEntry( getExtensionDescriptorLocation() );
+
+ if ( pluginDescriptorEntry != null )
+ {
+ InputStream is = pluginJar.getInputStream( pluginDescriptorEntry );
+
+ try
+ {
+ extensionDescriptor = build( is );
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ }
+ finally
+ {
+ pluginJar.close();
+ }
+ }
+ else
+ {
+ File pluginXml = new File( extensionJar, getExtensionDescriptorLocation() );
+
+ if ( pluginXml.canRead() )
+ {
+ InputStream is = new BufferedInputStream( new FileInputStream( pluginXml ) );
+ try
+ {
+ extensionDescriptor = build( is );
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ }
+
+ return extensionDescriptor;
+ }
+
+ /**
+ * @since 3.3.0
+ */
+ public ExtensionDescriptor build( InputStream is )
+ throws IOException
+ {
+ ExtensionDescriptor extensionDescriptor = new ExtensionDescriptor();
+
+ Xpp3Dom dom;
+ try
+ {
+ dom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( is ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw (IOException) new IOException( e.getMessage() ).initCause( e );
+ }
+
+ if ( !"extension".equals( dom.getName() ) )
+ {
+ throw new IOException( "Unexpected root element \"" + dom.getName() + "\", expected \"extension\"" );
+ }
+
+ extensionDescriptor.setExportedPackages( parseStrings( dom.getChild( "exportedPackages" ) ) );
+
+ extensionDescriptor.setExportedArtifacts( parseStrings( dom.getChild( "exportedArtifacts" ) ) );
+
+ return extensionDescriptor;
+ }
+
+ private List<String> parseStrings( Xpp3Dom dom )
+ {
+ List<String> strings = null;
+
+ if ( dom != null )
+ {
+ strings = new ArrayList<String>();
+
+ for ( Xpp3Dom child : dom.getChildren() )
+ {
+ String string = child.getValue();
+ if ( string != null )
+ {
+ string = string.trim();
+ if ( string.length() > 0 )
+ {
+ strings.add( string );
+ }
+ }
+ }
+ }
+
+ return strings;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
new file mode 100644
index 00000000..5e42ee46
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/InvalidProjectVersionException.java
@@ -0,0 +1,59 @@
+package org.apache.maven.project;
+
+/*
+ * 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.artifact.versioning.InvalidVersionSpecificationException;
+
+public class InvalidProjectVersionException
+ extends ProjectBuildingException
+{
+
+ private final String locationInPom;
+
+ private final String offendingVersion;
+
+ public InvalidProjectVersionException( String projectId, String locationInPom, String offendingVersion,
+ File pomFile, InvalidVersionSpecificationException cause )
+ {
+ super( projectId, formatMessage( projectId, locationInPom, offendingVersion, cause ), pomFile, cause );
+ this.locationInPom = locationInPom;
+ this.offendingVersion = offendingVersion;
+ }
+
+ private static String formatMessage( String projectId, String locationInPom, String offendingVersion,
+ InvalidVersionSpecificationException cause )
+ {
+ return "Invalid version: " + offendingVersion + " found for: " + locationInPom + " in project: " + projectId
+ + ". Reason: " + cause.getMessage();
+ }
+
+ public String getOffendingVersion()
+ {
+ return offendingVersion;
+ }
+
+ public String getLocationInPom()
+ {
+ return locationInPom;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
new file mode 100644
index 00000000..8587a5c3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProject.java
@@ -0,0 +1,1976 @@
+package org.apache.maven.project;
+
+/*
+ * 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.Writer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.RepositoryUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+// remove once createArtifacts() is removed
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Developer;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.model.Extension;
+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.Organization;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.Prerequisites;
+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.Repository;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.project.artifact.MavenMetadataSource;
+import org.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.eclipse.aether.graph.DependencyFilter;
+import org.eclipse.aether.repository.RemoteRepository;
+
+/**
+ * The concern of the project is provide runtime values based on the model.
+ * <p/>
+ * The values in the model remain untouched but during the process of building a project notions like inheritance and
+ * interpolation can be added. This allows to have an entity which is useful in a runtime while preserving the model so
+ * that it can be marshalled and unmarshalled without being tainted by runtime requirements.
+ * <p/>
+ * <p>
+ * With changes during 3.2.2 release MavenProject is closer to being immutable after construction with the removal of
+ * all components from this class, and the upfront construction taken care of entirely by the @{ProjectBuilder}. There
+ * is still the issue of having to run the lifecycle in order to find all the compile source roots and resource
+ * directories but I hope to take care of this during the Maven 4.0 release (jvz).
+ * </p>
+ */
+public class MavenProject
+ implements Cloneable
+{
+ public static final String EMPTY_PROJECT_GROUP_ID = "unknown";
+
+ public static final String EMPTY_PROJECT_ARTIFACT_ID = "empty-project";
+
+ public static final String EMPTY_PROJECT_VERSION = "0";
+
+ private Model model;
+
+ private MavenProject parent;
+
+ private File file;
+
+ private File basedir;
+
+ private Set<Artifact> resolvedArtifacts;
+
+ private ArtifactFilter artifactFilter;
+
+ private Set<Artifact> artifacts;
+
+ private Artifact parentArtifact;
+
+ private Set<Artifact> pluginArtifacts;
+
+ private List<ArtifactRepository> remoteArtifactRepositories;
+
+ private List<ArtifactRepository> pluginArtifactRepositories;
+
+ private List<RemoteRepository> remoteProjectRepositories;
+
+ private List<RemoteRepository> remotePluginRepositories;
+
+ private List<Artifact> attachedArtifacts;
+
+ private MavenProject executionProject;
+
+ private List<MavenProject> collectedProjects;
+
+ private List<String> compileSourceRoots = new ArrayList<String>();
+
+ private List<String> testCompileSourceRoots = new ArrayList<String>();
+
+ private List<String> scriptSourceRoots = new ArrayList<String>();
+
+ private ArtifactRepository releaseArtifactRepository;
+
+ private ArtifactRepository snapshotArtifactRepository;
+
+ private List<Profile> activeProfiles = new ArrayList<Profile>();
+
+ private Map<String, List<String>> injectedProfileIds = new LinkedHashMap<String, List<String>>();
+
+ private Set<Artifact> dependencyArtifacts;
+
+ private Artifact artifact;
+
+ // calculated.
+ private Map<String, Artifact> artifactMap;
+
+ private Model originalModel;
+
+ private Map<String, Artifact> pluginArtifactMap;
+
+ private Set<Artifact> reportArtifacts;
+
+ private Map<String, Artifact> reportArtifactMap;
+
+ private Set<Artifact> extensionArtifacts;
+
+ private Map<String, Artifact> extensionArtifactMap;
+
+ private Map<String, Artifact> managedVersionMap;
+
+ private Map<String, MavenProject> projectReferences = new HashMap<String, MavenProject>();
+
+ private boolean executionRoot;
+
+ private File parentFile;
+
+ private Map<String, Object> context;
+
+ private ClassRealm classRealm;
+
+ private DependencyFilter extensionDependencyFilter;
+
+ private final Set<String> lifecyclePhases = Collections.synchronizedSet( new LinkedHashSet<String>() );
+
+ public MavenProject()
+ {
+ Model model = new Model();
+
+ model.setGroupId( EMPTY_PROJECT_GROUP_ID );
+ model.setArtifactId( EMPTY_PROJECT_ARTIFACT_ID );
+ model.setVersion( EMPTY_PROJECT_VERSION );
+
+ setModel( model );
+ }
+
+ public MavenProject( Model model )
+ {
+ setModel( model );
+ }
+
+ public MavenProject( MavenProject project )
+ {
+ deepCopy( project );
+ }
+
+ public File getParentFile()
+ {
+ return parentFile;
+ }
+
+ public void setParentFile( File parentFile )
+ {
+ this.parentFile = parentFile;
+ }
+
+ // ----------------------------------------------------------------------
+ // Accessors
+ // ----------------------------------------------------------------------
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public void setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ // @todo I would like to get rid of this. jvz.
+ public Model getModel()
+ {
+ return model;
+ }
+
+ /**
+ * Returns the project corresponding to a declared parent.
+ *
+ * @return the parent, or null if no parent is declared or there was an error building it
+ */
+ public MavenProject getParent()
+ {
+ return parent;
+ }
+
+ public void setParent( MavenProject parent )
+ {
+ this.parent = parent;
+ }
+
+ public boolean hasParent()
+ {
+ return getParent() != null;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public void setFile( File file )
+ {
+ this.file = file;
+ this.basedir = file != null ? file.getParentFile() : null;
+ }
+
+ /**
+ * Sets project {@code file} without changing project {@code basedir}.
+ *
+ * @since 3.2.4
+ */
+ public void setPomFile( File file )
+ {
+ this.file = file;
+ }
+
+ public File getBasedir()
+ {
+ return basedir;
+ }
+
+ public void setDependencies( List<Dependency> dependencies )
+ {
+ getModel().setDependencies( dependencies );
+ }
+
+ public List<Dependency> getDependencies()
+ {
+ return getModel().getDependencies();
+ }
+
+ public DependencyManagement getDependencyManagement()
+ {
+ return getModel().getDependencyManagement();
+ }
+
+ // ----------------------------------------------------------------------
+ // Test and compile sourceroots.
+ // ----------------------------------------------------------------------
+
+ private void addPath( List<String> paths, String path )
+ {
+ if ( path != null )
+ {
+ path = path.trim();
+ if ( path.length() > 0 )
+ {
+ File file = new File( path );
+ if ( file.isAbsolute() )
+ {
+ path = file.getAbsolutePath();
+ }
+ else
+ {
+ path = new File( getBasedir(), path ).getAbsolutePath();
+ }
+
+ if ( !paths.contains( path ) )
+ {
+ paths.add( path );
+ }
+ }
+ }
+ }
+
+ public void addCompileSourceRoot( String path )
+ {
+ addPath( getCompileSourceRoots(), path );
+ }
+
+ public void addTestCompileSourceRoot( String path )
+ {
+ addPath( getTestCompileSourceRoots(), path );
+ }
+
+ public List<String> getCompileSourceRoots()
+ {
+ return compileSourceRoots;
+ }
+
+ public List<String> getTestCompileSourceRoots()
+ {
+ return testCompileSourceRoots;
+ }
+
+ public List<String> getCompileClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ List<String> list = new ArrayList<String>( getArtifacts().size() + 1 );
+
+ String d = getBuild().getOutputDirectory();
+ if ( d != null )
+ {
+ list.add( d );
+ }
+
+ for ( Artifact a : getArtifacts() )
+ {
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
+ || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ addArtifactPath( a, list );
+ }
+ }
+ }
+
+ return list;
+ }
+
+ // TODO: this checking for file == null happens because the resolver has been confused about the root
+ // artifact or not. things like the stupid dummy artifact coming from surefire.
+ public List<String> getTestClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ List<String> list = new ArrayList<String>( getArtifacts().size() + 2 );
+
+ String d = getBuild().getTestOutputDirectory();
+ if ( d != null )
+ {
+ list.add( d );
+ }
+
+ d = getBuild().getOutputDirectory();
+ if ( d != null )
+ {
+ list.add( d );
+ }
+
+ for ( Artifact a : getArtifacts() )
+ {
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ addArtifactPath( a, list );
+ }
+ }
+
+ return list;
+ }
+
+ public List<String> getRuntimeClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ List<String> list = new ArrayList<String>( getArtifacts().size() + 1 );
+
+ String d = getBuild().getOutputDirectory();
+ if ( d != null )
+ {
+ list.add( d );
+ }
+
+ for ( Artifact a : getArtifacts() )
+ {
+ if ( a.getArtifactHandler().isAddedToClasspath()
+ // TODO: let the scope handler deal with this
+ && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
+ {
+ addArtifactPath( a, list );
+ }
+ }
+ return list;
+ }
+
+ // ----------------------------------------------------------------------
+ // Delegate to the model
+ // ----------------------------------------------------------------------
+
+ public void setModelVersion( String pomVersion )
+ {
+ getModel().setModelVersion( pomVersion );
+ }
+
+ public String getModelVersion()
+ {
+ return getModel().getModelVersion();
+ }
+
+ public String getId()
+ {
+ return getModel().getId();
+ }
+
+ public void setGroupId( String groupId )
+ {
+ getModel().setGroupId( groupId );
+ }
+
+ public String getGroupId()
+ {
+ String groupId = getModel().getGroupId();
+
+ if ( ( groupId == null ) && ( getModel().getParent() != null ) )
+ {
+ groupId = getModel().getParent().getGroupId();
+ }
+
+ return groupId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ getModel().setArtifactId( artifactId );
+ }
+
+ public String getArtifactId()
+ {
+ return getModel().getArtifactId();
+ }
+
+ public void setName( String name )
+ {
+ getModel().setName( name );
+ }
+
+ public String getName()
+ {
+ // TODO: this should not be allowed to be null.
+ if ( getModel().getName() != null )
+ {
+ return getModel().getName();
+ }
+ else
+ {
+ return getArtifactId();
+ }
+ }
+
+ public void setVersion( String version )
+ {
+ getModel().setVersion( version );
+ }
+
+ public String getVersion()
+ {
+ String version = getModel().getVersion();
+
+ if ( ( version == null ) && ( getModel().getParent() != null ) )
+ {
+ version = getModel().getParent().getVersion();
+ }
+
+ return version;
+ }
+
+ public String getPackaging()
+ {
+ return getModel().getPackaging();
+ }
+
+ public void setPackaging( String packaging )
+ {
+ getModel().setPackaging( packaging );
+ }
+
+ public void setInceptionYear( String inceptionYear )
+ {
+ getModel().setInceptionYear( inceptionYear );
+ }
+
+ public String getInceptionYear()
+ {
+ return getModel().getInceptionYear();
+ }
+
+ public void setUrl( String url )
+ {
+ getModel().setUrl( url );
+ }
+
+ public String getUrl()
+ {
+ return getModel().getUrl();
+ }
+
+ public Prerequisites getPrerequisites()
+ {
+ return getModel().getPrerequisites();
+ }
+
+ public void setIssueManagement( IssueManagement issueManagement )
+ {
+ getModel().setIssueManagement( issueManagement );
+ }
+
+ public CiManagement getCiManagement()
+ {
+ return getModel().getCiManagement();
+ }
+
+ public void setCiManagement( CiManagement ciManagement )
+ {
+ getModel().setCiManagement( ciManagement );
+ }
+
+ public IssueManagement getIssueManagement()
+ {
+ return getModel().getIssueManagement();
+ }
+
+ public void setDistributionManagement( DistributionManagement distributionManagement )
+ {
+ getModel().setDistributionManagement( distributionManagement );
+ }
+
+ public DistributionManagement getDistributionManagement()
+ {
+ return getModel().getDistributionManagement();
+ }
+
+ public void setDescription( String description )
+ {
+ getModel().setDescription( description );
+ }
+
+ public String getDescription()
+ {
+ return getModel().getDescription();
+ }
+
+ public void setOrganization( Organization organization )
+ {
+ getModel().setOrganization( organization );
+ }
+
+ public Organization getOrganization()
+ {
+ return getModel().getOrganization();
+ }
+
+ public void setScm( Scm scm )
+ {
+ getModel().setScm( scm );
+ }
+
+ public Scm getScm()
+ {
+ return getModel().getScm();
+ }
+
+ public void setMailingLists( List<MailingList> mailingLists )
+ {
+ getModel().setMailingLists( mailingLists );
+ }
+
+ public List<MailingList> getMailingLists()
+ {
+ return getModel().getMailingLists();
+ }
+
+ public void addMailingList( MailingList mailingList )
+ {
+ getModel().addMailingList( mailingList );
+ }
+
+ public void setDevelopers( List<Developer> developers )
+ {
+ getModel().setDevelopers( developers );
+ }
+
+ public List<Developer> getDevelopers()
+ {
+ return getModel().getDevelopers();
+ }
+
+ public void addDeveloper( Developer developer )
+ {
+ getModel().addDeveloper( developer );
+ }
+
+ public void setContributors( List<Contributor> contributors )
+ {
+ getModel().setContributors( contributors );
+ }
+
+ public List<Contributor> getContributors()
+ {
+ return getModel().getContributors();
+ }
+
+ public void addContributor( Contributor contributor )
+ {
+ getModel().addContributor( contributor );
+ }
+
+ public void setBuild( Build build )
+ {
+ getModel().setBuild( build );
+ }
+
+ public Build getBuild()
+ {
+ return getModelBuild();
+ }
+
+ public List<Resource> getResources()
+ {
+ return getBuild().getResources();
+ }
+
+ public List<Resource> getTestResources()
+ {
+ return getBuild().getTestResources();
+ }
+
+ public void addResource( Resource resource )
+ {
+ getBuild().addResource( resource );
+ }
+
+ public void addTestResource( Resource testResource )
+ {
+ getBuild().addTestResource( testResource );
+ }
+
+ public void setLicenses( List<License> licenses )
+ {
+ getModel().setLicenses( licenses );
+ }
+
+ public List<License> getLicenses()
+ {
+ return getModel().getLicenses();
+ }
+
+ public void addLicense( License license )
+ {
+ getModel().addLicense( license );
+ }
+
+ public void setArtifacts( Set<Artifact> artifacts )
+ {
+ this.artifacts = artifacts;
+
+ // flush the calculated artifactMap
+ artifactMap = null;
+ }
+
+ /**
+ * All dependencies that this project has, including transitive ones. Contents are lazily populated, so depending on
+ * what phases have run dependencies in some scopes won't be included. eg. if only compile phase has run,
+ * dependencies with scope test won't be included.
+ *
+ * @return {@link Set} &lt; {@link Artifact} >
+ * @see #getDependencyArtifacts() to get only direct dependencies
+ */
+ public Set<Artifact> getArtifacts()
+ {
+ if ( artifacts == null )
+ {
+ if ( artifactFilter == null || resolvedArtifacts == null )
+ {
+ artifacts = new LinkedHashSet<Artifact>();
+ }
+ else
+ {
+ artifacts = new LinkedHashSet<Artifact>( resolvedArtifacts.size() * 2 );
+ for ( Artifact artifact : resolvedArtifacts )
+ {
+ if ( artifactFilter.include( artifact ) )
+ {
+ artifacts.add( artifact );
+ }
+ }
+ }
+ }
+ return artifacts;
+ }
+
+ public Map<String, Artifact> getArtifactMap()
+ {
+ if ( artifactMap == null )
+ {
+ artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() );
+ }
+ return artifactMap;
+ }
+
+ public void setPluginArtifacts( Set<Artifact> pluginArtifacts )
+ {
+ this.pluginArtifacts = pluginArtifacts;
+
+ this.pluginArtifactMap = null;
+ }
+
+ public Set<Artifact> getPluginArtifacts()
+ {
+ return pluginArtifacts;
+ }
+
+ public Map<String, Artifact> getPluginArtifactMap()
+ {
+ if ( pluginArtifactMap == null )
+ {
+ pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() );
+ }
+
+ return pluginArtifactMap;
+ }
+
+ public void setParentArtifact( Artifact parentArtifact )
+ {
+ this.parentArtifact = parentArtifact;
+ }
+
+ public Artifact getParentArtifact()
+ {
+ return parentArtifact;
+ }
+
+ public List<Repository> getRepositories()
+ {
+ return getModel().getRepositories();
+ }
+
+ // ----------------------------------------------------------------------
+ // Plugins
+ // ----------------------------------------------------------------------
+
+ public List<Plugin> getBuildPlugins()
+ {
+ if ( getModel().getBuild() == null )
+ {
+ return Collections.emptyList();
+ }
+ return getModel().getBuild().getPlugins();
+ }
+
+ public List<String> getModules()
+ {
+ return getModel().getModules();
+ }
+
+ public PluginManagement getPluginManagement()
+ {
+ PluginManagement pluginMgmt = null;
+
+ Build build = getModel().getBuild();
+ if ( build != null )
+ {
+ pluginMgmt = build.getPluginManagement();
+ }
+
+ return pluginMgmt;
+ }
+
+ private Build getModelBuild()
+ {
+ Build build = getModel().getBuild();
+
+ if ( build == null )
+ {
+ build = new Build();
+
+ getModel().setBuild( build );
+ }
+
+ return build;
+ }
+
+ public void setRemoteArtifactRepositories( List<ArtifactRepository> remoteArtifactRepositories )
+ {
+ this.remoteArtifactRepositories = remoteArtifactRepositories;
+ this.remoteProjectRepositories = RepositoryUtils.toRepos( getRemoteArtifactRepositories() );
+ }
+
+ public List<ArtifactRepository> getRemoteArtifactRepositories()
+ {
+ if ( remoteArtifactRepositories == null )
+ {
+ remoteArtifactRepositories = new ArrayList<ArtifactRepository>();
+ }
+
+ return remoteArtifactRepositories;
+ }
+
+ public void setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifactRepositories )
+ {
+ this.pluginArtifactRepositories = pluginArtifactRepositories;
+ this.remotePluginRepositories = RepositoryUtils.toRepos( getPluginArtifactRepositories() );
+ }
+
+ /**
+ * @return a list of ArtifactRepository objects constructed from the Repository objects returned by
+ * getPluginRepositories.
+ */
+ public List<ArtifactRepository> getPluginArtifactRepositories()
+ {
+ if ( pluginArtifactRepositories == null )
+ {
+ pluginArtifactRepositories = new ArrayList<ArtifactRepository>();
+ }
+
+ return pluginArtifactRepositories;
+ }
+
+ public ArtifactRepository getDistributionManagementArtifactRepository()
+ {
+ return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null )
+ ? getSnapshotArtifactRepository()
+ : getReleaseArtifactRepository();
+ }
+
+ public List<Repository> getPluginRepositories()
+ {
+ return getModel().getPluginRepositories();
+ }
+
+ public List<RemoteRepository> getRemoteProjectRepositories()
+ {
+ return remoteProjectRepositories;
+ }
+
+ public List<RemoteRepository> getRemotePluginRepositories()
+ {
+ return remotePluginRepositories;
+ }
+
+ public void setActiveProfiles( List<Profile> activeProfiles )
+ {
+ this.activeProfiles = activeProfiles;
+ }
+
+ public List<Profile> getActiveProfiles()
+ {
+ return activeProfiles;
+ }
+
+ public void setInjectedProfileIds( String source, List<String> injectedProfileIds )
+ {
+ if ( injectedProfileIds != null )
+ {
+ this.injectedProfileIds.put( source, new ArrayList<String>( injectedProfileIds ) );
+ }
+ else
+ {
+ this.injectedProfileIds.remove( source );
+ }
+ }
+
+ /**
+ * Gets the identifiers of all profiles that contributed to this project's effective model. This includes active
+ * profiles from the project's POM and all its parent POMs as well as from external sources like the
+ * {@code settings.xml}. The profile identifiers are grouped by the identifier of their source, e.g.
+ * {@code <groupId>:<artifactId>:<version>} for a POM profile or {@code external} for profiles from the
+ * {@code settings.xml}.
+ *
+ * @return The identifiers of all injected profiles, indexed by the source from which the profiles originated, never
+ * {@code null}.
+ */
+ public Map<String, List<String>> getInjectedProfileIds()
+ {
+ return this.injectedProfileIds;
+ }
+
+ /**
+ * Add or replace an artifact. This method is now deprecated. Use the @{MavenProjectHelper} to attach artifacts to a
+ * project. In spite of the 'throws' declaration on this API, this method has never thrown an exception since Maven
+ * 3.0.x. Historically, it logged and ignored a second addition of the same g/a/v/c/t. Now it replaces the file for
+ * the artifact, so that plugins (e.g. shade) can change the pathname of the file for a particular set of
+ * coordinates.
+ *
+ * @param artifact the artifact to add or replace.
+ * @throws DuplicateArtifactAttachmentException
+ */
+ public void addAttachedArtifact( Artifact artifact )
+ throws DuplicateArtifactAttachmentException
+ {
+ getAttachedArtifacts().add( artifact );
+ }
+
+ public List<Artifact> getAttachedArtifacts()
+ {
+ if ( attachedArtifacts == null )
+ {
+ attachedArtifacts = new ArrayList<Artifact>();
+ }
+ return attachedArtifacts;
+ }
+
+ public Xpp3Dom getGoalConfiguration( String pluginGroupId, String pluginArtifactId, String executionId,
+ String goalId )
+ {
+ Xpp3Dom dom = null;
+
+ if ( getBuildPlugins() != null )
+ {
+ for ( Plugin plugin : getBuildPlugins() )
+ {
+ if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) )
+ {
+ dom = (Xpp3Dom) plugin.getConfiguration();
+
+ if ( executionId != null )
+ {
+ PluginExecution execution = plugin.getExecutionsAsMap().get( executionId );
+ if ( execution != null )
+ {
+ // NOTE: The PluginConfigurationExpander already merged the plugin-level config in
+ dom = (Xpp3Dom) execution.getConfiguration();
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if ( dom != null )
+ {
+ // make a copy so the original in the POM doesn't get messed with
+ dom = new Xpp3Dom( dom );
+ }
+
+ return dom;
+ }
+
+ public MavenProject getExecutionProject()
+ {
+ return ( executionProject == null ? this : executionProject );
+ }
+
+ public void setExecutionProject( MavenProject executionProject )
+ {
+ this.executionProject = executionProject;
+ }
+
+ public List<MavenProject> getCollectedProjects()
+ {
+ return collectedProjects;
+ }
+
+ public void setCollectedProjects( List<MavenProject> collectedProjects )
+ {
+ this.collectedProjects = collectedProjects;
+ }
+
+ /**
+ * Direct dependencies that this project has.
+ *
+ * @return {@link Set} &lt; {@link Artifact} >
+ * @see #getArtifacts() to get all transitive dependencies
+ */
+ public Set<Artifact> getDependencyArtifacts()
+ {
+ return dependencyArtifacts;
+ }
+
+ public void setDependencyArtifacts( Set<Artifact> dependencyArtifacts )
+ {
+ this.dependencyArtifacts = dependencyArtifacts;
+ }
+
+ public void setReleaseArtifactRepository( ArtifactRepository releaseArtifactRepository )
+ {
+ this.releaseArtifactRepository = releaseArtifactRepository;
+ }
+
+ public void setSnapshotArtifactRepository( ArtifactRepository snapshotArtifactRepository )
+ {
+ this.snapshotArtifactRepository = snapshotArtifactRepository;
+ }
+
+ public void setOriginalModel( Model originalModel )
+ {
+ this.originalModel = originalModel;
+ }
+
+ public Model getOriginalModel()
+ {
+ return originalModel;
+ }
+
+ public void setManagedVersionMap( Map<String, Artifact> map )
+ {
+ managedVersionMap = map;
+ }
+
+ public Map<String, Artifact> getManagedVersionMap()
+ {
+ return managedVersionMap;
+ }
+
+ @Override
+ public boolean equals( Object other )
+ {
+ if ( other == this )
+ {
+ return true;
+ }
+ else if ( !( other instanceof MavenProject ) )
+ {
+ return false;
+ }
+
+ MavenProject that = (MavenProject) other;
+
+ return eq( getArtifactId(), that.getArtifactId() ) && eq( getGroupId(), that.getGroupId() )
+ && eq( getVersion(), that.getVersion() );
+ }
+
+ private static <T> boolean eq( T s1, T s2 )
+ {
+ return ( s1 != null ) ? s1.equals( s2 ) : s2 == null;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = 31 * hash + getGroupId().hashCode();
+ hash = 31 * hash + getArtifactId().hashCode();
+ hash = 31 * hash + getVersion().hashCode();
+ return hash;
+ }
+
+ public List<Extension> getBuildExtensions()
+ {
+ Build build = getBuild();
+ if ( ( build == null ) || ( build.getExtensions() == null ) )
+ {
+ return Collections.emptyList();
+ }
+ else
+ {
+ return build.getExtensions();
+ }
+ }
+
+ public void addProjectReference( MavenProject project )
+ {
+ projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(),
+ project.getVersion() ), project );
+ }
+
+ public Properties getProperties()
+ {
+ return getModel().getProperties();
+ }
+
+ public List<String> getFilters()
+ {
+ return getBuild().getFilters();
+ }
+
+ public Map<String, MavenProject> getProjectReferences()
+ {
+ return projectReferences;
+ }
+
+ public boolean isExecutionRoot()
+ {
+ return executionRoot;
+ }
+
+ public void setExecutionRoot( boolean executionRoot )
+ {
+ this.executionRoot = executionRoot;
+ }
+
+ public String getDefaultGoal()
+ {
+ return getBuild() != null ? getBuild().getDefaultGoal() : null;
+ }
+
+ public Plugin getPlugin( String pluginKey )
+ {
+ return getBuild().getPluginsAsMap().get( pluginKey );
+ }
+
+ /**
+ * Default toString
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder( 128 );
+ sb.append( "MavenProject: " );
+ sb.append( getGroupId() );
+ sb.append( ":" );
+ sb.append( getArtifactId() );
+ sb.append( ":" );
+ sb.append( getVersion() );
+ sb.append( " @ " );
+
+ try
+ {
+ sb.append( getFile().getPath() );
+ }
+ catch ( NullPointerException e )
+ {
+ // don't log it.
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * @throws CloneNotSupportedException
+ * @since 2.0.9
+ */
+ @Override
+ public MavenProject clone()
+ {
+ MavenProject clone;
+ try
+ {
+ clone = (MavenProject) super.clone();
+ }
+ catch ( CloneNotSupportedException e )
+ {
+ throw new UnsupportedOperationException( e );
+ }
+
+ clone.deepCopy( this );
+
+ return clone;
+ }
+
+ public void setModel( Model model )
+ {
+ this.model = model;
+ }
+
+ protected void setAttachedArtifacts( List<Artifact> attachedArtifacts )
+ {
+ this.attachedArtifacts = attachedArtifacts;
+ }
+
+ protected void setCompileSourceRoots( List<String> compileSourceRoots )
+ {
+ this.compileSourceRoots = compileSourceRoots;
+ }
+
+ protected void setTestCompileSourceRoots( List<String> testCompileSourceRoots )
+ {
+ this.testCompileSourceRoots = testCompileSourceRoots;
+ }
+
+ protected ArtifactRepository getReleaseArtifactRepository()
+ {
+ return releaseArtifactRepository;
+ }
+
+ protected ArtifactRepository getSnapshotArtifactRepository()
+ {
+ return snapshotArtifactRepository;
+ }
+
+ private void deepCopy( MavenProject project )
+ {
+ // disown the parent
+
+ // copy fields
+ setFile( project.getFile() );
+
+ // don't need a deep copy, they don't get modified or added/removed to/from - but make them unmodifiable to be
+ // sure!
+ if ( project.getDependencyArtifacts() != null )
+ {
+ setDependencyArtifacts( Collections.unmodifiableSet( project.getDependencyArtifacts() ) );
+ }
+
+ if ( project.getArtifacts() != null )
+ {
+ setArtifacts( Collections.unmodifiableSet( project.getArtifacts() ) );
+ }
+
+ if ( project.getParentFile() != null )
+ {
+ parentFile = new File( project.getParentFile().getAbsolutePath() );
+ }
+
+ if ( project.getPluginArtifacts() != null )
+ {
+ setPluginArtifacts( Collections.unmodifiableSet( project.getPluginArtifacts() ) );
+ }
+
+ if ( project.getReportArtifacts() != null )
+ {
+ setReportArtifacts( Collections.unmodifiableSet( project.getReportArtifacts() ) );
+ }
+
+ if ( project.getExtensionArtifacts() != null )
+ {
+ setExtensionArtifacts( Collections.unmodifiableSet( project.getExtensionArtifacts() ) );
+ }
+
+ setParentArtifact( ( project.getParentArtifact() ) );
+
+ if ( project.getRemoteArtifactRepositories() != null )
+ {
+ setRemoteArtifactRepositories( Collections.unmodifiableList( project.getRemoteArtifactRepositories() ) );
+ }
+
+ if ( project.getPluginArtifactRepositories() != null )
+ {
+ setPluginArtifactRepositories( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) );
+ }
+
+ if ( project.getActiveProfiles() != null )
+ {
+ setActiveProfiles( ( Collections.unmodifiableList( project.getActiveProfiles() ) ) );
+ }
+
+ if ( project.getAttachedArtifacts() != null )
+ {
+ // clone properties modifyable by plugins in a forked lifecycle
+ setAttachedArtifacts( new ArrayList<Artifact>( project.getAttachedArtifacts() ) );
+ }
+
+ if ( project.getCompileSourceRoots() != null )
+ {
+ // clone source roots
+ setCompileSourceRoots( ( new ArrayList<String>( project.getCompileSourceRoots() ) ) );
+ }
+
+ if ( project.getTestCompileSourceRoots() != null )
+ {
+ setTestCompileSourceRoots( ( new ArrayList<String>( project.getTestCompileSourceRoots() ) ) );
+ }
+
+ if ( project.getScriptSourceRoots() != null )
+ {
+ setScriptSourceRoots( ( new ArrayList<String>( project.getScriptSourceRoots() ) ) );
+ }
+
+ if ( project.getModel() != null )
+ {
+ setModel( project.getModel().clone() );
+ }
+
+ if ( project.getOriginalModel() != null )
+ {
+ setOriginalModel( project.getOriginalModel() );
+ }
+
+ setExecutionRoot( project.isExecutionRoot() );
+
+ if ( project.getArtifact() != null )
+ {
+ setArtifact( ArtifactUtils.copyArtifact( project.getArtifact() ) );
+ }
+
+ if ( project.getManagedVersionMap() != null )
+ {
+ setManagedVersionMap( new HashMap<String, Artifact>( project.getManagedVersionMap() ) );
+ }
+
+ lifecyclePhases.addAll( project.lifecyclePhases );
+ }
+
+ private void addArtifactPath( Artifact artifact, List<String> classpath )
+ {
+ File file = artifact.getFile();
+ if ( file != null )
+ {
+ classpath.add( file.getPath() );
+ }
+ }
+
+ private static String getProjectReferenceId( String groupId, String artifactId, String version )
+ {
+ StringBuilder buffer = new StringBuilder( 128 );
+ buffer.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( version );
+ return buffer.toString();
+ }
+
+ /**
+ * Sets the value of the context value of this project identified by the given key. If the supplied value is
+ * <code>null</code>, the context value is removed from this project. Context values are intended to allow core
+ * extensions to associate derived state with project instances.
+ */
+ public void setContextValue( String key, Object value )
+ {
+ if ( context == null )
+ {
+ context = new HashMap<String, Object>();
+ }
+ if ( value != null )
+ {
+ context.put( key, value );
+ }
+ else
+ {
+ context.remove( key );
+ }
+ }
+
+ /**
+ * Returns context value of this project associated with the given key or null if this project has no such value.
+ */
+ public Object getContextValue( String key )
+ {
+ if ( context == null )
+ {
+ return null;
+ }
+ return context.get( key );
+ }
+
+ /**
+ * Sets the project's class realm. <strong>Warning:</strong> This is an internal utility method that is only public
+ * for technical reasons, it is not part of the public API. In particular, this method can be changed or deleted
+ * without prior notice and must not be used by plugins.
+ *
+ * @param classRealm The class realm hosting the build extensions of this project, may be {@code null}.
+ */
+ public void setClassRealm( ClassRealm classRealm )
+ {
+ this.classRealm = classRealm;
+ }
+
+ /**
+ * Gets the project's class realm. This class realm hosts the build extensions of the project.
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @return The project's class realm or {@code null}.
+ */
+ public ClassRealm getClassRealm()
+ {
+ return classRealm;
+ }
+
+ /**
+ * Sets the artifact filter used to exclude shared extension artifacts from plugin realms. <strong>Warning:</strong>
+ * This is an internal utility method that is only public for technical reasons, it is not part of the public API.
+ * In particular, this method can be changed or deleted without prior notice and must not be used by plugins.
+ *
+ * @param extensionDependencyFilter The dependency filter to apply to plugins, may be {@code null}.
+ */
+ public void setExtensionDependencyFilter( DependencyFilter extensionDependencyFilter )
+ {
+ this.extensionDependencyFilter = extensionDependencyFilter;
+ }
+
+ /**
+ * Gets the dependency filter used to exclude shared extension artifacts from plugin realms.
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @return The dependency filter or {@code null}.
+ */
+ public DependencyFilter getExtensionDependencyFilter()
+ {
+ return extensionDependencyFilter;
+ }
+
+ /**
+ * Sets the transitive dependency artifacts that have been resolved/collected for this project.
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @param artifacts The set of artifacts, may be {@code null}.
+ */
+ public void setResolvedArtifacts( Set<Artifact> artifacts )
+ {
+ this.resolvedArtifacts = ( artifacts != null ) ? artifacts : Collections.<Artifact>emptySet();
+ this.artifacts = null;
+ this.artifactMap = null;
+ }
+
+ /**
+ * Sets the scope filter to select the artifacts being exposed to the currently executed mojo.
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @param artifactFilter The artifact filter, may be {@code null} to exclude all artifacts.
+ */
+ public void setArtifactFilter( ArtifactFilter artifactFilter )
+ {
+ this.artifactFilter = artifactFilter;
+ this.artifacts = null;
+ this.artifactMap = null;
+ }
+
+ /**
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @param phase The phase to check for, must not be {@code null}.
+ * @return {@code true} if the phase has been seen.
+ */
+ public boolean hasLifecyclePhase( String phase )
+ {
+ return lifecyclePhases.contains( phase );
+ }
+
+ /**
+ * <strong>Warning:</strong> This is an internal utility method that is only public for technical reasons, it is not
+ * part of the public API. In particular, this method can be changed or deleted without prior notice and must not be
+ * used by plugins.
+ *
+ * @param lifecyclePhase The lifecycle phase to add, must not be {@code null}.
+ */
+ public void addLifecyclePhase( String lifecyclePhase )
+ {
+ lifecyclePhases.add( lifecyclePhase );
+ }
+
+ // ----------------------------------------------------------------------------------------------------------------
+ //
+ //
+ // D E P R E C A T E D
+ //
+ //
+ // ----------------------------------------------------------------------------------------------------------------
+ //
+ // Everything below will be removed for Maven 4.0.0
+ //
+ // ----------------------------------------------------------------------------------------------------------------
+
+ private ProjectBuildingRequest projectBuilderConfiguration;
+
+ private Map<String, String> moduleAdjustments;
+
+ @Deprecated // This appears only to be used in test code
+ public String getModulePathAdjustment( MavenProject moduleProject )
+ throws IOException
+ {
+ // FIXME: This is hacky. What if module directory doesn't match artifactid, and parent
+ // is coming from the repository??
+ String module = moduleProject.getArtifactId();
+
+ File moduleFile = moduleProject.getFile();
+
+ if ( moduleFile != null )
+ {
+ File moduleDir = moduleFile.getCanonicalFile().getParentFile();
+
+ module = moduleDir.getName();
+ }
+
+ if ( moduleAdjustments == null )
+ {
+ moduleAdjustments = new HashMap<String, String>();
+
+ List<String> modules = getModules();
+ if ( modules != null )
+ {
+ for ( String modulePath : modules )
+ {
+ String moduleName = modulePath;
+
+ if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) )
+ {
+ moduleName = moduleName.substring( 0, moduleName.length() - 1 );
+ }
+
+ int lastSlash = moduleName.lastIndexOf( '/' );
+
+ if ( lastSlash < 0 )
+ {
+ lastSlash = moduleName.lastIndexOf( '\\' );
+ }
+
+ String adjustment = null;
+
+ if ( lastSlash > -1 )
+ {
+ moduleName = moduleName.substring( lastSlash + 1 );
+ adjustment = modulePath.substring( 0, lastSlash );
+ }
+
+ moduleAdjustments.put( moduleName, adjustment );
+ }
+ }
+ }
+
+ return moduleAdjustments.get( module );
+ }
+
+ @Deprecated
+ public Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, String inheritedScope,
+ ArtifactFilter filter )
+ throws InvalidDependencyVersionException
+ {
+ return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, filter, this );
+ }
+
+ @Deprecated
+ protected void setScriptSourceRoots( List<String> scriptSourceRoots )
+ {
+ this.scriptSourceRoots = scriptSourceRoots;
+ }
+
+ @Deprecated
+ public void addScriptSourceRoot( String path )
+ {
+ if ( path != null )
+ {
+ path = path.trim();
+ if ( path.length() != 0 )
+ {
+ if ( !getScriptSourceRoots().contains( path ) )
+ {
+ getScriptSourceRoots().add( path );
+ }
+ }
+ }
+ }
+
+ @Deprecated
+ public List<String> getScriptSourceRoots()
+ {
+ return scriptSourceRoots;
+ }
+
+ @Deprecated
+ public List<Artifact> getCompileArtifacts()
+ {
+ List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: classpath check doesn't belong here - that's the other method
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
+ || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ list.add( a );
+ }
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Dependency> getCompileDependencies()
+ {
+ Set<Artifact> artifacts = getArtifacts();
+
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
+ {
+ return Collections.emptyList();
+ }
+
+ List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
+ || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+ dependency.setClassifier( a.getClassifier() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Artifact> getTestArtifacts()
+ {
+ List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: classpath check doesn't belong here - that's the other method
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ list.add( a );
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Dependency> getTestDependencies()
+ {
+ Set<Artifact> artifacts = getArtifacts();
+
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
+ {
+ return Collections.emptyList();
+ }
+
+ List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+ dependency.setClassifier( a.getClassifier() );
+
+ list.add( dependency );
+ }
+ return list;
+ }
+
+ @Deprecated // used by the Maven ITs
+ public List<Dependency> getRuntimeDependencies()
+ {
+ Set<Artifact> artifacts = getArtifacts();
+
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
+ {
+ return Collections.emptyList();
+ }
+
+ List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+ dependency.setClassifier( a.getClassifier() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Artifact> getRuntimeArtifacts()
+ {
+ List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: classpath check doesn't belong here - that's the other method
+ if ( a.getArtifactHandler().isAddedToClasspath()
+ // TODO: let the scope handler deal with this
+ && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
+ {
+ list.add( a );
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<String> getSystemClasspathElements()
+ throws DependencyResolutionRequiredException
+ {
+ List<String> list = new ArrayList<String>( getArtifacts().size() );
+
+ String d = getBuild().getOutputDirectory();
+ if ( d != null )
+ {
+ list.add( d );
+ }
+
+ for ( Artifact a : getArtifacts() )
+ {
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ addArtifactPath( a, list );
+ }
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Artifact> getSystemArtifacts()
+ {
+ List<Artifact> list = new ArrayList<Artifact>( getArtifacts().size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: classpath check doesn't belong here - that's the other method
+ if ( a.getArtifactHandler().isAddedToClasspath() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ list.add( a );
+ }
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public List<Dependency> getSystemDependencies()
+ {
+ Set<Artifact> artifacts = getArtifacts();
+
+ if ( ( artifacts == null ) || artifacts.isEmpty() )
+ {
+ return Collections.emptyList();
+ }
+
+ List<Dependency> list = new ArrayList<Dependency>( artifacts.size() );
+
+ for ( Artifact a : getArtifacts() )
+ {
+ // TODO: let the scope handler deal with this
+ if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
+ {
+ Dependency dependency = new Dependency();
+
+ dependency.setArtifactId( a.getArtifactId() );
+ dependency.setGroupId( a.getGroupId() );
+ dependency.setVersion( a.getVersion() );
+ dependency.setScope( a.getScope() );
+ dependency.setType( a.getType() );
+ dependency.setClassifier( a.getClassifier() );
+
+ list.add( dependency );
+ }
+ }
+ return list;
+ }
+
+ @Deprecated
+ public void setReporting( Reporting reporting )
+ {
+ getModel().setReporting( reporting );
+ }
+
+ @Deprecated
+ public Reporting getReporting()
+ {
+ return getModel().getReporting();
+ }
+
+ @Deprecated
+ public void setReportArtifacts( Set<Artifact> reportArtifacts )
+ {
+ this.reportArtifacts = reportArtifacts;
+
+ reportArtifactMap = null;
+ }
+
+ @Deprecated
+ public Set<Artifact> getReportArtifacts()
+ {
+ return reportArtifacts;
+ }
+
+ @Deprecated
+ public Map<String, Artifact> getReportArtifactMap()
+ {
+ if ( reportArtifactMap == null )
+ {
+ reportArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getReportArtifacts() );
+ }
+
+ return reportArtifactMap;
+ }
+
+ @Deprecated
+ public void setExtensionArtifacts( Set<Artifact> extensionArtifacts )
+ {
+ this.extensionArtifacts = extensionArtifacts;
+
+ extensionArtifactMap = null;
+ }
+
+ @Deprecated
+ public Set<Artifact> getExtensionArtifacts()
+ {
+ return extensionArtifacts;
+ }
+
+ @Deprecated
+ public Map<String, Artifact> getExtensionArtifactMap()
+ {
+ if ( extensionArtifactMap == null )
+ {
+ extensionArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getExtensionArtifacts() );
+ }
+
+ return extensionArtifactMap;
+ }
+
+ @Deprecated
+ public List<ReportPlugin> getReportPlugins()
+ {
+ if ( getModel().getReporting() == null )
+ {
+ return Collections.emptyList();
+ }
+ return getModel().getReporting().getPlugins();
+
+ }
+
+ @Deprecated
+ public Xpp3Dom getReportConfiguration( String pluginGroupId, String pluginArtifactId, String reportSetId )
+ {
+ Xpp3Dom dom = null;
+
+ // ----------------------------------------------------------------------
+ // I would like to be able to lookup the Mojo object using a key but
+ // we have a limitation in modello that will be remedied shortly. So
+ // for now I have to iterate through and see what we have.
+ // ----------------------------------------------------------------------
+
+ if ( getReportPlugins() != null )
+ {
+ for ( ReportPlugin plugin : getReportPlugins() )
+ {
+ if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) )
+ {
+ dom = (Xpp3Dom) plugin.getConfiguration();
+
+ if ( reportSetId != null )
+ {
+ ReportSet reportSet = plugin.getReportSetsAsMap().get( reportSetId );
+ if ( reportSet != null )
+ {
+ Xpp3Dom executionConfiguration = (Xpp3Dom) reportSet.getConfiguration();
+ if ( executionConfiguration != null )
+ {
+ Xpp3Dom newDom = new Xpp3Dom( executionConfiguration );
+ dom = Xpp3Dom.mergeXpp3Dom( newDom, dom );
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ if ( dom != null )
+ {
+ // make a copy so the original in the POM doesn't get messed with
+ dom = new Xpp3Dom( dom );
+ }
+
+ return dom;
+ }
+
+ /**
+ * @deprecated Use MavenProjectHelper.attachArtifact(..) instead.
+ */
+ @Deprecated
+ public void attachArtifact( String type, String classifier, File file )
+ {
+ }
+
+ /**
+ * @deprecated Use {@link org.apache.maven.model.io.ModelWriter}.
+ */
+ @Deprecated
+ public void writeModel( Writer writer )
+ throws IOException
+ {
+ MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+ pomWriter.write( writer, getModel() );
+ }
+
+ /**
+ * @deprecated Use {@link org.apache.maven.model.io.ModelWriter}.
+ */
+ @Deprecated
+ public void writeOriginalModel( Writer writer )
+ throws IOException
+ {
+ MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+ pomWriter.write( writer, getOriginalModel() );
+ }
+
+ @Deprecated
+ public Artifact replaceWithActiveArtifact( Artifact pluginArtifact )
+ {
+ return pluginArtifact;
+ }
+
+ /**
+ * Gets the project building request from which this project instance was created. <strong>Warning:</strong> This is
+ * an utility method that is meant to assist integrators of Maven, it must not be used by Maven plugins.
+ *
+ * @return The project building request or {@code null}.
+ * @since 2.1
+ */
+ @Deprecated
+ public ProjectBuildingRequest getProjectBuildingRequest()
+ {
+ return projectBuilderConfiguration;
+ }
+
+ /**
+ * Sets the project building request from which this project instance was created. <strong>Warning:</strong> This is
+ * an utility method that is meant to assist integrators of Maven, it must not be used by Maven plugins.
+ *
+ * @param projectBuildingRequest The project building request, may be {@code null}.
+ * @since 2.1
+ */
+ // used by maven-dependency-tree
+ @Deprecated
+ public void setProjectBuildingRequest( ProjectBuildingRequest projectBuildingRequest )
+ {
+ this.projectBuilderConfiguration = projectBuildingRequest;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java
new file mode 100644
index 00000000..0b54c004
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/MavenProjectHelper.java
@@ -0,0 +1,76 @@
+package org.apache.maven.project;
+
+/*
+ * 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;
+
+/**
+ * Convenience interface for plugins to add or replace artifacts and resources on projects.
+ */
+public interface MavenProjectHelper
+{
+ String ROLE = MavenProjectHelper.class.getName();
+
+ /**
+ * See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with type set to null.
+ * @param project project reference.
+ * @param artifactFile artifact file.
+ * @param artifactClassifier artifact classifier.
+ */
+ void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier );
+
+ /**
+ * * See {@link #attachArtifact(MavenProject, String, String, java.io.File)}, but with classifier set to null.
+ * @param project project reference.
+ * @param artifactType artifact type.
+ * @param artifactFile arrifact file.
+ */
+ void attachArtifact( MavenProject project, String artifactType, File artifactFile );
+
+ /**
+ * Add or replace an artifact to the current project.
+ * @param project the project reference.
+ * @param artifactType the type (e.g. jar) or null.
+ * @param artifactClassifier the classifier or null.
+ * @param artifactFile the file for the artifact.
+ */
+ void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile );
+
+ /**
+ * Add a resource directory to the project.
+ * @param project project reference.
+ * @param resourceDirectory directory.
+ * @param includes include patterns.
+ * @param excludes exclude patterns.
+ */
+ void addResource( MavenProject project, String resourceDirectory, List<String> includes, List<String> excludes );
+
+ /**
+ * Add a test resource directory to the project.
+ * @param project project reference.
+ * @param resourceDirectory directory.
+ * @param includes include patterns.
+ * @param excludes exclude patterns.
+ */
+ void addTestResource( MavenProject project, String resourceDirectory, List<String> includes,
+ List<String> excludes );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java
new file mode 100644
index 00000000..4ac83972
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuilder.java
@@ -0,0 +1,98 @@
+package org.apache.maven.project;
+
+/*
+ * 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 org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.building.ModelSource;
+
+/**
+ * Builds in-memory descriptions of projects.
+ */
+public interface ProjectBuilder
+{
+
+ /**
+ * Builds a project descriptor from the specified POM file.
+ *
+ * @param projectFile The POM file to build the project from, must not be {@code null}.
+ * @param request The project building request that holds further parameters, must not be {@code null}.
+ * @return The result of the project building, never {@code null}.
+ * @throws ProjectBuildingException If the project descriptor could not be successfully built.
+ */
+ ProjectBuildingResult build( File projectFile, ProjectBuildingRequest request )
+ throws ProjectBuildingException;
+
+ /**
+ * Builds a project descriptor for the specified artifact.
+ *
+ * @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
+ * @param request The project building request that holds further parameters, must not be {@code null}.
+ * @return The result of the project building, never {@code null}.
+ * @throws ProjectBuildingException If the project descriptor could not be successfully built.
+ */
+ ProjectBuildingResult build( Artifact projectArtifact, ProjectBuildingRequest request )
+ throws ProjectBuildingException;
+
+ /**
+ * Builds a project descriptor for the specified artifact.
+ *
+ * @param projectArtifact The POM artifact to build the project from, must not be {@code null}.
+ * @param allowStubModel A flag controlling the case of a missing POM artifact. If {@code true} and the specified
+ * POM artifact does not exist, a simple stub model will be returned. If {@code false}, an exception will
+ * be thrown.
+ * @param request The project building request that holds further parameters, must not be {@code null}.
+ * @return The result of the project building, never {@code null}.
+ * @throws ProjectBuildingException If the project descriptor could not be successfully built.
+ */
+ ProjectBuildingResult build( Artifact projectArtifact, boolean allowStubModel, ProjectBuildingRequest request )
+ throws ProjectBuildingException;
+
+ /**
+ * Builds a project descriptor for the specified model source.
+ *
+ * @param modelSource The source of the model to built the project descriptor from, must not be {@code null}.
+ * @param request The project building request that holds further parameters, must not be {@code null}.
+ * @return The result of the project building, never {@code null}.
+ * @throws ProjectBuildingException If the project descriptor could not be successfully built.
+ *
+ * @see org.apache.maven.model.building.ModelSource2
+ */
+ ProjectBuildingResult build( ModelSource modelSource, ProjectBuildingRequest request )
+ throws ProjectBuildingException;
+
+ /**
+ * Builds the projects for the specified POM files and optionally their children.
+ *
+ * @param pomFiles The POM files to build, must not be {@code null}.
+ * @param recursive {@code true} to recursively build sub modules referenced by the POM files, {@code false} to
+ * build only the specified POM files.
+ * @param request The project builder configuration that provides further parameters, must not be {@code null}.
+ * @return The results of the project builder where each result corresponds to one project that was built, never
+ * {@code null}.
+ * @throws ProjectBuildingException If an error was encountered during building of any project.
+ * {@link ProjectBuildingException#getResults()} provides access to the details of the problems.
+ */
+ List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request )
+ throws ProjectBuildingException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java
new file mode 100644
index 00000000..47c12315
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingException.java
@@ -0,0 +1,145 @@
+package org.apache.maven.project;
+
+/*
+ * 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.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.building.ModelProblemUtils;
+
+/**
+ * @author Jason van Zyl
+ */
+public class ProjectBuildingException
+ extends Exception
+{
+ private final String projectId;
+
+ private File pomFile;
+
+ private List<ProjectBuildingResult> results;
+
+ public ProjectBuildingException( String projectId, String message, Throwable cause )
+ {
+ super( createMessage( message, projectId, null ), cause );
+ this.projectId = projectId;
+ }
+
+ /**
+ * @param projectId
+ * @param message
+ * @param pomFile pom file location
+ */
+ public ProjectBuildingException( String projectId, String message, File pomFile )
+ {
+ super( createMessage( message, projectId, pomFile ) );
+ this.projectId = projectId;
+ this.pomFile = pomFile;
+ }
+
+ /**
+ * @param projectId
+ * @param message
+ * @param pomFile pom file location
+ * @param cause
+ */
+ protected ProjectBuildingException( String projectId, String message, File pomFile, Throwable cause )
+ {
+ super( createMessage( message, projectId, pomFile ), cause );
+ this.projectId = projectId;
+ this.pomFile = pomFile;
+ }
+
+ public ProjectBuildingException( List<ProjectBuildingResult> results )
+ {
+ super( createMessage( results ) );
+ this.projectId = "";
+ this.results = results;
+ }
+
+ public File getPomFile()
+ {
+ return pomFile;
+ }
+
+ /**
+ * @deprecated use {@link #getPomFile()}
+ */
+ public String getPomLocation()
+ {
+ if ( getPomFile() != null )
+ {
+ return getPomFile().getAbsolutePath();
+ }
+ else
+ {
+ return "null";
+ }
+ }
+
+ public String getProjectId()
+ {
+ return projectId;
+ }
+
+ public List<ProjectBuildingResult> getResults()
+ {
+ return results;
+ }
+
+ private static String createMessage( String message, String projectId, File pomFile )
+ {
+ StringBuilder buffer = new StringBuilder( 256 );
+ buffer.append( message );
+ buffer.append( " for project " ).append( projectId );
+ if ( pomFile != null )
+ {
+ buffer.append( " at " ).append( pomFile.getAbsolutePath() );
+ }
+ return buffer.toString();
+ }
+
+ private static String createMessage( List<ProjectBuildingResult> results )
+ {
+ StringWriter buffer = new StringWriter( 1024 );
+
+ PrintWriter writer = new PrintWriter( buffer );
+ writer.println( "Some problems were encountered while processing the POMs:" );
+ for ( ProjectBuildingResult result : results )
+ {
+ for ( ModelProblem problem : result.getProblems() )
+ {
+ writer.print( "[" );
+ writer.print( problem.getSeverity() );
+ writer.print( "] " );
+ writer.print( problem.getMessage() );
+ writer.print( " @ " );
+ writer.println( ModelProblemUtils.formatLocation( problem, result.getProjectId() ) );
+ }
+ }
+ writer.close();
+
+ return buffer.toString();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
new file mode 100644
index 00000000..45fff6e6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingHelper.java
@@ -0,0 +1,81 @@
+package org.apache.maven.project;
+
+/*
+ * 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.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Repository;
+import org.apache.maven.plugin.PluginManagerException;
+import org.apache.maven.plugin.PluginResolutionException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+
+/**
+ * Assists the project builder. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProjectBuildingHelper
+{
+
+ /**
+ * Creates the effective artifact repositories from the specified POM repositories.
+ *
+ * @param pomRepositories The POM repositories to create the artifact repositories from, must not be {@code null}.
+ * @param externalRepositories The external (and already mirrored) repositories to merge into the result list, may
+ * be {@code null}.
+ * @param request The project building request holding further settings like repository settings, must not be
+ * {@code null}.
+ * @return The effective artifact repositories, never {@code null}.
+ * @throws InvalidRepositoryException
+ */
+ List<ArtifactRepository> createArtifactRepositories( List<Repository> pomRepositories,
+ List<ArtifactRepository> externalRepositories,
+ ProjectBuildingRequest request )
+ throws InvalidRepositoryException;
+
+ /**
+ * Creates the project realm that hosts the build extensions of the specified model.
+ *
+ * @param project The project to create the project realm for, must not be {@code null}
+ * @param model The model to create the project realm for, must not be {@code null}
+ * @param request The project building request holding further settings like repository settings, must not be
+ * {@code null}.
+ * @return The record with the project realm and extension artifact filter, never {@code null}.
+ * @throws PluginResolutionException If any build extension could not be resolved.
+ */
+ ProjectRealmCache.CacheRecord createProjectRealm( MavenProject project, Model model,
+ ProjectBuildingRequest request )
+ throws PluginResolutionException, PluginVersionResolutionException, PluginManagerException;
+
+ /**
+ * Updates the context class loader such that the container will search the project realm when the model builder
+ * injects the lifecycle bindings from the packaging in the next step. The context class loader is to be reset by
+ * the project builder when the project is fully assembled.
+ *
+ * @param project The project whose class realm should be selected, must not be {@code null}.
+ */
+ void selectProjectRealm( MavenProject project );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
new file mode 100644
index 00000000..0380278b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingRequest.java
@@ -0,0 +1,194 @@
+package org.apache.maven.project;
+
+/*
+ * 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.List;
+import java.util.Properties;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.model.Profile;
+import org.eclipse.aether.RepositorySystemSession;
+
+public interface ProjectBuildingRequest
+{
+
+ ProjectBuildingRequest setLocalRepository( ArtifactRepository localRepository );
+
+ ArtifactRepository getLocalRepository();
+
+ ProjectBuildingRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
+
+ List<ArtifactRepository> getRemoteRepositories();
+
+ ProjectBuildingRequest setPluginArtifactRepositories( List<ArtifactRepository> pluginArtifacgRepositories );
+
+ List<ArtifactRepository> getPluginArtifactRepositories();
+
+ /**
+ * 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}.
+ */
+ ProjectBuildingRequest setSystemProperties( Properties systemProperties );
+
+ /**
+ * 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 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}.
+ */
+ ProjectBuildingRequest setUserProperties( Properties userProperties );
+
+ /**
+ * 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();
+
+ void setProject( MavenProject mavenProject );
+
+ MavenProject getProject();
+
+ ProjectBuildingRequest setProcessPlugins( boolean processPlugins );
+
+ boolean isProcessPlugins();
+
+ ProjectBuildingRequest setResolveDependencies( boolean resolveDependencies );
+
+ boolean isResolveDependencies();
+
+ /**
+ * Controls the level of validation to perform on processed models. By default, models are validated in strict mode.
+ *
+ * @param validationLevel The level of validation to perform on processed models, e.g.
+ * {@link org.apache.maven.model.building.ModelBuildingRequest#VALIDATION_LEVEL_STRICT}.
+ * @return This configuration, never {@code null}.
+ */
+ ProjectBuildingRequest setValidationLevel( int validationLevel );
+
+ /**
+ * Gets the level of validation to perform on processed models.
+ *
+ * @return The level of validation to perform on processed models.
+ */
+ int getValidationLevel();
+
+ // Profiles
+
+ /**
+ * Set any active profiles that the {@link ProjectBuilder} should consider while constructing
+ * a {@link MavenProject}.
+ */
+ void setActiveProfileIds( List<String> activeProfileIds );
+
+ List<String> getActiveProfileIds();
+
+ void setInactiveProfileIds( List<String> inactiveProfileIds );
+
+ List<String> getInactiveProfileIds();
+
+ /**
+ * Add a {@link org.apache.maven.model.Profile} that has come from an external source. This may be from a custom
+ * configuration like the MavenCLI settings.xml file, or from a custom dialog in an IDE integration like M2Eclipse.
+ *
+ * @param profile
+ */
+ void addProfile( Profile profile );
+
+ void setProfiles( List<Profile> profiles );
+
+ List<Profile> getProfiles();
+
+ /**
+ * 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}.
+ */
+ void setBuildStartTime( Date buildStartTime );
+
+ RepositorySystemSession getRepositorySession();
+
+ ProjectBuildingRequest setRepositorySession( RepositorySystemSession repositorySession );
+
+ /**
+ * Sets the merge mode used to combine repositories declared in the POM with the repositories specified in this
+ * request.
+ *
+ * @param mode The repository merge mode, must not be {@code null}.
+ * @return This request for chaining, never {@code null}.
+ * @see #setRemoteRepositories(List)
+ */
+ ProjectBuildingRequest setRepositoryMerging( RepositoryMerging mode );
+
+ /**
+ * Gets the merge mode used to combine repositories declared in the POM with the repositories specified in this
+ * request
+ *
+ * @return The merge mode, never {@code null}.
+ */
+ RepositoryMerging getRepositoryMerging();
+
+ /** @since 3.2.2 */
+ boolean isResolveVersionRanges();
+
+ /** @since 3.2.2 */
+ ProjectBuildingRequest setResolveVersionRanges( boolean value );
+
+ /**
+ * The possible merge modes for combining remote repositories.
+ */
+ enum RepositoryMerging
+ {
+
+ /**
+ * The repositories declared in the POM have precedence over the repositories specified in the request.
+ */
+ POM_DOMINANT,
+
+ /**
+ * The repositories specified in the request have precedence over the repositories declared in the POM.
+ */
+ REQUEST_DOMINANT,
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java
new file mode 100644
index 00000000..9a43154c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectBuildingResult.java
@@ -0,0 +1,74 @@
+package org.apache.maven.project;
+
+/*
+ * 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 org.apache.maven.model.building.ModelProblem;
+
+/**
+ * Collects the output of the project builder.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProjectBuildingResult
+{
+
+ /**
+ * Gets the identifier of the project that 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 project or an empty string if not known, never {@code null}.
+ */
+ String getProjectId();
+
+ /**
+ * Gets the POM file from which the project was built.
+ *
+ * @return The POM file or {@code null} if unknown.
+ */
+ File getPomFile();
+
+ /**
+ * Gets the project that was built.
+ *
+ * @return The project that was built or {@code null} if an error occurred and this result accompanies a
+ * {@link ProjectBuildingException}.
+ */
+ MavenProject getProject();
+
+ /**
+ * Gets the problems that were encountered during the project building.
+ *
+ * @return The problems that were encountered during the project building, can be empty but never {@code null}.
+ */
+ List<ModelProblem> getProblems();
+
+ /**
+ * Gets the result of the dependency resolution for the project.
+ *
+ * @return The result of the dependency resolution for the project or {@code null} if the project dependencies were
+ * not requested.
+ */
+ DependencyResolutionResult getDependencyResolutionResult();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java
new file mode 100644
index 00000000..539055ca
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectDependenciesResolver.java
@@ -0,0 +1,40 @@
+package org.apache.maven.project;
+
+/*
+ * 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.
+ */
+
+/**
+ * Resolves the transitive dependencies of a project.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ProjectDependenciesResolver
+{
+
+ /**
+ * Resolves the transitive dependencies of a project.
+ *
+ * @param request The resolution request holding the parameters, must not be {@code null}.
+ * @return The resolution result, never {@code null}.
+ * @throws DependencyResolutionException If any project dependency could not be resolved.
+ */
+ DependencyResolutionResult resolve( DependencyResolutionRequest request )
+ throws DependencyResolutionException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
new file mode 100644
index 00000000..3e33eb57
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
@@ -0,0 +1,248 @@
+package org.apache.maven.project;
+
+/*
+ * 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.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Repository;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelSource;
+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.repository.internal.ArtifactDescriptorUtils;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.RequestTrace;
+import org.eclipse.aether.artifact.Artifact;
+import org.eclipse.aether.artifact.DefaultArtifact;
+import org.eclipse.aether.impl.RemoteRepositoryManager;
+import org.eclipse.aether.repository.RemoteRepository;
+import org.eclipse.aether.resolution.ArtifactRequest;
+import org.eclipse.aether.resolution.ArtifactResolutionException;
+import org.eclipse.aether.resolution.VersionRangeRequest;
+import org.eclipse.aether.resolution.VersionRangeResolutionException;
+import org.eclipse.aether.resolution.VersionRangeResult;
+
+/**
+ * A model resolver to assist building of projects. This resolver gives priority to those repositories that have been
+ * declared in the POM.
+ *
+ * @author Benjamin Bentmann
+ */
+public class ProjectModelResolver
+ implements ModelResolver
+{
+
+ private final RepositorySystemSession session;
+
+ private final RequestTrace trace;
+
+ private final String context = "project";
+
+ private List<RemoteRepository> repositories;
+
+ private List<RemoteRepository> pomRepositories;
+
+ private final List<RemoteRepository> externalRepositories;
+
+ private final RepositorySystem resolver;
+
+ private final RemoteRepositoryManager remoteRepositoryManager;
+
+ private final Set<String> repositoryIds;
+
+ private final ReactorModelPool modelPool;
+
+ private final ProjectBuildingRequest.RepositoryMerging repositoryMerging;
+
+ public ProjectModelResolver( RepositorySystemSession session, RequestTrace trace, RepositorySystem resolver,
+ RemoteRepositoryManager remoteRepositoryManager, List<RemoteRepository> repositories,
+ ProjectBuildingRequest.RepositoryMerging repositoryMerging,
+ ReactorModelPool modelPool )
+ {
+ this.session = session;
+ this.trace = trace;
+ this.resolver = resolver;
+ this.remoteRepositoryManager = remoteRepositoryManager;
+ this.pomRepositories = new ArrayList<RemoteRepository>();
+ List<RemoteRepository> externalRepositories = new ArrayList<RemoteRepository>();
+ externalRepositories.addAll( repositories );
+ this.externalRepositories = Collections.unmodifiableList( externalRepositories );
+ this.repositories = new ArrayList<RemoteRepository>();
+ this.repositories.addAll( externalRepositories );
+ this.repositoryMerging = repositoryMerging;
+ this.repositoryIds = new HashSet<String>();
+ this.modelPool = modelPool;
+ }
+
+ private ProjectModelResolver( ProjectModelResolver original )
+ {
+ this.session = original.session;
+ this.trace = original.trace;
+ this.resolver = original.resolver;
+ this.remoteRepositoryManager = original.remoteRepositoryManager;
+ this.pomRepositories = new ArrayList<RemoteRepository>( original.pomRepositories );
+ this.externalRepositories = original.externalRepositories;
+ this.repositories = new ArrayList<RemoteRepository>( original.repositories );
+ this.repositoryMerging = original.repositoryMerging;
+ this.repositoryIds = new HashSet<String>( original.repositoryIds );
+ this.modelPool = original.modelPool;
+ }
+
+ public void addRepository( Repository repository )
+ throws InvalidRepositoryException
+ {
+ addRepository( repository, false );
+ }
+
+ @Override
+ public void addRepository( final Repository repository, boolean replace )
+ throws InvalidRepositoryException
+ {
+ if ( !repositoryIds.add( repository.getId() ) )
+ {
+ if ( !replace )
+ {
+ return;
+ }
+
+ // Remove any previous repository with this Id
+ removeMatchingRepository( repositories, repository.getId() );
+ removeMatchingRepository( pomRepositories, repository.getId() );
+ }
+
+ List<RemoteRepository> newRepositories =
+ Collections.singletonList( ArtifactDescriptorUtils.toRemoteRepository( repository ) );
+
+ if ( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT.equals( repositoryMerging ) )
+ {
+ repositories = remoteRepositoryManager.aggregateRepositories( session, repositories, newRepositories,
+ true );
+ }
+ else
+ {
+ pomRepositories =
+ remoteRepositoryManager.aggregateRepositories( session, pomRepositories, newRepositories, true );
+ repositories =
+ remoteRepositoryManager.aggregateRepositories( session, pomRepositories, externalRepositories, false );
+ }
+ }
+
+ private static void removeMatchingRepository( Iterable<RemoteRepository> repositories, final String id )
+ {
+ Iterables.removeIf( repositories, new Predicate<RemoteRepository>()
+ {
+ @Override
+ public boolean apply( RemoteRepository remoteRepository )
+ {
+ return remoteRepository.getId().equals( id );
+ }
+ } );
+ }
+
+ public ModelResolver newCopy()
+ {
+ return new ProjectModelResolver( this );
+ }
+
+ public ModelSource resolveModel( String groupId, String artifactId, String version )
+ throws UnresolvableModelException
+ {
+ File pomFile = null;
+
+ if ( modelPool != null )
+ {
+ pomFile = modelPool.get( groupId, artifactId, version );
+ }
+
+ if ( pomFile == null )
+ {
+ Artifact pomArtifact = new DefaultArtifact( groupId, artifactId, "", "pom", version );
+
+ try
+ {
+ ArtifactRequest request = new ArtifactRequest( pomArtifact, repositories, context );
+ request.setTrace( trace );
+ pomArtifact = resolver.resolveArtifact( session, request ).getArtifact();
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new UnresolvableModelException( e.getMessage(), groupId, artifactId, version, e );
+ }
+
+ pomFile = pomArtifact.getFile();
+ }
+
+ return new FileModelSource( pomFile );
+ }
+
+ public ModelSource resolveModel( Parent parent )
+ throws UnresolvableModelException
+ {
+ Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom",
+ parent.getVersion() );
+
+ VersionRangeRequest versionRangeRequest = new VersionRangeRequest( artifact, repositories, context );
+ versionRangeRequest.setTrace( trace );
+
+ try
+ {
+ VersionRangeResult versionRangeResult = resolver.resolveVersionRange( session, versionRangeRequest );
+
+ if ( versionRangeResult.getHighestVersion() == null )
+ {
+ throw new UnresolvableModelException( "No versions matched the requested range '" + parent.getVersion()
+ + "'", parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion() );
+
+ }
+
+ if ( versionRangeResult.getVersionConstraint() != null
+ && versionRangeResult.getVersionConstraint().getRange() != null
+ && versionRangeResult.getVersionConstraint().getRange().getUpperBound() == null )
+ {
+ throw new UnresolvableModelException( "The requested version range '" + parent.getVersion()
+ + "' does not specify an upper bound", parent.getGroupId(),
+ parent.getArtifactId(), parent.getVersion() );
+
+ }
+
+ parent.setVersion( versionRangeResult.getHighestVersion().toString() );
+ }
+ catch ( VersionRangeResolutionException e )
+ {
+ throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion(), e );
+
+ }
+
+ return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
new file mode 100644
index 00000000..9265b894
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectRealmCache.java
@@ -0,0 +1,79 @@
+package org.apache.maven.project;
+
+/*
+ * 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.codehaus.plexus.classworlds.realm.ClassRealm;
+import org.eclipse.aether.graph.DependencyFilter;
+
+/**
+ * Caches project class realms. <strong>Warning:</strong> This is an internal utility interface that is only public for
+ * technical reasons, it is not part of the public API. In particular, this interface can be changed or deleted without
+ * prior notice.
+ *
+ * @author Igor Fedorenko
+ * @author Benjamin Bentmann
+ */
+public interface ProjectRealmCache
+{
+
+ /**
+ * A cache key.
+ */
+ interface Key
+ {
+ // marker interface for cache keys
+ }
+
+ static class CacheRecord
+ {
+
+ public final ClassRealm realm;
+
+ public final DependencyFilter extensionArtifactFilter;
+
+ public CacheRecord( ClassRealm realm, DependencyFilter extensionArtifactFilter )
+ {
+ this.realm = realm;
+ this.extensionArtifactFilter = extensionArtifactFilter;
+ }
+
+ }
+
+ Key createKey( List<? extends ClassRealm> extensionRealms );
+
+ CacheRecord get( Key key );
+
+ CacheRecord put( Key key, ClassRealm projectRealm, DependencyFilter extensionArtifactFilter );
+
+ void flush();
+
+ /**
+ * Registers the specified cache record for usage with the given project. Integrators can use the information
+ * collected from this method in combination with a custom cache implementation to dispose unused records from the
+ * cache.
+ *
+ * @param project The project that employs the plugin realm, must not be {@code null}.
+ * @param record The cache record being used for the project, must not be {@code null}.
+ */
+ void register( MavenProject project, Key key, CacheRecord record );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java
new file mode 100644
index 00000000..16985e2a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java
@@ -0,0 +1,289 @@
+package org.apache.maven.project;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Extension;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.codehaus.plexus.util.dag.DAG;
+import org.codehaus.plexus.util.dag.TopologicalSorter;
+import org.codehaus.plexus.util.dag.Vertex;
+
+public class ProjectSorter
+{
+ private DAG dag;
+
+ private List<MavenProject> sortedProjects;
+
+ private Map<String, MavenProject> projectMap;
+
+ private MavenProject topLevelProject;
+
+ /**
+ * Sort a list of projects.
+ * <ul>
+ * <li>collect all the vertices for the projects that we want to build.</li>
+ * <li>iterate through the deps of each project and if that dep is within
+ * the set of projects we want to build then add an edge, otherwise throw
+ * the edge away because that dependency is not within the set of projects
+ * we are trying to build. we assume a closed set.</li>
+ * <li>do a topo sort on the graph that remains.</li>
+ * </ul>
+ * @throws DuplicateProjectException if any projects are duplicated by id
+ */
+ // MAVENAPI FIXME: the DAG used is NOT only used to represent the dependency relation,
+ // but also for <parent>, <build><plugin>, <reports>. We need multiple DAG's
+ // since a DAG can only handle 1 type of relationship properly.
+ // Usecase: This is detected as a cycle:
+ // org.apache.maven:maven-plugin-api -(PARENT)->
+ // org.apache.maven:maven -(inherited REPORTING)->
+ // org.apache.maven.plugins:maven-checkstyle-plugin -(DEPENDENCY)->
+ // org.apache.maven:maven-plugin-api
+ // In this case, both the verify and the report goals are called
+ // in a different lifecycle. Though the compiler-plugin has a valid usecase, although
+ // that seems to work fine. We need to take versions and lifecycle into account.
+ public ProjectSorter( Collection<MavenProject> projects )
+ throws CycleDetectedException, DuplicateProjectException
+ {
+ dag = new DAG();
+
+ // groupId:artifactId:version -> project
+ projectMap = new HashMap<String, MavenProject>( projects.size() * 2 );
+
+ // groupId:artifactId -> (version -> vertex)
+ Map<String, Map<String, Vertex>> vertexMap = new HashMap<String, Map<String, Vertex>>( projects.size() * 2 );
+
+ for ( MavenProject project : projects )
+ {
+ String projectId = getId( project );
+
+ MavenProject conflictingProject = projectMap.put( projectId, project );
+
+ if ( conflictingProject != null )
+ {
+ throw new DuplicateProjectException( projectId, conflictingProject.getFile(), project.getFile(),
+ "Project '" + projectId + "' is duplicated in the reactor" );
+ }
+
+ String projectKey = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
+
+ Map<String, Vertex> vertices = vertexMap.get( projectKey );
+ if ( vertices == null )
+ {
+ vertices = new HashMap<String, Vertex>( 2, 1 );
+ vertexMap.put( projectKey, vertices );
+ }
+ vertices.put( project.getVersion(), dag.addVertex( projectId ) );
+ }
+
+ for ( Vertex projectVertex : dag.getVerticies() )
+ {
+ String projectId = projectVertex.getLabel();
+
+ MavenProject project = projectMap.get( projectId );
+
+ for ( Dependency dependency : project.getDependencies() )
+ {
+ addEdge( projectMap, vertexMap, project, projectVertex, dependency.getGroupId(),
+ dependency.getArtifactId(), dependency.getVersion(), false, false );
+ }
+
+ Parent parent = project.getModel().getParent();
+
+ if ( parent != null )
+ {
+ // Parent is added as an edge, but must not cause a cycle - so we remove any other edges it has
+ // in conflict
+ addEdge( projectMap, vertexMap, null, projectVertex, parent.getGroupId(), parent.getArtifactId(),
+ parent.getVersion(), true, false );
+ }
+
+ List<Plugin> buildPlugins = project.getBuildPlugins();
+ if ( buildPlugins != null )
+ {
+ for ( Plugin plugin : buildPlugins )
+ {
+ addEdge( projectMap, vertexMap, project, projectVertex, plugin.getGroupId(),
+ plugin.getArtifactId(), plugin.getVersion(), false, true );
+
+ for ( Dependency dependency : plugin.getDependencies() )
+ {
+ addEdge( projectMap, vertexMap, project, projectVertex, dependency.getGroupId(),
+ dependency.getArtifactId(), dependency.getVersion(), false, true );
+ }
+ }
+ }
+
+ List<Extension> buildExtensions = project.getBuildExtensions();
+ if ( buildExtensions != null )
+ {
+ for ( Extension extension : buildExtensions )
+ {
+ addEdge( projectMap, vertexMap, project, projectVertex, extension.getGroupId(),
+ extension.getArtifactId(), extension.getVersion(), false, true );
+ }
+ }
+ }
+
+ List<MavenProject> sortedProjects = new ArrayList<MavenProject>( projects.size() );
+
+ List<String> sortedProjectLabels = TopologicalSorter.sort( dag );
+
+ for ( String id : sortedProjectLabels )
+ {
+ sortedProjects.add( projectMap.get( id ) );
+ }
+
+ this.sortedProjects = Collections.unmodifiableList( sortedProjects );
+ }
+
+ private void addEdge( Map<String, MavenProject> projectMap, Map<String, Map<String, Vertex>> vertexMap,
+ MavenProject project, Vertex projectVertex, String groupId, String artifactId,
+ String version, boolean force, boolean safe )
+ throws CycleDetectedException
+ {
+ String projectKey = ArtifactUtils.versionlessKey( groupId, artifactId );
+
+ Map<String, Vertex> vertices = vertexMap.get( projectKey );
+
+ if ( vertices != null )
+ {
+ if ( isSpecificVersion( version ) )
+ {
+ Vertex vertex = vertices.get( version );
+ if ( vertex != null )
+ {
+ addEdge( projectVertex, vertex, project, projectMap, force, safe );
+ }
+ }
+ else
+ {
+ for ( Vertex vertex : vertices.values() )
+ {
+ addEdge( projectVertex, vertex, project, projectMap, force, safe );
+ }
+ }
+ }
+ }
+
+ private void addEdge( Vertex fromVertex, Vertex toVertex, MavenProject fromProject,
+ Map<String, MavenProject> projectMap, boolean force, boolean safe )
+ throws CycleDetectedException
+ {
+ if ( fromVertex.equals( toVertex ) )
+ {
+ return;
+ }
+
+ if ( fromProject != null )
+ {
+ MavenProject toProject = projectMap.get( toVertex.getLabel() );
+ fromProject.addProjectReference( toProject );
+ }
+
+ if ( force && toVertex.getChildren().contains( fromVertex ) )
+ {
+ dag.removeEdge( toVertex, fromVertex );
+ }
+
+ try
+ {
+ dag.addEdge( fromVertex, toVertex );
+ }
+ catch ( CycleDetectedException e )
+ {
+ if ( !safe )
+ {
+ throw e;
+ }
+ }
+ }
+
+ private boolean isSpecificVersion( String version )
+ {
+ return !( StringUtils.isEmpty( version ) || version.startsWith( "[" ) || version.startsWith( "(" ) );
+ }
+
+ // TODO: !![jc; 28-jul-2005] check this; if we're using '-r' and there are aggregator tasks, this will result in weirdness.
+ public MavenProject getTopLevelProject()
+ {
+ if ( topLevelProject == null )
+ {
+ for ( Iterator<MavenProject> i = sortedProjects.iterator(); i.hasNext() && ( topLevelProject == null ); )
+ {
+ MavenProject project = i.next();
+ if ( project.isExecutionRoot() )
+ {
+ topLevelProject = project;
+ }
+ }
+ }
+
+ return topLevelProject;
+ }
+
+ public List<MavenProject> getSortedProjects()
+ {
+ return sortedProjects;
+ }
+
+ public boolean hasMultipleProjects()
+ {
+ return sortedProjects.size() > 1;
+ }
+
+ public List<String> getDependents( String id )
+ {
+ return dag.getParentLabels( id );
+ }
+
+ public List<String> getDependencies( String id )
+ {
+ return dag.getChildLabels( id );
+ }
+
+ public static String getId( MavenProject project )
+ {
+ return ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() );
+ }
+
+ public DAG getDAG()
+ {
+ return dag;
+ }
+
+ public Map<String, MavenProject> getProjectMap()
+ {
+ return projectMap;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java
new file mode 100644
index 00000000..24425da1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java
@@ -0,0 +1,103 @@
+package org.apache.maven.project;
+
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+import org.apache.maven.model.building.ModelCache;
+
+/**
+ * A simple model cache used to accelerate model building during a reactor build.
+ *
+ * @author Benjamin Bentmann
+ */
+class ReactorModelCache
+ implements ModelCache
+{
+
+ private final Map<CacheKey, Object> models = new HashMap<CacheKey, Object>( 256 );
+
+ public Object get( String groupId, String artifactId, String version, String tag )
+ {
+ return models.get( new CacheKey( groupId, artifactId, version, tag ) );
+ }
+
+ public void put( String groupId, String artifactId, String version, String tag, Object data )
+ {
+ models.put( new CacheKey( groupId, artifactId, version, tag ), data );
+ }
+
+ private static final class CacheKey
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ private final String tag;
+
+ private final int hashCode;
+
+ public CacheKey( String groupId, String artifactId, String version, String tag )
+ {
+ this.groupId = ( groupId != null ) ? groupId : "";
+ this.artifactId = ( artifactId != null ) ? artifactId : "";
+ this.version = ( version != null ) ? version : "";
+ this.tag = ( tag != null ) ? tag : "";
+
+ int hash = 17;
+ hash = hash * 31 + this.groupId.hashCode();
+ hash = hash * 31 + this.artifactId.hashCode();
+ hash = hash * 31 + this.version.hashCode();
+ hash = hash * 31 + this.tag.hashCode();
+ hashCode = hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) obj;
+
+ return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId )
+ && version.equals( that.version ) && tag.equals( that.tag );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java
new file mode 100644
index 00000000..294fccdb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/ReactorModelPool.java
@@ -0,0 +1,106 @@
+package org.apache.maven.project;
+
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+/**
+ * Holds all POM files that are known to the reactor. This allows the project builder to resolve imported POMs from the
+ * reactor when building another project's effective model.
+ *
+ * @author Benjamin Bentmann
+ */
+class ReactorModelPool
+{
+
+ private final Map<CacheKey, File> pomFiles = new HashMap<CacheKey, File>();
+
+ public File get( String groupId, String artifactId, String version )
+ {
+ return pomFiles.get( new CacheKey( groupId, artifactId, version ) );
+ }
+
+ public void put( String groupId, String artifactId, String version, File pomFile )
+ {
+ pomFiles.put( new CacheKey( groupId, artifactId, version ), pomFile );
+ }
+
+ private static final class CacheKey
+ {
+
+ private final String groupId;
+
+ private final String artifactId;
+
+ private final String version;
+
+ private final int hashCode;
+
+ public CacheKey( String groupId, String artifactId, String version )
+ {
+ this.groupId = ( groupId != null ) ? groupId : "";
+ this.artifactId = ( artifactId != null ) ? artifactId : "";
+ this.version = ( version != null ) ? version : "";
+
+ int hash = 17;
+ hash = hash * 31 + this.groupId.hashCode();
+ hash = hash * 31 + this.artifactId.hashCode();
+ hash = hash * 31 + this.version.hashCode();
+ hashCode = hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey that = (CacheKey) obj;
+
+ return artifactId.equals( that.artifactId ) && groupId.equals( that.groupId )
+ && version.equals( that.version );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder( 96 );
+ buffer.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( version );
+ return buffer.toString();
+ }
+
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java
new file mode 100644
index 00000000..679ee008
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/RepositorySessionDecorator.java
@@ -0,0 +1,36 @@
+package org.apache.maven.project;
+
+/*
+ * 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.eclipse.aether.RepositorySystemSession;
+
+/**
+ * Component interface that allows per-project customization of Aether repository system sessions.
+ *
+ * @since 3.2.4
+ * @provisional This interface is part of work in progress and can be changed or removed without notice.
+ */
+public interface RepositorySessionDecorator
+{
+ /**
+ * Returns possibly {@code null} Aether repository system session to be used to resolve project dependencies.
+ */
+ RepositorySystemSession decorate( MavenProject project, RepositorySystemSession session );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
new file mode 100644
index 00000000..6e13d332
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java
@@ -0,0 +1,403 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Wraps an active project instance to be able to receive updates from its artifact without affecting the original
+ * attributes of this artifact.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @todo I think this exposes a design flaw in that the immutable and mutable parts of an artifact are in one class and
+ * should be split. ie scope, file, etc depend on the context of use, whereas everything else is immutable.
+ */
+@Deprecated
+public class ActiveProjectArtifact
+ implements Artifact
+{
+ private final Artifact artifact;
+
+ private final MavenProject project;
+
+ public ActiveProjectArtifact( MavenProject project, Artifact artifact )
+ {
+ this.artifact = artifact;
+ this.project = project;
+
+ artifact.setFile( project.getArtifact().getFile() );
+ artifact.setResolved( true );
+ }
+
+ /** {@inheritDoc} */
+ public File getFile()
+ {
+ // we need to get the latest file for the project, not the artifact that was created at one point in time
+ return project.getArtifact().getFile();
+ }
+
+ /** {@inheritDoc} */
+ public String getGroupId()
+ {
+ return artifact.getGroupId();
+ }
+
+ /** {@inheritDoc} */
+ public String getArtifactId()
+ {
+ return artifact.getArtifactId();
+ }
+
+ /** {@inheritDoc} */
+ public String getVersion()
+ {
+ return artifact.getVersion();
+ }
+
+ /** {@inheritDoc} */
+ public void setVersion( String version )
+ {
+ artifact.setVersion( version );
+ }
+
+ /** {@inheritDoc} */
+ public String getScope()
+ {
+ return artifact.getScope();
+ }
+
+ /** {@inheritDoc} */
+ public String getType()
+ {
+ return artifact.getType();
+ }
+
+ /** {@inheritDoc} */
+ public String getClassifier()
+ {
+ return artifact.getClassifier();
+ }
+
+ /** {@inheritDoc} */
+ public boolean hasClassifier()
+ {
+ return artifact.hasClassifier();
+ }
+
+ /** {@inheritDoc} */
+ public void setFile( File destination )
+ {
+ artifact.setFile( destination );
+ project.getArtifact().setFile( destination );
+ }
+
+ /** {@inheritDoc} */
+ public String getBaseVersion()
+ {
+ return artifact.getBaseVersion();
+ }
+
+ /** {@inheritDoc} */
+ public void setBaseVersion( String baseVersion )
+ {
+ artifact.setBaseVersion( baseVersion );
+ }
+
+ /** {@inheritDoc} */
+ public String getId()
+ {
+ return artifact.getId();
+ }
+
+ /** {@inheritDoc} */
+ public String getDependencyConflictId()
+ {
+ return artifact.getDependencyConflictId();
+ }
+
+ /** {@inheritDoc} */
+ public void addMetadata( ArtifactMetadata metadata )
+ {
+ artifact.addMetadata( metadata );
+ }
+
+ /** {@inheritDoc} */
+ public Collection<ArtifactMetadata> getMetadataList()
+ {
+ return artifact.getMetadataList();
+ }
+
+ /** {@inheritDoc} */
+ public void setRepository( ArtifactRepository remoteRepository )
+ {
+ artifact.setRepository( remoteRepository );
+ }
+
+ /** {@inheritDoc} */
+ public ArtifactRepository getRepository()
+ {
+ return artifact.getRepository();
+ }
+
+ /** {@inheritDoc} */
+ public void updateVersion( String version, ArtifactRepository localRepository )
+ {
+ artifact.updateVersion( version, localRepository );
+ }
+
+ /** {@inheritDoc} */
+ public String getDownloadUrl()
+ {
+ return artifact.getDownloadUrl();
+ }
+
+ /** {@inheritDoc} */
+ public void setDownloadUrl( String downloadUrl )
+ {
+ artifact.setDownloadUrl( downloadUrl );
+ }
+
+ /** {@inheritDoc} */
+ public ArtifactFilter getDependencyFilter()
+ {
+ return artifact.getDependencyFilter();
+ }
+
+ /** {@inheritDoc} */
+ public void setDependencyFilter( ArtifactFilter artifactFilter )
+ {
+ artifact.setDependencyFilter( artifactFilter );
+ }
+
+ /** {@inheritDoc} */
+ public ArtifactHandler getArtifactHandler()
+ {
+ return artifact.getArtifactHandler();
+ }
+
+ /** {@inheritDoc} */
+ public List<String> getDependencyTrail()
+ {
+ return artifact.getDependencyTrail();
+ }
+
+ /** {@inheritDoc} */
+ public void setDependencyTrail( List<String> dependencyTrail )
+ {
+ artifact.setDependencyTrail( dependencyTrail );
+ }
+
+ /** {@inheritDoc} */
+ public void setScope( String scope )
+ {
+ artifact.setScope( scope );
+ }
+
+ /** {@inheritDoc} */
+ public VersionRange getVersionRange()
+ {
+ return artifact.getVersionRange();
+ }
+
+ /** {@inheritDoc} */
+ public void setVersionRange( VersionRange newRange )
+ {
+ artifact.setVersionRange( newRange );
+ }
+
+ /** {@inheritDoc} */
+ public void selectVersion( String version )
+ {
+ artifact.selectVersion( version );
+ }
+
+ /** {@inheritDoc} */
+ public void setGroupId( String groupId )
+ {
+ artifact.setGroupId( groupId );
+ }
+
+ /** {@inheritDoc} */
+ public void setArtifactId( String artifactId )
+ {
+ artifact.setArtifactId( artifactId );
+ }
+
+ /** {@inheritDoc} */
+ public boolean isSnapshot()
+ {
+ return artifact.isSnapshot();
+ }
+
+ /** {@inheritDoc} */
+ public int compareTo( Artifact a )
+ {
+ return artifact.compareTo( a );
+ }
+
+ /** {@inheritDoc} */
+ public void setResolved( boolean resolved )
+ {
+ artifact.setResolved( resolved );
+ }
+
+ /** {@inheritDoc} */
+ public boolean isResolved()
+ {
+ return artifact.isResolved();
+ }
+
+ /** {@inheritDoc} */
+ public void setResolvedVersion( String version )
+ {
+ artifact.setResolvedVersion( version );
+ }
+
+ /** {@inheritDoc} */
+ public void setArtifactHandler( ArtifactHandler handler )
+ {
+ artifact.setArtifactHandler( handler );
+ }
+
+ /** {@inheritDoc} */
+ public String toString()
+ {
+ return "active project artifact:\n\tartifact = " + artifact + ";\n\tproject: " + project;
+ }
+
+ /** {@inheritDoc} */
+ public boolean isRelease()
+ {
+ return artifact.isRelease();
+ }
+
+ /** {@inheritDoc} */
+ public void setRelease( boolean release )
+ {
+ artifact.setRelease( release );
+ }
+
+ /** {@inheritDoc} */
+ public List<ArtifactVersion> getAvailableVersions()
+ {
+ return artifact.getAvailableVersions();
+ }
+
+ /** {@inheritDoc} */
+ public void setAvailableVersions( List<ArtifactVersion> versions )
+ {
+ artifact.setAvailableVersions( versions );
+ }
+
+ /** {@inheritDoc} */
+ public boolean isOptional()
+ {
+ return artifact.isOptional();
+ }
+
+ /** {@inheritDoc} */
+ public ArtifactVersion getSelectedVersion()
+ throws OverConstrainedVersionException
+ {
+ return artifact.getSelectedVersion();
+ }
+
+ /** {@inheritDoc} */
+ public boolean isSelectedVersionKnown()
+ throws OverConstrainedVersionException
+ {
+ return artifact.isSelectedVersionKnown();
+ }
+
+ /** {@inheritDoc} */
+ public void setOptional( boolean optional )
+ {
+ artifact.setOptional( optional );
+ }
+
+ /** {@inheritDoc} */
+ public int hashCode()
+ {
+ int result = 17;
+
+ result = 37 * result + getGroupId().hashCode();
+ result = 37 * result + getArtifactId().hashCode();
+ result = 37 * result + getType().hashCode();
+ if ( getVersion() != null )
+ {
+ result = 37 * result + getVersion().hashCode();
+ }
+ result = 37 * result + ( getClassifier() != null ? getClassifier().hashCode() : 0 );
+
+ return result;
+ }
+
+ /** {@inheritDoc} */
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof Artifact ) )
+ {
+ return false;
+ }
+
+ Artifact a = (Artifact) o;
+
+ if ( !a.getGroupId().equals( getGroupId() ) )
+ {
+ return false;
+ }
+ else if ( !a.getArtifactId().equals( getArtifactId() ) )
+ {
+ return false;
+ }
+ else if ( !a.getVersion().equals( getVersion() ) )
+ {
+ return false;
+ }
+ else if ( !a.getType().equals( getType() ) )
+ {
+ return false;
+ }
+ else if ( a.getClassifier() == null ? getClassifier() != null : !a.getClassifier().equals( getClassifier() ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java
new file mode 100644
index 00000000..cb06b70f
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ArtifactWithDependencies.java
@@ -0,0 +1,33 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.Dependency;
+
+public interface ArtifactWithDependencies
+{
+
+ List<Dependency> getDependencies();
+
+ List<Dependency> getManagedDependencies();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java
new file mode 100644
index 00000000..fd2b956c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/AttachedArtifact.java
@@ -0,0 +1,185 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.InvalidArtifactRTException;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *<strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
+ * of the public API. In particular, this class can be changed or deleted without prior notice. Use
+ * {@link org.apache.maven.project.MavenProjectHelper#attachArtifact} instead.
+ */
+@Deprecated
+public class AttachedArtifact
+ extends DefaultArtifact
+{
+
+ private final Artifact parent;
+
+ public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
+ {
+ super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
+ classifier, artifactHandler, parent.isOptional() );
+
+ setDependencyTrail( Collections.singletonList( parent.getId() ) );
+
+ this.parent = parent;
+
+ if ( getId().equals( parent.getId() ) )
+ {
+ throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(),
+ parent.getType(), "An attached artifact must have a different ID"
+ + " than its corresponding main artifact." );
+ }
+ }
+
+ public AttachedArtifact( Artifact parent, String type, ArtifactHandler artifactHandler )
+ {
+ this( parent, type, null, artifactHandler );
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ throw new UnsupportedOperationException( "Cannot change the artifactId for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public List<ArtifactVersion> getAvailableVersions()
+ {
+ return parent.getAvailableVersions();
+ }
+
+ public void setAvailableVersions( List<ArtifactVersion> availableVersions )
+ {
+ throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public String getBaseVersion()
+ {
+ return parent.getBaseVersion();
+ }
+
+ public void setBaseVersion( String baseVersion )
+ {
+ throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public String getDownloadUrl()
+ {
+ return parent.getDownloadUrl();
+ }
+
+ public void setDownloadUrl( String downloadUrl )
+ {
+ throw new UnsupportedOperationException( "Cannot change the download information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public void setGroupId( String groupId )
+ {
+ throw new UnsupportedOperationException( "Cannot change the groupId for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public ArtifactRepository getRepository()
+ {
+ return parent.getRepository();
+ }
+
+ public void setRepository( ArtifactRepository repository )
+ {
+ throw new UnsupportedOperationException( "Cannot change the repository information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public String getScope()
+ {
+ return parent.getScope();
+ }
+
+ public void setScope( String scope )
+ {
+ throw new UnsupportedOperationException( "Cannot change the scoping information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public String getVersion()
+ {
+ return parent.getVersion();
+ }
+
+ public void setVersion( String version )
+ {
+ throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public VersionRange getVersionRange()
+ {
+ return parent.getVersionRange();
+ }
+
+ public void setVersionRange( VersionRange range )
+ {
+ throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public boolean isRelease()
+ {
+ return parent.isRelease();
+ }
+
+ public void setRelease( boolean release )
+ {
+ throw new UnsupportedOperationException( "Cannot change the version information for an attached artifact."
+ + " It is derived from the main artifact." );
+ }
+
+ public boolean isSnapshot()
+ {
+ return parent.isSnapshot();
+ }
+
+ public void addMetadata( ArtifactMetadata metadata )
+ {
+ // ignore. The parent artifact will handle metadata.
+ // we must fail silently here to avoid problems with the artifact transformers.
+ }
+
+ public Collection<ArtifactMetadata> getMetadataList()
+ {
+ return Collections.emptyList();
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
new file mode 100644
index 00000000..07fd11da
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java
@@ -0,0 +1,347 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.codehaus.plexus.component.annotations.Component;
+
+@Component( role = MavenMetadataCache.class )
+public class DefaultMavenMetadataCache
+ implements MavenMetadataCache
+{
+
+ protected final Map<CacheKey, CacheRecord> cache = new ConcurrentHashMap<CacheKey, CacheRecord>();
+
+ public static class CacheKey
+ {
+ private final Artifact artifact;
+ private final long pomHash;
+ private final boolean resolveManagedVersions;
+ private final List<ArtifactRepository> repositories = new ArrayList<ArtifactRepository>();
+ private final int hashCode;
+
+ public CacheKey( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ {
+ File file = artifact.getFile();
+ this.artifact = ArtifactUtils.copyArtifact( artifact );
+ if ( "pom".equals( artifact.getType() ) && file != null )
+ {
+ pomHash = file.getPath().hashCode() + file.lastModified();
+ }
+ else
+ {
+ pomHash = 0;
+ }
+ this.resolveManagedVersions = resolveManagedVersions;
+ this.repositories.add( localRepository );
+ this.repositories.addAll( remoteRepositories );
+
+ int hash = 17;
+ hash = hash * 31 + artifactHashCode( artifact );
+ hash = hash * 31 + ( resolveManagedVersions ? 1 : 2 );
+ hash = hash * 31 + repositoriesHashCode( repositories );
+ this.hashCode = hash;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( o == this )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof CacheKey ) )
+ {
+ return false;
+ }
+
+ CacheKey other = (CacheKey) o;
+
+ return pomHash == other.pomHash && artifactEquals( artifact, other.artifact )
+ && resolveManagedVersions == other.resolveManagedVersions
+ && repositoriesEquals( repositories, other.repositories );
+ }
+ }
+
+ private static int artifactHashCode( Artifact a )
+ {
+ int result = 17;
+ result = 31 * result + a.getGroupId().hashCode();
+ result = 31 * result + a.getArtifactId().hashCode();
+ result = 31 * result + a.getType().hashCode();
+ if ( a.getVersion() != null )
+ {
+ result = 31 * result + a.getVersion().hashCode();
+ }
+ result = 31 * result + ( a.getClassifier() != null ? a.getClassifier().hashCode() : 0 );
+ result = 31 * result + ( a.getScope() != null ? a.getScope().hashCode() : 0 );
+ result = 31 * result + ( a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0 );
+ result = 31 * result + ( a.isOptional() ? 1 : 0 );
+ return result;
+ }
+
+ private static boolean artifactEquals( Artifact a1, Artifact a2 )
+ {
+ if ( a1 == a2 )
+ {
+ return true;
+ }
+
+ return eq( a1.getGroupId(), a2.getGroupId() )
+ && eq( a1.getArtifactId(), a2.getArtifactId() )
+ && eq( a1.getType(), a2.getType() )
+ && eq( a1.getVersion(), a2.getVersion() )
+ && eq( a1.getClassifier(), a2.getClassifier() )
+ && eq( a1.getScope(), a2.getScope() )
+ && eq( a1.getDependencyFilter(), a2.getDependencyFilter() )
+ && a1.isOptional() == a2.isOptional();
+ }
+
+ private static int repositoryHashCode( ArtifactRepository repository )
+ {
+ int result = 17;
+ result = 31 * result + ( repository.getId() != null ? repository.getId().hashCode() : 0 );
+ return result;
+ }
+
+ private static int repositoriesHashCode( List<ArtifactRepository> repositories )
+ {
+ int result = 17;
+ for ( ArtifactRepository repository : repositories )
+ {
+ result = 31 * result + repositoryHashCode( repository );
+ }
+ return result;
+ }
+
+ private static boolean repositoryEquals( ArtifactRepository r1, ArtifactRepository r2 )
+ {
+ if ( r1 == r2 )
+ {
+ return true;
+ }
+
+ return eq( r1.getId(), r2.getId() ) && eq( r1.getUrl(), r2.getUrl() )
+ && repositoryPolicyEquals( r1.getReleases(), r2.getReleases() )
+ && repositoryPolicyEquals( r1.getSnapshots(), r2.getSnapshots() );
+ }
+
+ private static boolean repositoryPolicyEquals( ArtifactRepositoryPolicy p1, ArtifactRepositoryPolicy p2 )
+ {
+ if ( p1 == p2 )
+ {
+ return true;
+ }
+
+ return p1.isEnabled() == p2.isEnabled() && eq( p1.getUpdatePolicy(), p2.getUpdatePolicy() );
+ }
+
+ private static boolean repositoriesEquals( List<ArtifactRepository> r1, List<ArtifactRepository> r2 )
+ {
+ if ( r1.size() != r2.size() )
+ {
+ return false;
+ }
+
+ for ( Iterator<ArtifactRepository> it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); )
+ {
+ if ( !repositoryEquals( it1.next(), it2.next() ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private static <T> boolean eq( T s1, T s2 )
+ {
+ return s1 != null ? s1.equals( s2 ) : s2 == null;
+ }
+
+ public class CacheRecord
+ {
+ private Artifact pomArtifact;
+ private Artifact relocatedArtifact;
+ private List<Artifact> artifacts;
+ private Map<String, Artifact> managedVersions;
+ private List<ArtifactRepository> remoteRepositories;
+
+ private long length;
+ private long timestamp;
+
+ CacheRecord( Artifact pomArtifact, Artifact relocatedArtifact, Set<Artifact> artifacts,
+ Map<String, Artifact> managedVersions, List<ArtifactRepository> remoteRepositories )
+ {
+ this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact );
+ this.relocatedArtifact = ArtifactUtils.copyArtifactSafe( relocatedArtifact );
+ this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() );
+ this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
+
+ this.managedVersions = managedVersions;
+ if ( managedVersions != null )
+ {
+ this.managedVersions =
+ ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
+ }
+
+ File pomFile = pomArtifact.getFile();
+ if ( pomFile != null && pomFile.canRead() )
+ {
+ this.length = pomFile.length();
+ this.timestamp = pomFile.lastModified();
+ }
+ else
+ {
+ this.length = -1;
+ this.timestamp = -1;
+ }
+ }
+
+ public Artifact getArtifact()
+ {
+ return pomArtifact;
+ }
+
+ public Artifact getRelocatedArtifact()
+ {
+ return relocatedArtifact;
+ }
+
+ public List<Artifact> getArtifacts()
+ {
+ return artifacts;
+ }
+
+ public Map<String, Artifact> getManagedVersions()
+ {
+ return managedVersions;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ return remoteRepositories;
+ }
+
+ public boolean isStale()
+ {
+ File pomFile = pomArtifact.getFile();
+ if ( pomFile != null )
+ {
+ if ( pomFile.canRead() )
+ {
+ return length != pomFile.length() || timestamp != pomFile.lastModified();
+ }
+ else
+ {
+ // if the POM didn't exist, retry if any repo is configured to always update
+ boolean snapshot = pomArtifact.isSnapshot();
+ for ( ArtifactRepository repository : remoteRepositories )
+ {
+ ArtifactRepositoryPolicy policy =
+ snapshot ? repository.getSnapshots() : repository.getReleases();
+ if ( ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( policy.getUpdatePolicy() ) )
+ {
+ return true;
+ }
+ }
+ }
+ }
+
+ return length != -1 || timestamp != -1;
+ }
+ }
+
+
+ public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ {
+ CacheKey cacheKey = newCacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories );
+
+ CacheRecord cacheRecord = cache.get( cacheKey );
+
+ if ( cacheRecord != null && !cacheRecord.isStale() )
+ {
+ Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() );
+ Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe( cacheRecord.getRelocatedArtifact() );
+ Set<Artifact> artifacts =
+ ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() );
+ Map<String, Artifact> managedVersions = cacheRecord.getManagedVersions();
+ if ( managedVersions != null )
+ {
+ managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
+ }
+ return new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions,
+ cacheRecord.getRemoteRepositories() );
+ }
+
+ cache.remove( cacheKey );
+
+ return null;
+ }
+
+ public void put( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, ResolutionGroup result )
+ {
+ put( newCacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories ), result );
+ }
+
+ protected CacheKey newCacheKey( Artifact artifact, boolean resolveManagedVersions,
+ ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories )
+ {
+ return new CacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories );
+ }
+
+ protected void put( CacheKey cacheKey, ResolutionGroup result )
+ {
+ CacheRecord cacheRecord =
+ new CacheRecord( result.getPomArtifact(), result.getRelocatedArtifact(), result.getArtifacts(),
+ result.getManagedVersions(), result.getResolutionRepositories() );
+
+ cache.put( cacheKey, cacheRecord );
+ }
+
+ public void flush()
+ {
+ cache.clear();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java
new file mode 100644
index 00000000..91f665b5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java
@@ -0,0 +1,37 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.artifact.metadata.ArtifactMetadataSource;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * This realizes the metadata source via the default hint to provide backward-compat with Maven 2.x whose Plexus version
+ * registered component descriptors twice: once keyed by role+roleHint and once keyed by role only. This effectively
+ * made the metadata source available with its original role hint ("maven") as well as the default hint.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = ArtifactMetadataSource.class )
+public class DefaultMetadataSource
+ extends MavenMetadataSource
+{
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java
new file mode 100644
index 00000000..8a1de685
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/InvalidDependencyVersionException.java
@@ -0,0 +1,55 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.artifact.ArtifactUtils;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.project.InvalidProjectVersionException;
+
+/**
+ * Thrown if a dependency has an invalid version.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class InvalidDependencyVersionException
+ extends InvalidProjectVersionException
+{
+ private Dependency dependency;
+
+ public InvalidDependencyVersionException( String projectId, Dependency dependency, File pomFile,
+ InvalidVersionSpecificationException cause )
+ {
+ super( projectId, formatLocationInPom( dependency ), dependency.getVersion(), pomFile, cause );
+ this.dependency = dependency;
+ }
+
+ private static String formatLocationInPom( Dependency dependency )
+ {
+ return "Dependency: " + ArtifactUtils.versionlessKey( dependency.getGroupId(), dependency.getArtifactId() );
+ }
+
+ public Dependency getDependency()
+ {
+ return dependency;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java
new file mode 100644
index 00000000..036ee86c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java
@@ -0,0 +1,38 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+
+public interface MavenMetadataCache
+{
+
+ ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories );
+
+ void put( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, ResolutionGroup result );
+
+ void flush();
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
new file mode 100644
index 00000000..1fb5c545
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
@@ -0,0 +1,770 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.metadata.ResolutionGroup;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.Metadata;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+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.Relocation;
+import org.apache.maven.model.building.ModelBuildingException;
+import org.apache.maven.model.building.ModelBuildingRequest;
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.model.resolution.UnresolvableModelException;
+import org.apache.maven.plugin.LegacySupport;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.properties.internal.EnvironmentUtils;
+import org.apache.maven.properties.internal.SystemProperties;
+import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest;
+import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.logging.Logger;
+import org.eclipse.aether.RepositorySystemSession;
+import org.eclipse.aether.repository.RepositoryPolicy;
+import org.eclipse.aether.transfer.ArtifactNotFoundException;
+
+/**
+ * @author Jason van Zyl
+ */
+@Component( role = ArtifactMetadataSource.class, hint = "maven" )
+public class MavenMetadataSource
+ implements ArtifactMetadataSource
+{
+ @Requirement
+ private RepositoryMetadataManager repositoryMetadataManager;
+
+ @Requirement
+ private ArtifactFactory repositorySystem;
+
+ //TODO: This prevents a cycle in the composition which shows us another problem we need to deal with.
+ //@Requirement
+ private ProjectBuilder projectBuilder;
+
+ @Requirement
+ private PlexusContainer container;
+
+ @Requirement
+ private Logger logger;
+
+ @Requirement
+ private MavenMetadataCache cache;
+
+ @Requirement
+ private LegacySupport legacySupport;
+
+ private void injectSession( MetadataResolutionRequest request )
+ {
+ RepositorySystemSession session = legacySupport.getRepositorySession();
+
+ if ( session != null )
+ {
+ request.setOffline( session.isOffline() );
+ request.setForceUpdate( RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals( session.getUpdatePolicy() ) );
+ }
+ }
+
+ public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException
+ {
+ return retrieve( artifact, localRepository, remoteRepositories, false );
+ }
+
+ public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories, boolean resolveManagedVersions )
+ throws ArtifactMetadataRetrievalException
+ {
+ MetadataResolutionRequest request = new DefaultMetadataResolutionRequest();
+ injectSession( request );
+ request.setArtifact( artifact );
+ request.setLocalRepository( localRepository );
+ request.setRemoteRepositories( remoteRepositories );
+ request.setResolveManagedVersions( resolveManagedVersions );
+ return retrieve( request );
+ }
+
+ public ResolutionGroup retrieve( MetadataResolutionRequest request )
+ throws ArtifactMetadataRetrievalException
+ {
+ Artifact artifact = request.getArtifact();
+
+ //
+ // If we have a system scoped artifact then we do not want any searching in local or remote repositories
+ // and we want artifact resolution to only return the system scoped artifact itself.
+ //
+ if ( artifact.getScope() != null && artifact.getScope().equals( Artifact.SCOPE_SYSTEM ) )
+ {
+ return new ResolutionGroup( null, null, null );
+ }
+
+ ResolutionGroup cached =
+ cache.get( artifact, request.isResolveManagedVersions(), request.getLocalRepository(),
+ request.getRemoteRepositories() );
+
+ if ( cached != null
+ // if the POM has no file, we cached a missing artifact, only return the cached data if no update forced
+ && ( !request.isForceUpdate() || hasFile( cached.getPomArtifact() ) ) )
+ {
+ return cached;
+ }
+
+ List<Dependency> dependencies;
+
+ List<Dependency> managedDependencies = null;
+
+ List<ArtifactRepository> pomRepositories = null;
+
+ Artifact pomArtifact;
+
+ Artifact relocatedArtifact = null;
+
+ //TODO: Not even sure this is really required as the project will be cached in the builder, we'll see this
+ // is currently the biggest hotspot
+ if ( artifact instanceof ArtifactWithDependencies )
+ {
+ pomArtifact = artifact;
+
+ dependencies = ( (ArtifactWithDependencies) artifact ).getDependencies();
+
+ managedDependencies = ( (ArtifactWithDependencies) artifact ).getManagedDependencies();
+ }
+ else
+ {
+ ProjectRelocation rel = retrieveRelocatedProject( artifact, request );
+
+ if ( rel == null )
+ {
+ return null;
+ }
+
+ pomArtifact = rel.pomArtifact;
+
+ relocatedArtifact = rel.relocatedArtifact;
+
+ if ( rel.project == null )
+ {
+ // When this happens we have a Maven 1.x POM, or some invalid POM.
+ // It should have never found its way into Maven 2.x repository but it did.
+ dependencies = Collections.emptyList();
+ }
+ else
+ {
+ dependencies = rel.project.getDependencies();
+
+ DependencyManagement depMngt = rel.project.getDependencyManagement();
+ managedDependencies = ( depMngt != null ) ? depMngt.getDependencies() : null;
+
+ pomRepositories = rel.project.getRemoteArtifactRepositories();
+ }
+ }
+
+ Set<Artifact> artifacts = Collections.<Artifact>emptySet();
+
+ if ( !artifact.getArtifactHandler().isIncludesDependencies() )
+ {
+ artifacts = new LinkedHashSet<Artifact>();
+
+ for ( Dependency dependency : dependencies )
+ {
+ Artifact dependencyArtifact = createDependencyArtifact( dependency, artifact, pomArtifact );
+
+ if ( dependencyArtifact != null )
+ {
+ artifacts.add( dependencyArtifact );
+ }
+ }
+ }
+
+ Map<String, Artifact> managedVersions = null;
+
+ if ( managedDependencies != null && request.isResolveManagedVersions() )
+ {
+ managedVersions = new HashMap<String, Artifact>();
+
+ for ( Dependency managedDependency : managedDependencies )
+ {
+ Artifact managedArtifact = createDependencyArtifact( managedDependency, null, pomArtifact );
+
+ managedVersions.put( managedDependency.getManagementKey(), managedArtifact );
+ }
+ }
+
+ List<ArtifactRepository> aggregatedRepositories =
+ aggregateRepositories( request.getRemoteRepositories(), pomRepositories );
+
+ ResolutionGroup result =
+ new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions, aggregatedRepositories );
+
+ cache.put( artifact, request.isResolveManagedVersions(), request.getLocalRepository(),
+ request.getRemoteRepositories(), result );
+
+ return result;
+ }
+
+ private boolean hasFile( Artifact artifact )
+ {
+ return artifact != null && artifact.getFile() != null && artifact.getFile().exists();
+ }
+
+ private List<ArtifactRepository> aggregateRepositories( List<ArtifactRepository> requestRepositories,
+ List<ArtifactRepository> pomRepositories )
+ {
+ List<ArtifactRepository> repositories = requestRepositories;
+
+ if ( pomRepositories != null && !pomRepositories.isEmpty() )
+ {
+ Map<String, ArtifactRepository> repos = new LinkedHashMap<String, ArtifactRepository>();
+
+ for ( ArtifactRepository repo : requestRepositories )
+ {
+ if ( !repos.containsKey( repo.getId() ) )
+ {
+ repos.put( repo.getId(), repo );
+ }
+ }
+
+ for ( ArtifactRepository repo : pomRepositories )
+ {
+ if ( !repos.containsKey( repo.getId() ) )
+ {
+ repos.put( repo.getId(), repo );
+ }
+ }
+
+ repositories = new ArrayList<ArtifactRepository>( repos.values() );
+ }
+
+ return repositories;
+ }
+
+ private Artifact createDependencyArtifact( Dependency dependency, Artifact owner, Artifact pom )
+ throws ArtifactMetadataRetrievalException
+ {
+ try
+ {
+ String inheritedScope = ( owner != null ) ? owner.getScope() : null;
+
+ ArtifactFilter inheritedFilter = ( owner != null ) ? owner.getDependencyFilter() : null;
+
+ return createDependencyArtifact( repositorySystem, dependency, inheritedScope, inheritedFilter );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new ArtifactMetadataRetrievalException( "Invalid version for dependency "
+ + dependency.getManagementKey() + ": " + e.getMessage(), e, pom );
+ }
+ }
+
+ private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency,
+ String inheritedScope, ArtifactFilter inheritedFilter )
+ throws InvalidVersionSpecificationException
+ {
+ String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope );
+
+ if ( effectiveScope == null )
+ {
+ return null;
+ }
+
+ VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
+
+ Artifact dependencyArtifact =
+ factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
+ dependency.getType(), dependency.getClassifier(), effectiveScope,
+ dependency.isOptional() );
+
+ ArtifactFilter dependencyFilter = inheritedFilter;
+
+ if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) )
+ {
+ return null;
+ }
+
+ if ( Artifact.SCOPE_SYSTEM.equals( effectiveScope ) )
+ {
+ dependencyArtifact.setFile( new File( dependency.getSystemPath() ) );
+ }
+
+ dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) );
+
+ return dependencyArtifact;
+ }
+
+ private static String getEffectiveScope( String originalScope, String inheritedScope )
+ {
+ String effectiveScope = Artifact.SCOPE_RUNTIME;
+
+ if ( originalScope == null )
+ {
+ originalScope = Artifact.SCOPE_COMPILE;
+ }
+
+ if ( inheritedScope == null )
+ {
+ // direct dependency retains its scope
+ effectiveScope = originalScope;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( originalScope ) || Artifact.SCOPE_PROVIDED.equals( originalScope ) )
+ {
+ // test and provided are not transitive, so exclude them
+ effectiveScope = null;
+ }
+ else if ( Artifact.SCOPE_SYSTEM.equals( originalScope ) )
+ {
+ // system scope come through unchanged...
+ effectiveScope = Artifact.SCOPE_SYSTEM;
+ }
+ else if ( Artifact.SCOPE_COMPILE.equals( originalScope ) && Artifact.SCOPE_COMPILE.equals( inheritedScope ) )
+ {
+ // added to retain compile scope. Remove if you want compile inherited as runtime
+ effectiveScope = Artifact.SCOPE_COMPILE;
+ }
+ else if ( Artifact.SCOPE_TEST.equals( inheritedScope ) )
+ {
+ effectiveScope = Artifact.SCOPE_TEST;
+ }
+ else if ( Artifact.SCOPE_PROVIDED.equals( inheritedScope ) )
+ {
+ effectiveScope = Artifact.SCOPE_PROVIDED;
+ }
+
+ return effectiveScope;
+ }
+
+ private static ArtifactFilter createDependencyFilter( Dependency dependency, ArtifactFilter inheritedFilter )
+ {
+ ArtifactFilter effectiveFilter = inheritedFilter;
+
+ if ( !dependency.getExclusions().isEmpty() )
+ {
+ List<String> exclusions = new ArrayList<String>();
+
+ for ( Exclusion e : dependency.getExclusions() )
+ {
+ exclusions.add( e.getGroupId() + ':' + e.getArtifactId() );
+ }
+
+ effectiveFilter = new ExcludesArtifactFilter( exclusions );
+
+ if ( inheritedFilter != null )
+ {
+ effectiveFilter = new AndArtifactFilter( Arrays.asList( inheritedFilter, effectiveFilter ) );
+ }
+ }
+
+ return effectiveFilter;
+ }
+
+ public List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException
+ {
+ MetadataResolutionRequest request = new DefaultMetadataResolutionRequest();
+ injectSession( request );
+ request.setArtifact( artifact );
+ request.setLocalRepository( localRepository );
+ request.setRemoteRepositories( remoteRepositories );
+ return retrieveAvailableVersions( request );
+ }
+
+ public List<ArtifactVersion> retrieveAvailableVersions( MetadataResolutionRequest request )
+ throws ArtifactMetadataRetrievalException
+ {
+ RepositoryMetadata metadata = new ArtifactRepositoryMetadata( request.getArtifact() );
+
+ try
+ {
+ repositoryMetadataManager.resolve( metadata, request );
+ }
+ catch ( RepositoryMetadataResolutionException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, request.getArtifact() );
+ }
+
+ List<String> availableVersions = request.getLocalRepository().findVersions( request.getArtifact() );
+
+ return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions );
+ }
+
+ public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
+ ArtifactRepository localRepository,
+ ArtifactRepository deploymentRepository )
+ throws ArtifactMetadataRetrievalException
+ {
+ RepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
+
+ try
+ {
+ repositoryMetadataManager.resolveAlways( metadata, localRepository, deploymentRepository );
+ }
+ catch ( RepositoryMetadataResolutionException e )
+ {
+ throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
+ }
+
+ List<String> availableVersions = localRepository.findVersions( artifact );
+
+ return retrieveAvailableVersionsFromMetadata( metadata.getMetadata(), availableVersions );
+ }
+
+ private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata( Metadata repoMetadata,
+ List<String> availableVersions )
+ {
+ Collection<String> versions = new LinkedHashSet<String>();
+
+ if ( ( repoMetadata != null ) && ( repoMetadata.getVersioning() != null ) )
+ {
+ versions.addAll( repoMetadata.getVersioning().getVersions() );
+ }
+
+ versions.addAll( availableVersions );
+
+ List<ArtifactVersion> artifactVersions = new ArrayList<ArtifactVersion>( versions.size() );
+
+ for ( String version : versions )
+ {
+ artifactVersions.add( new DefaultArtifactVersion( version ) );
+ }
+
+ return artifactVersions;
+ }
+
+ // USED BY MAVEN ASSEMBLY PLUGIN
+ @Deprecated
+ public static Set<Artifact> createArtifacts( ArtifactFactory artifactFactory, List<Dependency> dependencies,
+ String inheritedScope, ArtifactFilter dependencyFilter,
+ MavenProject project )
+ throws InvalidDependencyVersionException
+ {
+ Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
+
+ for ( Dependency d : dependencies )
+ {
+ Artifact dependencyArtifact;
+ try
+ {
+ dependencyArtifact = createDependencyArtifact( artifactFactory, d, inheritedScope, dependencyFilter );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new InvalidDependencyVersionException( project.getId(), d, project.getFile(), e );
+ }
+
+ if ( dependencyArtifact != null )
+ {
+ artifacts.add( dependencyArtifact );
+ }
+ }
+
+ return artifacts;
+ }
+
+ private ProjectBuilder getProjectBuilder()
+ {
+ if ( projectBuilder != null )
+ {
+ return projectBuilder;
+ }
+
+ try
+ {
+ projectBuilder = container.lookup( ProjectBuilder.class );
+ }
+ catch ( ComponentLookupException e )
+ {
+ // Won't happen
+ }
+
+ return projectBuilder;
+ }
+
+ private ProjectRelocation retrieveRelocatedProject( Artifact artifact, MetadataResolutionRequest repositoryRequest )
+ throws ArtifactMetadataRetrievalException
+ {
+ MavenProject project;
+
+ Artifact pomArtifact;
+ Artifact relocatedArtifact = null;
+ boolean done = false;
+ do
+ {
+ project = null;
+
+ pomArtifact =
+ repositorySystem.createProjectArtifact( artifact.getGroupId(),
+ artifact.getArtifactId(),
+ artifact.getVersion(), artifact.getScope() );
+
+ if ( "pom".equals( artifact.getType() ) )
+ {
+ pomArtifact.setFile( artifact.getFile() );
+ }
+
+ if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+ {
+ done = true;
+ }
+ else
+ {
+ try
+ {
+ ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
+ configuration.setLocalRepository( repositoryRequest.getLocalRepository() );
+ configuration.setRemoteRepositories( repositoryRequest.getRemoteRepositories() );
+ configuration.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
+ configuration.setProcessPlugins( false );
+ configuration.setRepositoryMerging( ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT );
+ configuration.setSystemProperties( getSystemProperties() );
+ configuration.setRepositorySession( legacySupport.getRepositorySession() );
+
+ project = getProjectBuilder().build( pomArtifact, configuration ).getProject();
+ }
+ catch ( ProjectBuildingException e )
+ {
+ ModelProblem missingParentPom = hasMissingParentPom( e );
+ if ( missingParentPom != null )
+ {
+ throw new ArtifactMetadataRetrievalException( "Failed to process POM for "
+ + artifact.getId() + ": " + missingParentPom.getMessage(),
+ missingParentPom.getException(),
+ artifact );
+ }
+
+ String message;
+
+ if ( isMissingPom( e ) )
+ {
+ message = "Missing POM for " + artifact.getId();
+ }
+ else if ( isNonTransferrablePom( e ) )
+ {
+ throw new ArtifactMetadataRetrievalException( "Failed to retrieve POM for "
+ + artifact.getId() + ": " + e.getCause().getMessage(), e.getCause(),
+ artifact );
+ }
+ else
+ {
+ message =
+ "Invalid POM for " + artifact.getId()
+ + ", transitive dependencies (if any) will not be available"
+ + ", enable debug logging for more details";
+ }
+
+ if ( logger.isDebugEnabled() )
+ {
+ message += ": " + e.getMessage();
+ }
+
+ logger.warn( message );
+ }
+
+ if ( project != null )
+ {
+ Relocation relocation = null;
+
+ DistributionManagement distMgmt = project.getDistributionManagement();
+ if ( distMgmt != null )
+ {
+ relocation = distMgmt.getRelocation();
+
+ artifact.setDownloadUrl( distMgmt.getDownloadUrl() );
+ pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
+ }
+
+ if ( relocation != null )
+ {
+ if ( relocation.getGroupId() != null )
+ {
+ artifact.setGroupId( relocation.getGroupId() );
+ relocatedArtifact = artifact;
+ project.setGroupId( relocation.getGroupId() );
+ }
+ if ( relocation.getArtifactId() != null )
+ {
+ artifact.setArtifactId( relocation.getArtifactId() );
+ relocatedArtifact = artifact;
+ project.setArtifactId( relocation.getArtifactId() );
+ }
+ if ( relocation.getVersion() != null )
+ {
+ // note: see MNG-3454. This causes a problem, but fixing it may break more.
+ artifact.setVersionRange( VersionRange.createFromVersion( relocation.getVersion() ) );
+ relocatedArtifact = artifact;
+ project.setVersion( relocation.getVersion() );
+ }
+
+ if ( artifact.getDependencyFilter() != null
+ && !artifact.getDependencyFilter().include( artifact ) )
+ {
+ return null;
+ }
+
+ // MNG-2861: the artifact data has changed. If the available versions where previously
+ // retrieved, we need to update it.
+ // TODO: shouldn't the versions be merged across relocations?
+ List<ArtifactVersion> available = artifact.getAvailableVersions();
+ if ( available != null && !available.isEmpty() )
+ {
+ MetadataResolutionRequest metadataRequest =
+ new DefaultMetadataResolutionRequest( repositoryRequest );
+ metadataRequest.setArtifact( artifact );
+ available = retrieveAvailableVersions( metadataRequest );
+ artifact.setAvailableVersions( available );
+ }
+
+ String message =
+ "\n This artifact has been relocated to " + artifact.getGroupId() + ":"
+ + artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n";
+
+ if ( relocation.getMessage() != null )
+ {
+ message += " " + relocation.getMessage() + "\n";
+ }
+
+ if ( artifact.getDependencyTrail() != null && artifact.getDependencyTrail().size() == 1 )
+ {
+ logger.warn( "While downloading " + pomArtifact.getGroupId() + ":"
+ + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );
+ }
+ else
+ {
+ logger.debug( "While downloading " + pomArtifact.getGroupId() + ":"
+ + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n" );
+ }
+ }
+ else
+ {
+ done = true;
+ }
+ }
+ else
+ {
+ done = true;
+ }
+ }
+ }
+ while ( !done );
+
+ ProjectRelocation rel = new ProjectRelocation();
+ rel.project = project;
+ rel.pomArtifact = pomArtifact;
+ rel.relocatedArtifact = relocatedArtifact;
+
+ return rel;
+ }
+
+ private ModelProblem hasMissingParentPom( ProjectBuildingException e )
+ {
+ if ( e.getCause() instanceof ModelBuildingException )
+ {
+ ModelBuildingException mbe = (ModelBuildingException) e.getCause();
+ for ( ModelProblem problem : mbe.getProblems() )
+ {
+ if ( problem.getException() instanceof UnresolvableModelException )
+ {
+ return problem;
+ }
+ }
+
+ }
+ return null;
+ }
+
+ private boolean isMissingPom( Exception e )
+ {
+ if ( e.getCause() instanceof MultipleArtifactsNotFoundException )
+ {
+ return true;
+ }
+ return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
+ && e.getCause().getCause() instanceof ArtifactNotFoundException;
+ }
+
+ private boolean isNonTransferrablePom( Exception e )
+ {
+ if ( e.getCause() instanceof ArtifactResolutionException )
+ {
+ return true;
+ }
+ return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
+ && !( e.getCause().getCause() instanceof ArtifactNotFoundException );
+ }
+
+ private Properties getSystemProperties()
+ {
+ Properties props = new Properties();
+
+ EnvironmentUtils.addEnvVars( props );
+
+ SystemProperties.addSystemProperties( props );
+
+ return props;
+ }
+
+ private static final class ProjectRelocation
+ {
+ private MavenProject project;
+
+ private Artifact pomArtifact;
+
+ private Artifact relocatedArtifact;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java
new file mode 100644
index 00000000..d348d59c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/PluginArtifact.java
@@ -0,0 +1,94 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+
+public class PluginArtifact
+ extends DefaultArtifact
+ implements ArtifactWithDependencies
+{
+ private Plugin plugin;
+
+ public PluginArtifact( Plugin plugin, Artifact pluginArtifact )
+ {
+ super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null,
+ new PluginArtifactHandler() );
+ this.plugin = plugin;
+ setFile( pluginArtifact.getFile() );
+ setResolved( true );
+ }
+
+ public List<Dependency> getDependencies()
+ {
+ return plugin.getDependencies();
+ }
+
+ public List<Dependency> getManagedDependencies()
+ {
+ return Collections.emptyList();
+ }
+
+ static class PluginArtifactHandler
+ implements ArtifactHandler
+ {
+ public String getClassifier()
+ {
+ return null;
+ }
+
+ public String getDirectory()
+ {
+ return null;
+ }
+
+ public String getExtension()
+ {
+ return "jar";
+ }
+
+ public String getLanguage()
+ {
+ return "none";
+ }
+
+ public String getPackaging()
+ {
+ return "maven-plugin";
+ }
+
+ public boolean isAddedToClasspath()
+ {
+ return true;
+ }
+
+ public boolean isIncludesDependencies()
+ {
+ return false;
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
new file mode 100644
index 00000000..1d4a2a31
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
@@ -0,0 +1,100 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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.List;
+
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.project.MavenProject;
+
+public class ProjectArtifact
+ extends DefaultArtifact
+ implements ArtifactWithDependencies
+{
+ private MavenProject project;
+
+ public ProjectArtifact( MavenProject project )
+ {
+ super( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, "pom", null,
+ new PomArtifactHandler() );
+ this.project = project;
+ setFile( project.getFile() );
+ setResolved( true );
+ }
+
+ public MavenProject getProject()
+ {
+ return project;
+ }
+
+ public List<Dependency> getDependencies()
+ {
+ return project.getDependencies();
+ }
+
+ public List<Dependency> getManagedDependencies()
+ {
+ DependencyManagement depMngt = project.getDependencyManagement();
+ return ( depMngt != null ) ? depMngt.getDependencies() : Collections.<Dependency>emptyList();
+ }
+
+ static class PomArtifactHandler
+ implements ArtifactHandler
+ {
+ public String getClassifier()
+ {
+ return null;
+ }
+
+ public String getDirectory()
+ {
+ return null;
+ }
+
+ public String getExtension()
+ {
+ return "pom";
+ }
+
+ public String getLanguage()
+ {
+ return "none";
+ }
+
+ public String getPackaging()
+ {
+ return "pom";
+ }
+
+ public boolean isAddedToClasspath()
+ {
+ return false;
+ }
+
+ public boolean isIncludesDependencies()
+ {
+ return false;
+ }
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
new file mode 100644
index 00000000..7ea99bf0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java
@@ -0,0 +1,130 @@
+package org.apache.maven.project.artifact;
+
+/*
+ * 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 org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.AbstractArtifactMetadata;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Attach a POM to an artifact.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ProjectArtifactMetadata
+ extends AbstractArtifactMetadata
+{
+ private final File file;
+
+ public ProjectArtifactMetadata( Artifact artifact )
+ {
+ this( artifact, null );
+ }
+
+ public ProjectArtifactMetadata( Artifact artifact, File file )
+ {
+ super( artifact );
+ this.file = file;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public String getRemoteFilename()
+ {
+ return getFilename();
+ }
+
+ public String getLocalFilename( ArtifactRepository repository )
+ {
+ return getFilename();
+ }
+
+ private String getFilename()
+ {
+ return getArtifactId() + "-" + artifact.getVersion() + ".pom";
+ }
+
+ public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository )
+ throws RepositoryMetadataStoreException
+ {
+ File destination =
+ new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this,
+ remoteRepository ) );
+
+ // ----------------------------------------------------------------------------
+ // I'm fully aware that the file could just be moved using File.rename but
+ // there are bugs in various JVM that have problems doing this across
+ // different filesystem. So we'll incur the small hit to actually copy
+ // here and be safe. jvz.
+ // ----------------------------------------------------------------------------
+
+ try
+ {
+ FileUtils.copyFile( file, destination );
+ }
+ catch ( IOException e )
+ {
+ throw new RepositoryMetadataStoreException( "Error copying POM to the local repository.", e );
+ }
+ }
+
+ public String toString()
+ {
+ return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();
+ }
+
+ public boolean storedInArtifactVersionDirectory()
+ {
+ return true;
+ }
+
+ public String getBaseVersion()
+ {
+ return artifact.getBaseVersion();
+ }
+
+ public Object getKey()
+ {
+ return "project " + artifact.getGroupId() + ":" + artifact.getArtifactId();
+ }
+
+ public void merge( ArtifactMetadata metadata )
+ {
+ ProjectArtifactMetadata m = (ProjectArtifactMetadata) metadata;
+ if ( !m.file.equals( file ) )
+ {
+ throw new IllegalStateException( "Cannot add two different pieces of metadata for: " + getKey() );
+ }
+ }
+
+ public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata )
+ {
+ this.merge( (ArtifactMetadata) metadata );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java
new file mode 100644
index 00000000..18e349ac
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/project/path/PathTranslator.java
@@ -0,0 +1,41 @@
+package org.apache.maven.project.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;
+
+/**
+ * @author Jason van Zyl
+ */
+@Deprecated
+public interface PathTranslator
+{
+ String ROLE = PathTranslator.class.getName();
+
+ void alignToBaseDirectory( Model model, File basedir );
+
+ String alignToBaseDirectory( String path, File basedir );
+
+ void unalignFromBaseDirectory( Model model, File basedir );
+
+ String unalignFromBaseDirectory( String directory, File basedir );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java
new file mode 100644
index 00000000..2c3196fb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/EnvironmentUtils.java
@@ -0,0 +1,70 @@
+package org.apache.maven.properties.internal;
+
+/*
+ * 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.Locale;
+import java.util.Map;
+import java.util.Properties;
+
+import org.codehaus.plexus.util.Os;
+
+/**
+ * Assists the project builder. <strong>Warning:</strong> This is an internal utility class that is only public for
+ * technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without
+ * prior notice.
+ *
+ * @since 3.0
+ * @author Benjamin Bentmann
+ */
+public class EnvironmentUtils
+{
+
+ private static Properties envVars;
+
+ /**
+ * Adds the environment variables in the form of properties whose keys are prefixed with {@code env.}, e.g. {@code
+ * env.PATH}. Unlike native environment variables, properties are always case-sensitive. For the sake of
+ * determinism, the environment variable names will be normalized to upper case on platforms with case-insensitive
+ * variable lookup.
+ *
+ * @param props The properties to add the environment variables to, may be {@code null}.
+ */
+ public static void addEnvVars( Properties props )
+ {
+ if ( props != null )
+ {
+ if ( envVars == null )
+ {
+ Properties tmp = new Properties();
+ boolean caseSensitive = !Os.isFamily( Os.FAMILY_WINDOWS );
+ for ( Map.Entry<String, String> entry : System.getenv().entrySet() )
+ {
+ String key =
+ "env." + ( caseSensitive ? entry.getKey() : entry.getKey().toUpperCase( Locale.ENGLISH ) );
+ tmp.setProperty( key, entry.getValue() );
+ }
+ envVars = tmp;
+ }
+
+ props.putAll( envVars );
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java
new file mode 100644
index 00000000..608df2dc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java
@@ -0,0 +1,51 @@
+package org.apache.maven.properties.internal;
+
+/*
+ * 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.Properties;
+
+/**
+ * @since 3.2.3
+ */
+public class SystemProperties
+{
+ /**
+ * Thread-safe System.properties copy implementation.
+ *
+ * @see http://jira.codehaus.org/browse/MNG-5670
+ */
+ public static void addSystemProperties( Properties props )
+ {
+ for ( String key : System.getProperties().stringPropertyNames() )
+ {
+ props.put( key, System.getProperty( key ) );
+ }
+ }
+
+ /**
+ * Returns System.properties copy.
+ */
+ public static Properties getSystemProperties()
+ {
+ Properties systemProperties = new Properties();
+ addSystemProperties( systemProperties );
+ return systemProperties;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java
new file mode 100644
index 00000000..296f4ea5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java
@@ -0,0 +1,34 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.
+ */
+
+public class ArtifactDoesNotExistException
+ extends Exception
+{
+ public ArtifactDoesNotExistException( final String message )
+ {
+ super( message );
+ }
+
+ public ArtifactDoesNotExistException( final String message, final Throwable cause )
+ {
+ super( message, cause );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java
new file mode 100644
index 00000000..80189e7b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java
@@ -0,0 +1,343 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.EventObject;
+
+/**
+ * TransferEvent is used to notify TransferListeners about progress
+ * in transfer of resources form/to the repository
+ *
+ * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
+ */
+public class ArtifactTransferEvent
+ extends EventObject
+{
+ /**
+ * A transfer was attempted, but has not yet commenced.
+ */
+ public static final int TRANSFER_INITIATED = 0;
+
+ /**
+ * A transfer was started.
+ */
+ public static final int TRANSFER_STARTED = 1;
+
+ /**
+ * A transfer is completed.
+ */
+ public static final int TRANSFER_COMPLETED = 2;
+
+ /**
+ * A transfer is in progress.
+ */
+ public static final int TRANSFER_PROGRESS = 3;
+
+ /**
+ * An error occurred during transfer
+ */
+ public static final int TRANSFER_ERROR = 4;
+
+ /**
+ * Indicates GET transfer (from the repository)
+ */
+ public static final int REQUEST_GET = 5;
+
+ /**
+ * Indicates PUT transfer (to the repository)
+ */
+ public static final int REQUEST_PUT = 6;
+
+ private int eventType;
+
+ private int requestType;
+
+ private Exception exception;
+
+ private File localFile;
+
+ private ArtifactTransferResource artifact;
+
+ private long transferredBytes;
+
+ private byte[] dataBuffer;
+
+ private int dataOffset;
+
+ private int dataLength;
+
+ public ArtifactTransferEvent( String wagon, final int eventType, final int requestType,
+ ArtifactTransferResource artifact )
+ {
+ super( wagon );
+
+ setEventType( eventType );
+
+ setRequestType( requestType );
+
+ this.artifact = artifact;
+ }
+
+ public ArtifactTransferEvent( String wagon, final Exception exception, final int requestType,
+ ArtifactTransferResource artifact )
+ {
+ this( wagon, TRANSFER_ERROR, requestType, artifact );
+
+ this.exception = exception;
+ }
+
+ public ArtifactTransferResource getResource()
+ {
+ return artifact;
+ }
+
+ /**
+ * @return Returns the exception.
+ */
+ public Exception getException()
+ {
+ return exception;
+ }
+
+ /**
+ * Returns the request type.
+ *
+ * @return Returns the request type. The Request type is one of
+ * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>
+ */
+ public int getRequestType()
+ {
+ return requestType;
+ }
+
+ /**
+ * Sets the request type
+ *
+ * @param requestType The requestType to set.
+ * The Request type value should be either
+ * <code>TransferEvent.REQUEST_GET<code> or <code>TransferEvent.REQUEST_PUT<code>.
+ * @throws IllegalArgumentException when
+ */
+ public void setRequestType( final int requestType )
+ {
+ switch ( requestType )
+ {
+
+ case REQUEST_PUT:
+ break;
+ case REQUEST_GET:
+ break;
+
+ default :
+ throw new IllegalArgumentException( "Illegal request type: " + requestType );
+ }
+
+ this.requestType = requestType;
+ }
+
+ /**
+ * @return Returns the eventType.
+ */
+ public int getEventType()
+ {
+ return eventType;
+ }
+
+ /**
+ * @param eventType The eventType to set.
+ */
+ public void setEventType( final int eventType )
+ {
+ switch ( eventType )
+ {
+
+ case TRANSFER_INITIATED:
+ break;
+ case TRANSFER_STARTED:
+ break;
+ case TRANSFER_COMPLETED:
+ break;
+ case TRANSFER_PROGRESS:
+ break;
+ case TRANSFER_ERROR:
+ break;
+ default :
+ throw new IllegalArgumentException( "Illegal event type: " + eventType );
+ }
+
+ this.eventType = eventType;
+ }
+
+ /**
+ * @return Returns the local file.
+ */
+ public File getLocalFile()
+ {
+ return localFile;
+ }
+
+ /**
+ * @param localFile The local file to set.
+ */
+ public void setLocalFile( File localFile )
+ {
+ this.localFile = localFile;
+ }
+
+ public long getTransferredBytes()
+ {
+ return transferredBytes;
+ }
+
+ public void setTransferredBytes( long transferredBytes )
+ {
+ this.transferredBytes = transferredBytes;
+ }
+
+ public byte[] getDataBuffer()
+ {
+ return dataBuffer;
+ }
+
+ public void setDataBuffer( byte[] dataBuffer )
+ {
+ this.dataBuffer = dataBuffer;
+ }
+
+ public int getDataOffset()
+ {
+ return dataOffset;
+ }
+
+ public void setDataOffset( int dataOffset )
+ {
+ this.dataOffset = dataOffset;
+ }
+
+ public int getDataLength()
+ {
+ return dataLength;
+ }
+
+ public void setDataLength( int dataLength )
+ {
+ this.dataLength = dataLength;
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( "TransferEvent[" );
+
+ switch ( this.getRequestType() )
+ {
+ case REQUEST_GET:
+ sb.append( "GET" );
+ break;
+ case REQUEST_PUT:
+ sb.append( "PUT" );
+ break;
+ default:
+ sb.append( this.getRequestType() );
+ break;
+ }
+
+ sb.append( "|" );
+ switch ( this.getEventType() )
+ {
+ case TRANSFER_COMPLETED:
+ sb.append( "COMPLETED" );
+ break;
+ case TRANSFER_ERROR:
+ sb.append( "ERROR" );
+ break;
+ case TRANSFER_INITIATED:
+ sb.append( "INITIATED" );
+ break;
+ case TRANSFER_PROGRESS:
+ sb.append( "PROGRESS" );
+ break;
+ case TRANSFER_STARTED:
+ sb.append( "STARTED" );
+ break;
+ default:
+ sb.append( this.getEventType() );
+ break;
+ }
+
+ sb.append( "|" );
+ sb.append( this.getLocalFile() ).append( "|" );
+ sb.append( "]" );
+
+ return sb.toString();
+ }
+
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + eventType;
+ result = prime * result + ( ( exception == null ) ? 0 : exception.hashCode() );
+ result = prime * result + ( ( localFile == null ) ? 0 : localFile.hashCode() );
+ result = prime * result + requestType;
+ return result;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( ( obj == null ) || ( getClass() != obj.getClass() ) )
+ {
+ return false;
+ }
+ final ArtifactTransferEvent other = (ArtifactTransferEvent) obj;
+ if ( eventType != other.eventType )
+ {
+ return false;
+ }
+ if ( exception == null )
+ {
+ if ( other.exception != null )
+ {
+ return false;
+ }
+ }
+ else if ( !exception.getClass().equals( other.exception.getClass() ) )
+ {
+ return false;
+ }
+ if ( requestType != other.requestType )
+ {
+ return false;
+ }
+ else if ( !source.equals( other.source ) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java
new file mode 100644
index 00000000..9315f4c7
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java
@@ -0,0 +1,35 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.
+ */
+
+public class ArtifactTransferFailedException
+ extends Exception
+{
+ public ArtifactTransferFailedException( final String message )
+ {
+ super( message );
+ }
+
+ public ArtifactTransferFailedException( final String message, final Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java
new file mode 100644
index 00000000..72a56cf0
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java
@@ -0,0 +1,36 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.
+ */
+
+public interface ArtifactTransferListener
+{
+ boolean isShowChecksumEvents();
+
+ void setShowChecksumEvents( boolean showChecksumEvents );
+
+ void transferInitiated( ArtifactTransferEvent transferEvent );
+
+ void transferStarted( ArtifactTransferEvent transferEvent );
+
+ void transferProgress( ArtifactTransferEvent transferEvent );
+
+ void transferCompleted( ArtifactTransferEvent transferEvent );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java
new file mode 100644
index 00000000..8ed081ff
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java
@@ -0,0 +1,66 @@
+package org.apache.maven.repository;
+
+/*
+ * 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 resource being uploaded or downloaded by the repository system.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ArtifactTransferResource
+{
+
+ /**
+ * The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be
+ * terminated by a trailing slash.
+ *
+ * @return The base URL of the repository or an empty string if unknown, never {@code null}.
+ */
+ String getRepositoryUrl();
+
+ /**
+ * The path of the artifact relative to the repository's base URL.
+ *
+ * @return The path of the artifact, never {@code null}.
+ */
+ String getName();
+
+ /**
+ * Gets the full URL of the artifact.
+ *
+ * @return The full URL of the artifact, never {@code null}.
+ */
+ String getUrl();
+
+ /**
+ * The size of the artifact in bytes.
+ *
+ * @return The of the artifact in bytes or a negative value if unknown.
+ */
+ long getContentLength();
+
+ /**
+ * Gets the timestamp when the transfer of this artifact was started.
+ *
+ * @return The timestamp when the transfer of this artifact was started.
+ */
+ long getTransferStartTime();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java
new file mode 100644
index 00000000..f47cb4b1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java
@@ -0,0 +1,195 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+
+/**
+ * Delegating local artifact repository chains the reactor, IDE workspace
+ * and user local repository.
+ */
+@Deprecated
+public class DelegatingLocalArtifactRepository
+ extends MavenArtifactRepository
+{
+ private LocalArtifactRepository buildReactor;
+
+ private LocalArtifactRepository ideWorkspace;
+
+ private ArtifactRepository userLocalArtifactRepository;
+
+ public DelegatingLocalArtifactRepository( ArtifactRepository artifactRepository )
+ {
+ this.userLocalArtifactRepository = artifactRepository;
+ }
+
+ public void setBuildReactor( LocalArtifactRepository localRepository )
+ {
+ this.buildReactor = localRepository;
+ }
+
+ public void setIdeWorkspace( LocalArtifactRepository localRepository )
+ {
+ this.ideWorkspace = localRepository;
+ }
+
+ public LocalArtifactRepository getIdeWorspace()
+ {
+ return ideWorkspace;
+ }
+
+ @Override
+ public Artifact find( Artifact artifact )
+ {
+ if ( !artifact.isRelease() && buildReactor != null )
+ {
+ artifact = buildReactor.find( artifact );
+ }
+
+ if ( !artifact.isResolved() && ideWorkspace != null )
+ {
+ artifact = ideWorkspace.find( artifact );
+ }
+
+ if ( !artifact.isResolved() )
+ {
+ artifact = userLocalArtifactRepository.find( artifact );
+ }
+
+ return artifact;
+ }
+
+ @Override
+ public List<String> findVersions( Artifact artifact )
+ {
+ Collection<String> versions = new LinkedHashSet<String>();
+
+ if ( buildReactor != null )
+ {
+ versions.addAll( buildReactor.findVersions( artifact ) );
+ }
+
+ if ( ideWorkspace != null )
+ {
+ versions.addAll( ideWorkspace.findVersions( artifact ) );
+ }
+
+ versions.addAll( userLocalArtifactRepository.findVersions( artifact ) );
+
+ return Collections.unmodifiableList( new ArrayList<String>( versions ) );
+ }
+
+ public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+ {
+ return userLocalArtifactRepository.pathOfLocalRepositoryMetadata( metadata, repository );
+ }
+
+ public String getId()
+ {
+ return userLocalArtifactRepository.getId();
+ }
+
+ @Override
+ public String pathOf( Artifact artifact )
+ {
+ return userLocalArtifactRepository.pathOf( artifact );
+ }
+
+ @Override
+ public String getBasedir()
+ {
+ return ( userLocalArtifactRepository != null ) ? userLocalArtifactRepository.getBasedir() : null;
+ }
+
+ @Override
+ public ArtifactRepositoryLayout getLayout()
+ {
+ return userLocalArtifactRepository.getLayout();
+ }
+
+ @Override
+ public ArtifactRepositoryPolicy getReleases()
+ {
+ return userLocalArtifactRepository.getReleases();
+ }
+
+ @Override
+ public ArtifactRepositoryPolicy getSnapshots()
+ {
+ return userLocalArtifactRepository.getSnapshots();
+ }
+
+ @Override
+ public String getKey()
+ {
+ return userLocalArtifactRepository.getKey();
+ }
+
+ @Override
+ public String getUrl()
+ {
+ return userLocalArtifactRepository.getUrl();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 17;
+ hash = hash * 31 + ( buildReactor == null ? 0 : buildReactor.hashCode() );
+ hash = hash * 31 + ( ideWorkspace == null ? 0 : ideWorkspace.hashCode() );
+ hash = hash * 31 + ( userLocalArtifactRepository == null ? 0 : userLocalArtifactRepository.hashCode() );
+
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( obj == null )
+ {
+ return false;
+ }
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ DelegatingLocalArtifactRepository other = (DelegatingLocalArtifactRepository) obj;
+
+ return eq( buildReactor, other.buildReactor )
+ && eq( ideWorkspace, other.ideWorkspace )
+ && eq( userLocalArtifactRepository, other.userLocalArtifactRepository );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java
new file mode 100644
index 00000000..e33789e3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java
@@ -0,0 +1,33 @@
+package org.apache.maven.repository;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
+
+public abstract class LocalArtifactRepository
+ extends MavenArtifactRepository
+{
+ public static final String IDE_WORKSPACE = "ide-workspace";
+
+ public abstract Artifact find( Artifact artifact );
+
+ public abstract boolean hasLocalMetadata();
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java
new file mode 100644
index 00000000..54e4ef4b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java
@@ -0,0 +1,44 @@
+package org.apache.maven.repository;
+
+/*
+ * 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 store files within the local repository.
+ *
+ * @author Benjamin Bentmann
+ */
+public class LocalRepositoryNotAccessibleException
+ extends IOException
+{
+
+ public LocalRepositoryNotAccessibleException( String message, Throwable cause )
+ {
+ super( message );
+ initCause( cause );
+ }
+
+ public LocalRepositoryNotAccessibleException( String message )
+ {
+ super( message );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java
new file mode 100644
index 00000000..fcc0f777
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/RepositorySystem.java
@@ -0,0 +1,164 @@
+package org.apache.maven.repository;
+
+/*
+ * 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 org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Repository;
+import org.apache.maven.settings.Mirror;
+import org.apache.maven.settings.Server;
+import org.eclipse.aether.RepositorySystemSession;
+
+/**
+ * @author Jason van Zyl
+ * @since 3.0-alpha
+ */
+public interface RepositorySystem
+{
+ String DEFAULT_LOCAL_REPO_ID = "local";
+
+ String userHome = System.getProperty( "user.home" );
+
+ File userMavenConfigurationHome = new File( userHome, ".m2" );
+
+ File defaultUserLocalRepository = new File( userMavenConfigurationHome, "repository" );
+
+ String DEFAULT_REMOTE_REPO_ID = "central";
+
+ String DEFAULT_REMOTE_REPO_URL = "https://repo.maven.apache.org/maven2";
+
+ Artifact createArtifact( String groupId, String artifactId, String version, String packaging );
+
+ Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
+
+ Artifact createProjectArtifact( String groupId, String artifactId, String version );
+
+ Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type,
+ String classifier );
+
+ Artifact createPluginArtifact( Plugin plugin );
+
+ Artifact createDependencyArtifact( Dependency dependency );
+
+ ArtifactRepository buildArtifactRepository( Repository repository )
+ throws InvalidRepositoryException;
+
+ ArtifactRepository createDefaultRemoteRepository()
+ throws InvalidRepositoryException;
+
+ ArtifactRepository createDefaultLocalRepository()
+ throws InvalidRepositoryException;
+
+ ArtifactRepository createLocalRepository( File localRepository )
+ throws InvalidRepositoryException;
+
+ ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout,
+ ArtifactRepositoryPolicy snapshots,
+ ArtifactRepositoryPolicy releases );
+
+ /**
+ * Calculates the effective repositories for the given input repositories which are assumed to be already mirrored
+ * (if applicable). This process will essentially remove duplicate repositories by merging them into one equivalent
+ * repository. It is worth to point out that merging does not simply choose one of the input repositories and
+ * discards the others but actually combines their possibly different policies.
+ *
+ * @param repositories The original repositories, may be {@code null}.
+ * @return The effective repositories or {@code null} if the input was {@code null}.
+ */
+ List<ArtifactRepository> getEffectiveRepositories( List<ArtifactRepository> repositories );
+
+ /**
+ * Determines the mirror for the specified repository.
+ *
+ * @param repository The repository to determine the mirror for, must not be {@code null}.
+ * @param mirrors The available mirrors, may be {@code null}.
+ * @return The mirror specification for the repository or {@code null} if no mirror matched.
+ */
+ Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors );
+
+ /**
+ * Injects the mirroring information into the specified repositories. For each repository that is matched by a
+ * mirror, its URL and ID will be updated to match the values from the mirror specification. Repositories without a
+ * matching mirror will pass through unchanged. <em>Note:</em> This method must be called before
+ * {@link #injectAuthentication(List, List)} or the repositories will end up with the wrong credentials.
+ *
+ * @param repositories The repositories into which to inject the mirror information, may be {@code null}.
+ * @param mirrors The available mirrors, may be {@code null}.
+ */
+ void injectMirror( List<ArtifactRepository> repositories, List<Mirror> mirrors );
+
+ /**
+ * Injects the proxy information into the specified repositories. For each repository that is matched by a proxy,
+ * its proxy data will be set accordingly. Repositories without a matching proxy will have their proxy cleared.
+ * <em>Note:</em> This method must be called after {@link #injectMirror(List, List)} or the repositories will end up
+ * with the wrong proxies.
+ *
+ * @param repositories The repositories into which to inject the proxy information, may be {@code null}.
+ * @param proxies The available proxies, may be {@code null}.
+ */
+ void injectProxy( List<ArtifactRepository> repositories, List<org.apache.maven.settings.Proxy> proxies );
+
+ /**
+ * Injects the authentication information into the specified repositories. For each repository that is matched by a
+ * server, its credentials will be updated to match the values from the server specification. Repositories without a
+ * matching server will have their credentials cleared. <em>Note:</em> This method must be called after
+ * {@link #injectMirror(List, List)} or the repositories will end up with the wrong credentials.
+ *
+ * @param repositories The repositories into which to inject the authentication information, may be {@code null}.
+ * @param servers The available servers, may be {@code null}.
+ */
+ void injectAuthentication( List<ArtifactRepository> repositories, List<Server> servers );
+
+ void injectMirror( RepositorySystemSession session, List<ArtifactRepository> repositories );
+
+ void injectProxy( RepositorySystemSession session, List<ArtifactRepository> repositories );
+
+ void injectAuthentication( RepositorySystemSession session, List<ArtifactRepository> repositories );
+
+ ArtifactResolutionResult resolve( ArtifactResolutionRequest request );
+
+ // Install
+
+ // Deploy
+
+ // Map types of artifacts
+
+ //
+ // Raw file transfers
+ //
+ void publish( ArtifactRepository repository, File source, String remotePath,
+ ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException;
+
+ void retrieve( ArtifactRepository repository, File destination, String remotePath,
+ ArtifactTransferListener transferListener )
+ throws ArtifactTransferFailedException, ArtifactDoesNotExistException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java
new file mode 100644
index 00000000..352e5bbb
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java
@@ -0,0 +1,65 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * Common elements of artifact metadata.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractArtifactMetadata
+ implements ArtifactMetadata
+{
+ protected Artifact artifact;
+
+ protected AbstractArtifactMetadata( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ public boolean storedInGroupDirectory()
+ {
+ return false;
+ }
+
+ public String getGroupId()
+ {
+ return artifact.getGroupId();
+ }
+
+ public String getArtifactId()
+ {
+ return artifact.getArtifactId();
+ }
+
+ public String extendedToString()
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append( "\nArtifact Metadata\n--------------------------" );
+ buffer.append( "\nGroupId: " ).append( getGroupId() );
+ buffer.append( "\nArtifactId: " ).append( getArtifactId() );
+ buffer.append( "\nMetadata Type: " ).append( getClass().getName() );
+
+ return buffer.toString();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java
new file mode 100644
index 00000000..67b4080b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java
@@ -0,0 +1,68 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * Error while retrieving repository metadata from the repository.
+ *
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ */
+public class ArtifactMetadataRetrievalException
+ extends Exception
+{
+ private Artifact artifact;
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( String message )
+ {
+ this( message, null, null );
+ }
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( Throwable cause )
+ {
+ this( null, cause, null );
+ }
+
+ /** @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} */
+ @Deprecated
+ public ArtifactMetadataRetrievalException( String message,
+ Throwable cause )
+ {
+ this( message, cause, null );
+ }
+
+ public ArtifactMetadataRetrievalException( String message,
+ Throwable cause,
+ Artifact artifact )
+ {
+ super( message, cause );
+ this.artifact = artifact;
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java
new file mode 100644
index 00000000..aaa0ee34
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java
@@ -0,0 +1,78 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+
+/**
+ * Provides some metadata operations, like querying the remote repository for a list of versions available for an
+ * artifact.
+ *
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
+ */
+public interface ArtifactMetadataSource
+{
+
+ ResolutionGroup retrieve( MetadataResolutionRequest request )
+ throws ArtifactMetadataRetrievalException;
+
+ ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException;
+
+ /**
+ * Get a list of available versions for an artifact in the remote repository
+ *
+ * @param artifact artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code>
+ * are needed, for instance the following code will work
+ * <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
+ * @param localRepository local repository
+ * @param remoteRepositories remote repositories, {@link List} $lt; {@link ArtifactRepository} >
+ * @return {@link List} $lt; {@link ArtifactVersion} >
+ * @throws ArtifactMetadataRetrievalException
+ * in case of error while retrieving repository metadata from the repository.
+ */
+ List<ArtifactVersion> retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository,
+ List<ArtifactRepository> remoteRepositories )
+ throws ArtifactMetadataRetrievalException;
+
+ /**
+ * Get a list of available versions for an artifact in the remote deployment repository. This ignores any update
+ * policy checks and mirrors and always retrieves the latest information from the given repository.
+ *
+ * @param artifact artifact we are interested in. Only <code>groupid</code> and <code>artifactId</code> are
+ * needed, for instance the following code will work
+ * <code>artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )</code>
+ * @param localRepository local repository
+ * @param remoteRepository remote repository
+ * @return {@link List} $lt; {@link ArtifactVersion} >
+ * @throws ArtifactMetadataRetrievalException
+ * in case of error while retrieving repository metadata from the repository.
+ */
+ List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact,
+ ArtifactRepository localRepository,
+ ArtifactRepository remoteRepository )
+ throws ArtifactMetadataRetrievalException;
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java
new file mode 100644
index 00000000..93b9d5da
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java
@@ -0,0 +1,132 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.DefaultRepositoryRequest;
+import org.apache.maven.artifact.repository.RepositoryRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+
+/**
+ * Forms a request to retrieve artifact metadata.
+ *
+ * @author Benjamin Bentmann
+ */
+public class DefaultMetadataResolutionRequest
+ implements MetadataResolutionRequest
+{
+
+ private Artifact artifact;
+
+ private boolean resolveManagedVersions;
+
+ private RepositoryRequest repositoryRequest;
+
+ public DefaultMetadataResolutionRequest()
+ {
+ repositoryRequest = new DefaultRepositoryRequest();
+ }
+
+ public DefaultMetadataResolutionRequest( RepositoryRequest repositoryRequest )
+ {
+ this.repositoryRequest = new DefaultRepositoryRequest( repositoryRequest );
+ }
+
+ public DefaultMetadataResolutionRequest( ArtifactResolutionRequest resolutionRequest )
+ {
+ this.repositoryRequest = new DefaultRepositoryRequest( resolutionRequest );
+ }
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public DefaultMetadataResolutionRequest setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+
+ return this;
+ }
+
+ public ArtifactRepository getLocalRepository()
+ {
+ return repositoryRequest.getLocalRepository();
+ }
+
+ public DefaultMetadataResolutionRequest setLocalRepository( ArtifactRepository localRepository )
+ {
+ repositoryRequest.setLocalRepository( localRepository );
+
+ return this;
+ }
+
+ public List<ArtifactRepository> getRemoteRepositories()
+ {
+ return repositoryRequest.getRemoteRepositories();
+ }
+
+ public DefaultMetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories )
+ {
+ repositoryRequest.setRemoteRepositories( remoteRepositories );
+
+ return this;
+ }
+
+ public boolean isResolveManagedVersions()
+ {
+ return resolveManagedVersions;
+ }
+
+ public DefaultMetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions )
+ {
+ this.resolveManagedVersions = resolveManagedVersions;
+
+ return this;
+ }
+
+ public boolean isOffline()
+ {
+ return repositoryRequest.isOffline();
+ }
+
+ public DefaultMetadataResolutionRequest setOffline( boolean offline )
+ {
+ repositoryRequest.setOffline( offline );
+
+ return this;
+ }
+
+ public boolean isForceUpdate()
+ {
+ return repositoryRequest.isForceUpdate();
+ }
+
+ public DefaultMetadataResolutionRequest setForceUpdate( boolean forceUpdate )
+ {
+ repositoryRequest.setForceUpdate( forceUpdate );
+
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java
new file mode 100644
index 00000000..a652c977
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java
@@ -0,0 +1,113 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.RepositoryRequest;
+
+/**
+ * Forms a request to retrieve artifact metadata.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface MetadataResolutionRequest
+ extends RepositoryRequest
+{
+
+ /**
+ * Indicates whether network access to remote repositories has been disabled.
+ *
+ * @return {@code true} if remote access has been disabled, {@code false} otherwise.
+ */
+ boolean isOffline();
+
+ /**
+ * Enables/disables network access to remote repositories.
+ *
+ * @param offline {@code true} to disable remote access, {@code false} to allow network access.
+ * @return This request, never {@code null}.
+ */
+ MetadataResolutionRequest setOffline( boolean offline );
+
+ /**
+ * Gets the artifact to resolve metadata for.
+ *
+ * @return The artifact to resolve metadata for or {@code null} if not set.
+ */
+ Artifact getArtifact();
+
+ /**
+ * Sets the artifact for which to resolve metadata.
+ *
+ * @param artifact The artifact for which to resolve metadata.
+ * @return This request, never {@code null}.
+ */
+ MetadataResolutionRequest setArtifact( Artifact artifact );
+
+ /**
+ * Gets the local repository to use for the resolution.
+ *
+ * @return The local repository to use for the resolution or {@code null} if not set.
+ */
+ ArtifactRepository getLocalRepository();
+
+ /**
+ * Sets the local repository to use for the resolution.
+ *
+ * @param localRepository The local repository to use for the resolution.
+ * @return This request, never {@code null}.
+ */
+ MetadataResolutionRequest setLocalRepository( ArtifactRepository localRepository );
+
+ /**
+ * Gets the remote repositories to use for the resolution.
+ *
+ * @return The remote repositories to use for the resolution, never {@code null}.
+ */
+ List<ArtifactRepository> getRemoteRepositories();
+
+ /**
+ * Sets the remote repositories to use for the resolution.
+ *
+ * @param remoteRepositories The remote repositories to use for the resolution.
+ * @return This request, never {@code null}.
+ */
+ MetadataResolutionRequest setRemoteRepositories( List<ArtifactRepository> remoteRepositories );
+
+ /**
+ * Determines whether the managed version information should be retrieved.
+ *
+ * @return {@code true} if the dependency management information should be retrieved, {@code false} otherwise.
+ */
+ boolean isResolveManagedVersions();
+
+ /**
+ * Enables/disables resolution of the dependency manageemnt information.
+ *
+ * @param resolveManagedVersions {@code true} if the dependency management information should be retrieved, {@code
+ * false} otherwise.
+ * @return This request, never {@code null}.
+ */
+ MetadataResolutionRequest setResolveManagedVersions( boolean resolveManagedVersions );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java
new file mode 100644
index 00000000..e942f70a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java
@@ -0,0 +1,83 @@
+package org.apache.maven.repository.legacy.metadata;
+
+/*
+ * 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 java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+
+public class ResolutionGroup
+{
+
+ private final Set<Artifact> artifacts;
+
+ private final List<ArtifactRepository> resolutionRepositories;
+
+ private final Artifact pomArtifact;
+
+ private final Artifact relocatedArtifact;
+
+ private final Map<String, Artifact> managedVersions;
+
+ public ResolutionGroup( Artifact pomArtifact, Set<Artifact> artifacts,
+ List<ArtifactRepository> resolutionRepositories )
+ {
+ this( pomArtifact, null, artifacts, null, resolutionRepositories );
+ }
+
+ public ResolutionGroup( Artifact pomArtifact, Artifact relocatedArtifact, Set<Artifact> artifacts,
+ Map<String, Artifact> managedVersions, List<ArtifactRepository> resolutionRepositories )
+ {
+ this.pomArtifact = pomArtifact;
+ this.relocatedArtifact = relocatedArtifact;
+ this.artifacts = artifacts;
+ this.managedVersions = managedVersions;
+ this.resolutionRepositories = resolutionRepositories;
+ }
+
+ public Artifact getPomArtifact()
+ {
+ return pomArtifact;
+ }
+
+ public Artifact getRelocatedArtifact()
+ {
+ return relocatedArtifact;
+ }
+
+ public Set<Artifact> getArtifacts()
+ {
+ return artifacts;
+ }
+
+ public List<ArtifactRepository> getResolutionRepositories()
+ {
+ return resolutionRepositories;
+ }
+
+ public Map<String, Artifact> getManagedVersions()
+ {
+ return managedVersions;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/RuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/RuntimeInformation.java
new file mode 100644
index 00000000..4e3520db
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/RuntimeInformation.java
@@ -0,0 +1,49 @@
+package org.apache.maven.rtinfo;
+
+/*
+ * 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 information about the current Maven runtime.
+ *
+ * @since 3.0.2
+ */
+public interface RuntimeInformation
+{
+
+ /**
+ * Retrieves the current Maven version, for example "3.0.2".
+ *
+ * @return The current Maven version or an empty string if unknown, never {@code null}.
+ */
+ String getMavenVersion();
+
+ /**
+ * Checks whether the current Maven runtime matches the specified version range. A version range can either use the
+ * usual mathematical syntax "[2.0.10,2.1.0),[3.0,)" or use a single version "2.2.1". The latter is a short form for
+ * "[2.2.1,)", i.e. denotes the minimum version required.
+ *
+ * @param versionRange The version range to match the current Maven runtime against, must not be {@code null}.
+ * @return {@code true} if the current Maven runtime matches the specified version range, {@code false} otherwise.
+ * @throws IllegalArgumentException If the specified version range is {@code null}, empty or otherwise not a valid
+ * version specification.
+ */
+ boolean isMavenVersion( String versionRange );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
new file mode 100644
index 00000000..6a733f9b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformation.java
@@ -0,0 +1,150 @@
+package org.apache.maven.rtinfo.internal;
+
+/*
+ * 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.Properties;
+
+import org.apache.maven.rtinfo.RuntimeInformation;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.StringUtils;
+import org.eclipse.aether.util.version.GenericVersionScheme;
+import org.eclipse.aether.version.InvalidVersionSpecificationException;
+import org.eclipse.aether.version.Version;
+import org.eclipse.aether.version.VersionConstraint;
+import org.eclipse.aether.version.VersionScheme;
+
+/**
+ * Provides information about the current Maven runtime.
+ */
+@Component( role = RuntimeInformation.class )
+public class DefaultRuntimeInformation
+ implements RuntimeInformation
+{
+
+ @Requirement
+ private Logger logger;
+
+ private String mavenVersion;
+
+ public String getMavenVersion()
+ {
+ if ( mavenVersion == null )
+ {
+ Properties props = new Properties();
+
+ String resource = "META-INF/maven/org.apache.maven/maven-core/pom.properties";
+
+ InputStream is = DefaultRuntimeInformation.class.getResourceAsStream( "/" + resource );
+ if ( is != null )
+ {
+ try
+ {
+ props.load( is );
+ }
+ catch ( IOException e )
+ {
+ String msg = "Could not parse " + resource + ", Maven runtime information not available";
+ if ( logger.isDebugEnabled() )
+ {
+ logger.warn( msg, e );
+ }
+ else
+ {
+ logger.warn( msg );
+ }
+ }
+ finally
+ {
+ IOUtil.close( is );
+ }
+ }
+ else
+ {
+ logger.warn( "Could not locate " + resource
+ + " on classpath, Maven runtime information not available" );
+ }
+
+ String version = props.getProperty( "version", "" ).trim();
+
+ if ( !version.startsWith( "${" ) )
+ {
+ mavenVersion = version;
+ }
+ else
+ {
+ mavenVersion = "";
+ }
+ }
+
+ return mavenVersion;
+ }
+
+ public boolean isMavenVersion( String versionRange )
+ {
+ VersionScheme versionScheme = new GenericVersionScheme();
+
+ if ( versionRange == null )
+ {
+ throw new IllegalArgumentException( "Version range must not be null" );
+ }
+ if ( StringUtils.isBlank( versionRange ) )
+ {
+ throw new IllegalArgumentException( "Version range must not be empty" );
+ }
+
+ VersionConstraint constraint;
+ try
+ {
+ constraint = versionScheme.parseVersionConstraint( versionRange );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new IllegalArgumentException( e.getMessage(), e );
+ }
+
+ Version current;
+ try
+ {
+ String mavenVersion = getMavenVersion();
+ if ( mavenVersion.length() <= 0 )
+ {
+ throw new IllegalStateException( "Could not determine current Maven version" );
+ }
+
+ current = versionScheme.parseVersion( mavenVersion );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new IllegalStateException( "Could not parse current Maven version: " + e.getMessage(), e );
+ }
+
+ if ( constraint.getRange() == null )
+ {
+ return constraint.getVersion().compareTo( current ) <= 0;
+ }
+ return constraint.containsVersion( current );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java
new file mode 100644
index 00000000..6d8913f5
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScope.java
@@ -0,0 +1,169 @@
+package org.apache.maven.session.scope.internal;
+
+/*
+ * 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.LinkedList;
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.inject.Key;
+import com.google.inject.OutOfScopeException;
+import com.google.inject.Provider;
+import com.google.inject.Scope;
+import com.google.inject.util.Providers;
+
+public class SessionScope
+ implements Scope
+{
+ /**
+ * @since 3.3.0
+ */
+ public static class Memento
+ {
+ final Map<Key<?>, Provider<?>> seeded;
+
+ Memento( final Map<Key<?>, Provider<?>> seeded )
+ {
+ this.seeded = ImmutableMap.copyOf( seeded );
+ }
+ }
+
+ private static final Provider<Object> SEEDED_KEY_PROVIDER = new Provider<Object>()
+ {
+ public Object get()
+ {
+ throw new IllegalStateException();
+ }
+ };
+
+ private static final class ScopeState
+ {
+ public final Map<Key<?>, Provider<?>> seeded = Maps.newHashMap();
+
+ public final Map<Key<?>, Object> provided = Maps.newHashMap();
+ }
+
+ private final ThreadLocal<LinkedList<ScopeState>> values = new ThreadLocal<LinkedList<ScopeState>>();
+
+ public void enter()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null )
+ {
+ stack = new LinkedList<ScopeState>();
+ values.set( stack );
+ }
+ stack.addFirst( new ScopeState() );
+ }
+
+ /**
+ * @since 3.3.0
+ */
+ public void enter( Memento memento )
+ {
+ enter();
+ getScopeState().seeded.putAll( memento.seeded );
+ }
+
+ private ScopeState getScopeState()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new IllegalStateException();
+ }
+ return stack.getFirst();
+ }
+
+ public void exit()
+ {
+ final LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new IllegalStateException();
+ }
+ stack.removeFirst();
+ if ( stack.isEmpty() )
+ {
+ values.remove();
+ }
+ }
+
+ /**
+ * @since 3.3.0
+ */
+ public Memento memento()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ return new Memento( stack != null ? stack.getFirst().seeded : Collections.<Key<?>, Provider<?>>emptyMap() );
+ }
+
+ public <T> void seed( Class<T> clazz, Provider<T> value )
+ {
+ getScopeState().seeded.put( Key.get( clazz ), value );
+ }
+
+ public <T> void seed( Class<T> clazz, final T value )
+ {
+ getScopeState().seeded.put( Key.get( clazz ), Providers.of( value ) );
+ }
+
+ public <T> Provider<T> scope( final Key<T> key, final Provider<T> unscoped )
+ {
+ return new Provider<T>()
+ {
+ @SuppressWarnings( "unchecked" )
+ public T get()
+ {
+ LinkedList<ScopeState> stack = values.get();
+ if ( stack == null || stack.isEmpty() )
+ {
+ throw new OutOfScopeException( "Cannot access " + key + " outside of a scoping block" );
+ }
+
+ ScopeState state = stack.getFirst();
+
+ Provider<?> seeded = state.seeded.get( key );
+
+ if ( seeded != null )
+ {
+ return (T) seeded.get();
+ }
+
+ T provided = (T) state.provided.get( key );
+ if ( provided == null && unscoped != null )
+ {
+ provided = unscoped.get();
+ state.provided.put( key, provided );
+ }
+
+ return provided;
+ }
+ };
+ }
+
+ @SuppressWarnings( { "unchecked" } )
+ public static <T> Provider<T> seededKeyProvider()
+ {
+ return (Provider<T>) SEEDED_KEY_PROVIDER;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java
new file mode 100644
index 00000000..585d683a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java
@@ -0,0 +1,63 @@
+package org.apache.maven.session.scope.internal;
+
+/*
+ * 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 javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.maven.SessionScoped;
+import org.apache.maven.execution.MavenSession;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+
+import com.google.inject.AbstractModule;
+
+@Named
+public class SessionScopeModule
+ extends AbstractModule
+{
+ private final SessionScope scope;
+
+ @Inject
+ public SessionScopeModule()
+ {
+ this( new SessionScope() );
+ }
+
+ public SessionScopeModule( PlexusContainer container )
+ throws ComponentLookupException
+ {
+ this( container.lookup( SessionScope.class ) );
+ }
+
+ private SessionScopeModule( SessionScope scope )
+ {
+ this.scope = scope;
+ }
+
+ @Override
+ protected void configure()
+ {
+ bindScope( SessionScoped.class, scope );
+ bind( SessionScope.class ).toInstance( scope );
+
+ bind( MavenSession.class ).toProvider( SessionScope.<MavenSession>seededKeyProvider() ).in( scope );
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
new file mode 100644
index 00000000..820d886e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
@@ -0,0 +1,158 @@
+package org.apache.maven.settings;
+
+/*
+ * 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 org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.properties.internal.SystemProperties;
+import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
+import org.apache.maven.settings.building.SettingsBuilder;
+import org.apache.maven.settings.building.SettingsBuildingException;
+import org.apache.maven.settings.building.SettingsBuildingRequest;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * @author jdcasey
+ */
+@Component( role = MavenSettingsBuilder.class )
+public class DefaultMavenSettingsBuilder
+ extends AbstractLogEnabled
+ implements MavenSettingsBuilder
+{
+
+ @Requirement
+ private SettingsBuilder settingsBuilder;
+
+ public Settings buildSettings()
+ throws IOException, XmlPullParserException
+ {
+ File userSettingsFile =
+ getFile( "${user.home}/.m2/settings.xml", "user.home",
+ MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION );
+
+ return buildSettings( userSettingsFile );
+ }
+
+ public Settings buildSettings( boolean useCachedSettings )
+ throws IOException, XmlPullParserException
+ {
+ return buildSettings();
+ }
+
+ public Settings buildSettings( File userSettingsFile )
+ throws IOException, XmlPullParserException
+ {
+ File globalSettingsFile =
+ getFile( "${maven.home}/conf/settings.xml", "maven.home",
+ MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION );
+
+ SettingsBuildingRequest request = new DefaultSettingsBuildingRequest();
+ request.setUserSettingsFile( userSettingsFile );
+ request.setGlobalSettingsFile( globalSettingsFile );
+ request.setSystemProperties( SystemProperties.getSystemProperties() );
+ return build( request );
+ }
+
+ public Settings buildSettings( File userSettingsFile, boolean useCachedSettings )
+ throws IOException, XmlPullParserException
+ {
+ return buildSettings( userSettingsFile );
+ }
+
+ private Settings build( SettingsBuildingRequest request )
+ throws IOException, XmlPullParserException
+ {
+ try
+ {
+ return settingsBuilder.build( request ).getEffectiveSettings();
+ }
+ catch ( SettingsBuildingException e )
+ {
+ throw (IOException) new IOException( e.getMessage() ).initCause( e );
+ }
+ }
+
+ /** @since 2.1 */
+ public Settings buildSettings( MavenExecutionRequest request )
+ throws IOException, XmlPullParserException
+ {
+ SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest();
+ settingsRequest.setUserSettingsFile( request.getUserSettingsFile() );
+ settingsRequest.setGlobalSettingsFile( request.getGlobalSettingsFile() );
+ settingsRequest.setUserProperties( request.getUserProperties() );
+ settingsRequest.setSystemProperties( request.getSystemProperties() );
+
+ return build( settingsRequest );
+ }
+
+ private File getFile( String pathPattern, String basedirSysProp, String altLocationSysProp )
+ {
+ // -------------------------------------------------------------------------------------
+ // Alright, here's the justification for all the regexp wizardry below...
+ //
+ // Continuum and other server-like apps may need to locate the user-level and
+ // global-level settings somewhere other than ${user.home} and ${maven.home},
+ // respectively. Using a simple replacement of these patterns will allow them
+ // to specify the absolute path to these files in a customized components.xml
+ // file. Ideally, we'd do full pattern-evaluation against the sysprops, but this
+ // is a first step. There are several replacements below, in order to normalize
+ // the path character before we operate on the string as a regex input, and
+ // in order to avoid surprises with the File construction...
+ // -------------------------------------------------------------------------------------
+
+ String path = System.getProperty( altLocationSysProp );
+
+ if ( StringUtils.isEmpty( path ) )
+ {
+ // TODO: This replacing shouldn't be necessary as user.home should be in the
+ // context of the container and thus the value would be interpolated by Plexus
+ String basedir = System.getProperty( basedirSysProp );
+ if ( basedir == null )
+ {
+ basedir = System.getProperty( "user.dir" );
+ }
+
+ basedir = basedir.replaceAll( "\\\\", "/" );
+ basedir = basedir.replaceAll( "\\$", "\\\\\\$" );
+
+ path = pathPattern.replaceAll( "\\$\\{" + basedirSysProp + "\\}", basedir );
+ path = path.replaceAll( "\\\\", "/" );
+ // ---------------------------------------------------------------------------------
+ // I'm not sure if this last regexp was really intended to disallow the usage of
+ // network paths as user.home directory. Unfortunately it did. I removed it and
+ // have not detected any problems yet.
+ // ---------------------------------------------------------------------------------
+ // path = path.replaceAll( "//", "/" );
+
+ return new File( path ).getAbsoluteFile();
+ }
+ else
+ {
+ return new File( path ).getAbsoluteFile();
+ }
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
new file mode 100644
index 00000000..c79a843d
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
@@ -0,0 +1,81 @@
+package org.apache.maven.settings;
+
+/*
+ * 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 org.apache.maven.execution.MavenExecutionRequest;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * @author jdcasey
+ * @author Jason van Zyl
+ */
+@Deprecated
+public interface MavenSettingsBuilder
+{
+
+ String ROLE = MavenSettingsBuilder.class.getName();
+
+ String ALT_USER_SETTINGS_XML_LOCATION = "org.apache.maven.user-settings";
+ String ALT_GLOBAL_SETTINGS_XML_LOCATION = "org.apache.maven.global-settings";
+ String ALT_LOCAL_REPOSITORY_LOCATION = "maven.repo.local";
+
+ Settings buildSettings( MavenExecutionRequest request )
+ throws IOException, XmlPullParserException;
+
+ /**
+ * @return a <code>Settings</code> object from the user settings file.
+ * @throws IOException if any
+ * @throws XmlPullParserException if any
+ */
+ Settings buildSettings()
+ throws IOException, XmlPullParserException;
+
+ /**
+ * @param useCachedSettings if true, doesn't reload the user settings
+ * @return a <code>Settings</code> object from the user settings file.
+ * @throws IOException if any
+ * @throws XmlPullParserException if any
+ */
+ Settings buildSettings( boolean useCachedSettings )
+ throws IOException, XmlPullParserException;
+
+ /**
+ * @param userSettingsFile a given user settings file
+ * @return a <code>Settings</code> object from the user settings file.
+ * @throws IOException if any
+ * @throws XmlPullParserException if any
+ */
+ Settings buildSettings( File userSettingsFile )
+ throws IOException, XmlPullParserException;
+
+ /**
+ * @param userSettingsFile a given user settings file
+ * @param useCachedSettings if true, doesn't reload the user settings
+ * @return a <code>Settings</code> object from the user settings file.
+ * @throws IOException if any
+ * @throws XmlPullParserException if any
+ */
+ Settings buildSettings( File userSettingsFile, boolean useCachedSettings )
+ throws IOException, XmlPullParserException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
new file mode 100644
index 00000000..6fab6501
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java
@@ -0,0 +1,63 @@
+package org.apache.maven.settings;
+
+/*
+ * 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.
+ */
+
+/**
+ * If there was an error in the settings file.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class SettingsConfigurationException
+ extends Exception
+{
+ private int lineNumber;
+
+ private int columnNumber;
+
+ public SettingsConfigurationException( String message )
+ {
+ super( message );
+ }
+
+ public SettingsConfigurationException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+ public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber )
+ {
+ super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" )
+ + ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause );
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ }
+
+ public int getColumnNumber()
+ {
+ return columnNumber;
+ }
+
+ public int getLineNumber()
+ {
+ return lineNumber;
+ }
+
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsUtils.java
new file mode 100644
index 00000000..8da696e8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/settings/SettingsUtils.java
@@ -0,0 +1,321 @@
+package org.apache.maven.settings;
+
+/*
+ * 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.ActivationFile;
+import org.apache.maven.settings.merge.MavenSettingsMerger;
+
+import java.util.List;
+
+/**
+ * Several convenience methods to handle settings
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+public final class SettingsUtils
+{
+
+ private SettingsUtils()
+ {
+ // don't allow construction.
+ }
+
+ /**
+ * @param dominant
+ * @param recessive
+ * @param recessiveSourceLevel
+ */
+ public static void merge( Settings dominant, Settings recessive, String recessiveSourceLevel )
+ {
+ new MavenSettingsMerger().merge( dominant, recessive, recessiveSourceLevel );
+ }
+
+ /**
+ * @param modelProfile
+ * @return a profile
+ */
+ public static Profile convertToSettingsProfile( org.apache.maven.model.Profile modelProfile )
+ {
+ Profile profile = new Profile();
+
+ profile.setId( modelProfile.getId() );
+
+ org.apache.maven.model.Activation modelActivation = modelProfile.getActivation();
+
+ if ( modelActivation != null )
+ {
+ Activation activation = new Activation();
+
+ activation.setActiveByDefault( modelActivation.isActiveByDefault() );
+
+ activation.setJdk( modelActivation.getJdk() );
+
+ org.apache.maven.model.ActivationProperty modelProp = modelActivation.getProperty();
+
+ if ( modelProp != null )
+ {
+ ActivationProperty prop = new ActivationProperty();
+ prop.setName( modelProp.getName() );
+ prop.setValue( modelProp.getValue() );
+ activation.setProperty( prop );
+ }
+
+ org.apache.maven.model.ActivationOS modelOs = modelActivation.getOs();
+
+ if ( modelOs != null )
+ {
+ ActivationOS os = new ActivationOS();
+
+ os.setArch( modelOs.getArch() );
+ os.setFamily( modelOs.getFamily() );
+ os.setName( modelOs.getName() );
+ os.setVersion( modelOs.getVersion() );
+
+ activation.setOs( os );
+ }
+
+ ActivationFile modelFile = modelActivation.getFile();
+
+ if ( modelFile != null )
+ {
+ org.apache.maven.settings.ActivationFile file = new org.apache.maven.settings.ActivationFile();
+
+ file.setExists( modelFile.getExists() );
+ file.setMissing( modelFile.getMissing() );
+
+ activation.setFile( file );
+ }
+
+ profile.setActivation( activation );
+ }
+
+ profile.setProperties( modelProfile.getProperties() );
+
+ List<org.apache.maven.model.Repository> repos = modelProfile.getRepositories();
+ if ( repos != null )
+ {
+ for ( org.apache.maven.model.Repository repo : repos )
+ {
+ profile.addRepository( convertToSettingsRepository( repo ) );
+ }
+ }
+
+ List<org.apache.maven.model.Repository> pluginRepos = modelProfile.getPluginRepositories();
+ if ( pluginRepos != null )
+ {
+ for ( org.apache.maven.model.Repository pluginRepo : pluginRepos )
+ {
+ profile.addPluginRepository( convertToSettingsRepository( pluginRepo ) );
+ }
+ }
+
+ return profile;
+ }
+
+ /**
+ * @param settingsProfile
+ * @return a profile
+ */
+ public static org.apache.maven.model.Profile convertFromSettingsProfile( Profile settingsProfile )
+ {
+ org.apache.maven.model.Profile profile = new org.apache.maven.model.Profile();
+
+ profile.setId( settingsProfile.getId() );
+
+ profile.setSource( "settings.xml" );
+
+ Activation settingsActivation = settingsProfile.getActivation();
+
+ if ( settingsActivation != null )
+ {
+ org.apache.maven.model.Activation activation = new org.apache.maven.model.Activation();
+
+ activation.setActiveByDefault( settingsActivation.isActiveByDefault() );
+
+ activation.setJdk( settingsActivation.getJdk() );
+
+ ActivationProperty settingsProp = settingsActivation.getProperty();
+
+ if ( settingsProp != null )
+ {
+ org.apache.maven.model.ActivationProperty prop = new org.apache.maven.model.ActivationProperty();
+
+ prop.setName( settingsProp.getName() );
+ prop.setValue( settingsProp.getValue() );
+
+ activation.setProperty( prop );
+ }
+
+ ActivationOS settingsOs = settingsActivation.getOs();
+
+ if ( settingsOs != null )
+ {
+ org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS();
+
+ os.setArch( settingsOs.getArch() );
+ os.setFamily( settingsOs.getFamily() );
+ os.setName( settingsOs.getName() );
+ os.setVersion( settingsOs.getVersion() );
+
+ activation.setOs( os );
+ }
+
+ org.apache.maven.settings.ActivationFile settingsFile = settingsActivation.getFile();
+
+ if ( settingsFile != null )
+ {
+ ActivationFile file = new ActivationFile();
+
+ file.setExists( settingsFile.getExists() );
+ file.setMissing( settingsFile.getMissing() );
+
+ activation.setFile( file );
+ }
+
+ profile.setActivation( activation );
+ }
+
+ profile.setProperties( settingsProfile.getProperties() );
+
+ List<Repository> repos = settingsProfile.getRepositories();
+ if ( repos != null )
+ {
+ for ( Repository repo : repos )
+ {
+ profile.addRepository( convertFromSettingsRepository( repo ) );
+ }
+ }
+
+ List<Repository> pluginRepos = settingsProfile.getPluginRepositories();
+ if ( pluginRepos != null )
+ {
+ for ( Repository pluginRepo : pluginRepos )
+ {
+ profile.addPluginRepository( convertFromSettingsRepository( pluginRepo ) );
+ }
+ }
+
+ return profile;
+ }
+
+ /**
+ * @param settingsRepo
+ * @return a repository
+ */
+ private static org.apache.maven.model.Repository convertFromSettingsRepository( Repository settingsRepo )
+ {
+ org.apache.maven.model.Repository repo = new org.apache.maven.model.Repository();
+
+ repo.setId( settingsRepo.getId() );
+ repo.setLayout( settingsRepo.getLayout() );
+ repo.setName( settingsRepo.getName() );
+ repo.setUrl( settingsRepo.getUrl() );
+
+ if ( settingsRepo.getSnapshots() != null )
+ {
+ repo.setSnapshots( convertRepositoryPolicy( settingsRepo.getSnapshots() ) );
+ }
+ if ( settingsRepo.getReleases() != null )
+ {
+ repo.setReleases( convertRepositoryPolicy( settingsRepo.getReleases() ) );
+ }
+
+ return repo;
+ }
+
+ /**
+ * @param settingsPolicy
+ * @return a RepositoryPolicy
+ */
+ private static org.apache.maven.model.RepositoryPolicy convertRepositoryPolicy( RepositoryPolicy settingsPolicy )
+ {
+ org.apache.maven.model.RepositoryPolicy policy = new org.apache.maven.model.RepositoryPolicy();
+ policy.setEnabled( settingsPolicy.isEnabled() );
+ policy.setUpdatePolicy( settingsPolicy.getUpdatePolicy() );
+ policy.setChecksumPolicy( settingsPolicy.getChecksumPolicy() );
+ return policy;
+ }
+
+ /**
+ * @param modelRepo
+ * @return a repository
+ */
+ private static Repository convertToSettingsRepository( org.apache.maven.model.Repository modelRepo )
+ {
+ Repository repo = new Repository();
+
+ repo.setId( modelRepo.getId() );
+ repo.setLayout( modelRepo.getLayout() );
+ repo.setName( modelRepo.getName() );
+ repo.setUrl( modelRepo.getUrl() );
+
+ if ( modelRepo.getSnapshots() != null )
+ {
+ repo.setSnapshots( convertRepositoryPolicy( modelRepo.getSnapshots() ) );
+ }
+ if ( modelRepo.getReleases() != null )
+ {
+ repo.setReleases( convertRepositoryPolicy( modelRepo.getReleases() ) );
+ }
+
+ return repo;
+ }
+
+ /**
+ * @param modelPolicy
+ * @return a RepositoryPolicy
+ */
+ private static RepositoryPolicy convertRepositoryPolicy( org.apache.maven.model.RepositoryPolicy modelPolicy )
+ {
+ RepositoryPolicy policy = new RepositoryPolicy();
+ policy.setEnabled( modelPolicy.isEnabled() );
+ policy.setUpdatePolicy( modelPolicy.getUpdatePolicy() );
+ policy.setChecksumPolicy( modelPolicy.getChecksumPolicy() );
+ return policy;
+ }
+
+ /**
+ * @param settings could be null
+ * @return a new instance of settings or null if settings was null.
+ */
+ public static Settings copySettings( Settings settings )
+ {
+ if ( settings == null )
+ {
+ return null;
+ }
+
+ Settings clone = new Settings();
+ clone.setActiveProfiles( settings.getActiveProfiles() );
+ clone.setInteractiveMode( settings.isInteractiveMode() );
+ clone.setLocalRepository( settings.getLocalRepository() );
+ clone.setMirrors( settings.getMirrors() );
+ clone.setModelEncoding( settings.getModelEncoding() );
+ clone.setOffline( settings.isOffline() );
+ clone.setPluginGroups( settings.getPluginGroups() );
+ clone.setProfiles( settings.getProfiles() );
+ clone.setProxies( settings.getProxies() );
+ clone.setServers( settings.getServers() );
+ clone.setSourceLevel( settings.getSourceLevel() );
+ clone.setUsePluginRegistry( settings.isUsePluginRegistry() );
+
+ return clone;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java
new file mode 100644
index 00000000..043e5e68
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchain.java
@@ -0,0 +1,190 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Default abstract toolchain implementation, to be used as base class for any toolchain implementation
+ * to avoid rewriting usual code.
+ *
+ * @author mkleint
+ * @since 2.0.9
+ */
+public abstract class DefaultToolchain // should have been AbstractToolchain...
+ implements Toolchain, ToolchainPrivate
+{
+
+ private String type;
+
+ private Map<String, RequirementMatcher> provides = new HashMap<String, RequirementMatcher>();
+
+ public static final String KEY_TYPE = "type"; //NOI18N
+
+ private ToolchainModel model;
+
+ private Logger logger;
+
+ /**
+ *
+ * @param model the model, must not be {@code null}
+ * @param logger the logger, must not be {@code null}
+ */
+ protected DefaultToolchain( ToolchainModel model, Logger logger )
+ {
+ this.model = model;
+
+ this.logger = logger;
+ }
+
+ /**
+ *
+ * @param model the model, must not be {@code null}
+ * @param type the type
+ * @param logger the logger, must not be {@code null}
+ */
+ protected DefaultToolchain( ToolchainModel model, String type, Logger logger )
+ {
+ this( model, logger );
+ this.type = type;
+ }
+
+ @Override
+ public final String getType()
+ {
+ return type != null ? type : model.getType();
+ }
+
+ @Override
+ public final ToolchainModel getModel()
+ {
+ return model;
+ }
+
+ public final void addProvideToken( String type, RequirementMatcher matcher )
+ {
+ provides.put( type, matcher );
+ }
+
+ @Override
+ public boolean matchesRequirements( Map<String, String> requirements )
+ {
+ for ( Map.Entry<String, String> requirement : requirements.entrySet() )
+ {
+ String key = requirement.getKey();
+
+ RequirementMatcher matcher = provides.get( key );
+
+ if ( matcher == null )
+ {
+ getLog().debug( "Toolchain " + this + " is missing required property: " + key );
+ return false;
+ }
+ if ( !matcher.matches( requirement.getValue() ) )
+ {
+ getLog().debug( "Toolchain " + this + " doesn't match required property: " + key );
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected Logger getLog()
+ {
+ return logger;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( obj == null )
+ {
+ return false;
+ }
+
+ if ( this == obj )
+ {
+ return true;
+ }
+
+ if ( !( obj instanceof DefaultToolchain ) )
+ {
+ return false;
+ }
+
+ DefaultToolchain other = (DefaultToolchain) obj;
+
+ if ( type == null ? other.type != null : !type.equals( other.type ) )
+ {
+ return false;
+ }
+
+ Properties thisProvides = this.getModel().getProvides();
+ Properties otherProvides = other.getModel().getProvides();
+
+ if ( thisProvides == null ? otherProvides != null : !thisProvides.equals( otherProvides ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hashCode = ( type == null ) ? 0 : type.hashCode();
+
+ if ( this.getModel().getProvides() != null )
+ {
+ hashCode = 31 * hashCode + this.getModel().getProvides().hashCode();
+ }
+ return hashCode;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append( "type:" ).append( getType() );
+ builder.append( '{' );
+
+ Iterator<Map.Entry<String, RequirementMatcher>> providesIter = provides.entrySet().iterator();
+ while ( providesIter.hasNext() )
+ {
+ Map.Entry<String, RequirementMatcher> provideEntry = providesIter.next();
+ builder.append( provideEntry.getKey() ).append( " = " ).append( provideEntry.getValue() );
+ if ( providesIter.hasNext() )
+ {
+ builder.append( ';' );
+ }
+ }
+
+ builder.append( '}' );
+
+ return builder.toString();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
new file mode 100644
index 00000000..8093bbd6
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManager.java
@@ -0,0 +1,140 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * @author mkleint
+ */
+@Component( role = ToolchainManager.class )
+public class DefaultToolchainManager
+ implements ToolchainManager
+{
+ @Requirement
+ Logger logger;
+
+ @Requirement( role = ToolchainFactory.class )
+ Map<String, ToolchainFactory> factories;
+
+ @Override
+ public Toolchain getToolchainFromBuildContext( String type, MavenSession session )
+ {
+ Map<String, Object> context = retrieveContext( session );
+
+ ToolchainModel model = (ToolchainModel) context.get( getStorageKey( type ) );
+
+ if ( model != null )
+ {
+ List<Toolchain> toolchains = selectToolchains( Collections.singletonList( model ), type, null );
+
+ if ( !toolchains.isEmpty() )
+ {
+ return toolchains.get( 0 );
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public List<Toolchain> getToolchains( MavenSession session, String type, Map<String, String> requirements )
+ {
+ List<ToolchainModel> models = session.getRequest().getToolchains().get( type );
+
+ return selectToolchains( models, type, requirements );
+ }
+
+ private List<Toolchain> selectToolchains( List<ToolchainModel> models, String type,
+ Map<String, String> requirements )
+ {
+ List<Toolchain> toolchains = new ArrayList<Toolchain>();
+
+ if ( models != null )
+ {
+ ToolchainFactory fact = factories.get( type );
+
+ if ( fact == null )
+ {
+ logger.error( "Missing toolchain factory for type: " + type
+ + ". Possibly caused by misconfigured project." );
+ }
+ else
+ {
+ for ( ToolchainModel model : models )
+ {
+ try
+ {
+ ToolchainPrivate toolchain = fact.createToolchain( model );
+ if ( requirements == null || toolchain.matchesRequirements( requirements ) )
+ {
+ toolchains.add( toolchain );
+ }
+ }
+ catch ( MisconfiguredToolchainException ex )
+ {
+ logger.error( "Misconfigured toolchain.", ex );
+ }
+ }
+ }
+ }
+ return toolchains;
+ }
+
+ Map<String, Object> retrieveContext( MavenSession session )
+ {
+ Map<String, Object> context = null;
+
+ if ( session != null )
+ {
+ PluginDescriptor desc = new PluginDescriptor();
+ desc.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
+ desc.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( "toolchains" ) );
+
+ MavenProject current = session.getCurrentProject();
+
+ if ( current != null )
+ {
+ //TODO: why is this using the context
+ context = session.getPluginContext( desc, current );
+ }
+ }
+
+ return ( context != null ) ? context : new HashMap<String, Object>();
+ }
+
+ public static final String getStorageKey( String type )
+ {
+ return "toolchain-" + type; // NOI18N
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivate.java
new file mode 100644
index 00000000..cac8e297
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivate.java
@@ -0,0 +1,82 @@
+package org.apache.maven.toolchain;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * @author mkleint
+ * @author Robert Scholte
+ */
+@Component( role = ToolchainManagerPrivate.class )
+public class DefaultToolchainManagerPrivate
+ extends DefaultToolchainManager
+ implements ToolchainManagerPrivate
+{
+
+ @Override
+ public ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
+ throws MisconfiguredToolchainException
+ {
+ List<ToolchainPrivate> toRet = new ArrayList<ToolchainPrivate>();
+
+ ToolchainFactory fact = factories.get( type );
+ if ( fact == null )
+ {
+ logger.error( "Missing toolchain factory for type: " + type
+ + ". Possibly caused by misconfigured project." );
+ }
+ else
+ {
+ List<ToolchainModel> availableToolchains = context.getRequest().getToolchains().get( type );
+
+ if ( availableToolchains != null )
+ {
+ for ( ToolchainModel toolchainModel : availableToolchains )
+ {
+ toRet.add( fact.createToolchain( toolchainModel ) );
+ }
+ }
+
+ // add default toolchain
+ ToolchainPrivate tool = fact.createDefaultToolchain();
+ if ( tool != null )
+ {
+ toRet.add( tool );
+ }
+ }
+
+ return toRet.toArray( new ToolchainPrivate[toRet.size()] );
+ }
+
+ @Override
+ public void storeToolchainToBuildContext( ToolchainPrivate toolchain, MavenSession session )
+ {
+ Map<String, Object> context = retrieveContext( session );
+ context.put( getStorageKey( toolchain.getType() ), toolchain.getModel() );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java
new file mode 100644
index 00000000..5bd3e82a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java
@@ -0,0 +1,78 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.Reader;
+
+import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+
+/**
+ * @author Benjamin Bentmann
+ *
+ * @deprecated instead use {@link org.apache.maven.toolchain.building.DefaultToolchainsBuilder}
+ */
+@Deprecated
+@Component( role = ToolchainsBuilder.class, hint = "default" )
+public class DefaultToolchainsBuilder
+ implements ToolchainsBuilder
+{
+
+ @Requirement
+ private Logger logger;
+
+ public PersistedToolchains build( File userToolchainsFile )
+ throws MisconfiguredToolchainException
+ {
+ PersistedToolchains toolchains = null;
+
+ if ( userToolchainsFile != null && userToolchainsFile.isFile() )
+ {
+ Reader in = null;
+ try
+ {
+ in = ReaderFactory.newXmlReader( userToolchainsFile );
+ toolchains = new MavenToolchainsXpp3Reader().read( in );
+ }
+ catch ( Exception e )
+ {
+ throw new MisconfiguredToolchainException( "Cannot read toolchains file at "
+ + userToolchainsFile.getAbsolutePath(), e );
+ }
+ finally
+ {
+ IOUtil.close( in );
+ }
+ }
+ else if ( userToolchainsFile != null )
+ {
+ logger.debug( "Toolchains configuration was not found at " + userToolchainsFile );
+ }
+
+ return toolchains;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java
new file mode 100644
index 00000000..140bc804
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/MisconfiguredToolchainException.java
@@ -0,0 +1,39 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.
+ */
+
+/**
+ *
+ * @author mkleint
+ */
+public class MisconfiguredToolchainException
+ extends Exception
+{
+
+ public MisconfiguredToolchainException( String message )
+ {
+ super( message );
+ }
+
+ public MisconfiguredToolchainException( String message, Throwable orig )
+ {
+ super( message, orig );
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java
new file mode 100644
index 00000000..26390e40
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcher.java
@@ -0,0 +1,30 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.
+ */
+
+/**
+ *
+ * @author mkleint
+ */
+public interface RequirementMatcher
+{
+
+ boolean matches( String requirement );
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
new file mode 100644
index 00000000..3d6917bd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java
@@ -0,0 +1,109 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+
+/**
+ *
+ * @author mkleint
+ */
+public final class RequirementMatcherFactory
+{
+ private RequirementMatcherFactory()
+ {
+ }
+
+ public static RequirementMatcher createExactMatcher( String provideValue )
+ {
+ return new ExactMatcher( provideValue );
+ }
+
+ public static RequirementMatcher createVersionMatcher( String provideValue )
+ {
+ return new VersionMatcher( provideValue );
+ }
+
+ private static final class ExactMatcher
+ implements RequirementMatcher
+ {
+
+ private String provides;
+
+ private ExactMatcher( String provides )
+ {
+ this.provides = provides;
+ }
+
+ @Override
+ public boolean matches( String requirement )
+ {
+ return provides.equalsIgnoreCase( requirement );
+ }
+
+ @Override
+ public String toString()
+ {
+ return provides;
+ }
+ }
+
+ private static final class VersionMatcher
+ implements RequirementMatcher
+ {
+ DefaultArtifactVersion version;
+
+ private VersionMatcher( String version )
+ {
+ this.version = new DefaultArtifactVersion( version );
+ }
+
+ @Override
+ public boolean matches( String requirement )
+ {
+ try
+ {
+ VersionRange range = VersionRange.createFromVersionSpec( requirement );
+ if ( range.hasRestrictions() )
+ {
+ return range.containsVersion( version );
+ }
+ else
+ {
+ return range.getRecommendedVersion().compareTo( version ) == 0;
+ }
+ }
+ catch ( InvalidVersionSpecificationException ex )
+ {
+ //TODO error reporting
+ ex.printStackTrace();
+ return false;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return version.toString();
+ }
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java
new file mode 100644
index 00000000..2a713465
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/Toolchain.java
@@ -0,0 +1,46 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.
+ */
+
+/**
+ * Toolchain interface.
+ *
+ * @author Milos Kleint
+ * @author Jason van Zyl
+ * @since 2.0.9
+ */
+public interface Toolchain
+{
+
+ /**
+ * get the type of toolchain.
+ *
+ * @return the toolchain type
+ */
+ String getType();
+
+ /**
+ * Gets the platform tool executable.
+ *
+ * @param toolName the tool platform independent tool name.
+ * @return file representing the tool executable, or null if the tool can not be found
+ */
+ String findTool( String toolName );
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java
new file mode 100644
index 00000000..115eede3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java
@@ -0,0 +1,44 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.toolchain.model.ToolchainModel;
+
+/**
+ * Internal toolchain factory, to prepare toolchains instances.
+ *
+ * @author mkleint
+ * @since 2.0.9
+ */
+public interface ToolchainFactory
+{
+ /**
+ * Create instance of toolchain.
+ **/
+ ToolchainPrivate createToolchain( ToolchainModel model )
+ throws MisconfiguredToolchainException;
+
+ /**
+ * Returns the default instance of the particular type of toolchain, can return <code>null</code>
+ * if not applicable.
+ * TODO keep around??
+ **/
+ ToolchainPrivate createDefaultToolchain();
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java
new file mode 100644
index 00000000..8eddac54
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManager.java
@@ -0,0 +1,64 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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 java.util.Map;
+
+import org.apache.maven.execution.MavenSession;
+
+
+/**
+ * Public API for a toolchain-aware plugin to get expected toolchain instance.
+ *
+ * @author mkleint
+ * @author Robert Scholte
+ * @since 2.0.9
+ */
+public interface ToolchainManager
+{
+
+ // NOTE: Some plugins like Surefire access this field directly!
+ @Deprecated
+ String ROLE = ToolchainManager.class.getName();
+
+ /**
+ * Retrieve toolchain of specified type from build context. It is expected that
+ * <code>maven-toolchains-plugin</code> contains the configuration to select the appropriate
+ * toolchain and is executed at the beginning of the build.
+ *
+ * @param session the Maven session, must not be {@code null}
+ * @param type the type, must not be {@code null}
+ * @return the toolchain selected by <code>maven-toolchains-plugin</code>
+ */
+ Toolchain getToolchainFromBuildContext( String type, MavenSession context );
+
+ /**
+ * Select all toolchains available in user settings matching the type and requirements,
+ * independently from <code>maven-toolchains-plugin</code>.
+ *
+ * @param session the Maven session, must not be {@code null}
+ * @param type the type, must not be {@code null}
+ * @param requirements the requirements, may be {@code null}
+ * @return the matching toolchains, never {@code null}
+ * @since 3.3.0
+ */
+ List<Toolchain> getToolchains( MavenSession session, String type, Map<String, String> requirements );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java
new file mode 100644
index 00000000..6836bf1c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainManagerPrivate.java
@@ -0,0 +1,58 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.execution.MavenSession;
+
+/**
+ * Component for use by the <code>maven-toolchains-plugin</code> only.
+ * It provides API: <ol>
+ * <li>to retrieve every toolchains available in user settings,</li>
+ * <li>to store chosen toolchain into build context for later use by toolchain-aware plugins.</li>
+ * </ol>
+ *
+ * @author mkleint
+ * @since 2.0.9
+ * @see ToolchainManager#getToolchainFromBuildContext(String, MavenSession)
+ */
+public interface ToolchainManagerPrivate
+{
+
+ /**
+ * Retrieves every toolchains of given type available in user settings.
+ *
+ * @param type the type, must not be {@code null}
+ * @param context the Maven session, must not be {@code null}
+ * @since 3.0 (addition of the <code>MavenSession</code> parameter)
+ */
+ ToolchainPrivate[] getToolchainsForType( String type, MavenSession context )
+ throws MisconfiguredToolchainException;
+
+ /**
+ * Stores the toolchain into build context for later use by toolchain-aware plugins.
+ *
+ * @param toolchain the toolchain to store, must not be {@code null}
+ * @param context the Maven session, must not be {@code null}
+ * @since 2.0.9
+ * @see ToolchainManager#getToolchainFromBuildContext(String, MavenSession)
+ */
+ void storeToolchainToBuildContext( ToolchainPrivate toolchain, MavenSession context );
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java
new file mode 100644
index 00000000..756cd957
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainPrivate.java
@@ -0,0 +1,48 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.Map;
+
+import org.apache.maven.toolchain.model.ToolchainModel;
+
+/**
+ * a private contract between the toolchains plugin and the components.
+ * @author mkleint
+ */
+public interface ToolchainPrivate
+ extends Toolchain
+{
+
+ /**
+ * Let the toolchain decide if it matches requirements defined
+ * in the toolchain plugin configuration.
+ * @param requirements Map<String, String> key value pair, may not be {@code null}
+ * @return {@code true} if the requirements match, otherwise {@code false}
+ */
+ boolean matchesRequirements( Map<String, String> requirements );
+
+ /**
+ *
+ * @return the original model wrapped by this interface
+ */
+ ToolchainModel getModel();
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java
new file mode 100644
index 00000000..4bb4052a
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java
@@ -0,0 +1,46 @@
+package org.apache.maven.toolchain;
+
+/*
+ * 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.toolchain.model.PersistedToolchains;
+
+/**
+ * Builds the toolchains model from a previously configured filesystem path to the toolchains file.
+ * <strong>Note:</strong> This is an internal component whose interface can change without prior notice.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface ToolchainsBuilder
+{
+
+ /**
+ * Builds the toolchains model from the configured toolchain files.
+ *
+ * @param userToolchainsFile The path to the toolchains file, may be <code>null</code> to disable parsing.
+ * @return The toolchains model or <code>null</code> if no toolchain file was configured or the configured file does
+ * not exist.
+ * @throws MisconfiguredToolchainException If the toolchain file exists but cannot be parsed.
+ */
+ PersistedToolchains build( File userToolchainsFile )
+ throws MisconfiguredToolchainException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java
new file mode 100644
index 00000000..7983388b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java
@@ -0,0 +1,138 @@
+package org.apache.maven.toolchain.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.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.building.Problem;
+import org.apache.maven.building.ProblemCollector;
+import org.apache.maven.building.ProblemCollectorFactory;
+import org.apache.maven.building.Source;
+import org.apache.maven.toolchain.io.ToolchainsParseException;
+import org.apache.maven.toolchain.io.ToolchainsReader;
+import org.apache.maven.toolchain.merge.MavenToolchainMerger;
+import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.toolchain.model.TrackableBase;
+
+/**
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+@Named
+@Singleton
+public class DefaultToolchainsBuilder
+ implements ToolchainsBuilder
+{
+ private MavenToolchainMerger toolchainsMerger = new MavenToolchainMerger();
+
+ @Inject
+ private ToolchainsReader toolchainsReader;
+
+ @Override
+ public ToolchainsBuildingResult build( ToolchainsBuildingRequest request )
+ throws ToolchainsBuildingException
+ {
+ ProblemCollector problems = ProblemCollectorFactory.newInstance( null );
+
+ PersistedToolchains globalToolchains = readToolchains( request.getGlobalToolchainsSource(), request, problems );
+
+ PersistedToolchains userToolchains = readToolchains( request.getUserToolchainsSource(), request, problems );
+
+ toolchainsMerger.merge( userToolchains, globalToolchains, TrackableBase.GLOBAL_LEVEL );
+
+ problems.setSource( "" );
+
+ if ( hasErrors( problems.getProblems() ) )
+ {
+ throw new ToolchainsBuildingException( problems.getProblems() );
+ }
+
+
+ return new DefaultToolchainsBuildingResult( userToolchains, problems.getProblems() );
+ }
+
+ private PersistedToolchains readToolchains( Source toolchainsSource, ToolchainsBuildingRequest request,
+ ProblemCollector problems )
+ {
+ if ( toolchainsSource == null )
+ {
+ return new PersistedToolchains();
+ }
+
+ PersistedToolchains toolchains;
+
+ try
+ {
+ Map<String, ?> options = Collections.singletonMap( ToolchainsReader.IS_STRICT, Boolean.TRUE );
+
+ try
+ {
+ toolchains = toolchainsReader.read( toolchainsSource.getInputStream(), options );
+ }
+ catch ( ToolchainsParseException e )
+ {
+ options = Collections.singletonMap( ToolchainsReader.IS_STRICT, Boolean.FALSE );
+
+ toolchains = toolchainsReader.read( toolchainsSource.getInputStream(), options );
+
+ problems.add( Problem.Severity.WARNING, e.getMessage(), e.getLineNumber(), e.getColumnNumber(),
+ e );
+ }
+ }
+ catch ( ToolchainsParseException e )
+ {
+ problems.add( Problem.Severity.FATAL, "Non-parseable toolchains " + toolchainsSource.getLocation()
+ + ": " + e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ return new PersistedToolchains();
+ }
+ catch ( IOException e )
+ {
+ problems.add( Problem.Severity.FATAL, "Non-readable toolchains " + toolchainsSource.getLocation()
+ + ": " + e.getMessage(), -1, -1, e );
+ return new PersistedToolchains();
+ }
+
+ return toolchains;
+ }
+
+ private boolean hasErrors( List<Problem> problems )
+ {
+ if ( problems != null )
+ {
+ for ( Problem problem : problems )
+ {
+ if ( Problem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 )
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingRequest.java
new file mode 100644
index 00000000..144d724c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingRequest.java
@@ -0,0 +1,63 @@
+package org.apache.maven.toolchain.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;
+
+/**
+ * Collects toolchains that control building of effective toolchains.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public class DefaultToolchainsBuildingRequest
+ implements ToolchainsBuildingRequest
+{
+ private Source globalToolchainsSource;
+
+ private Source userToolchainsSource;
+
+ @Override
+ public Source getGlobalToolchainsSource()
+ {
+ return globalToolchainsSource;
+ }
+
+ @Override
+ public ToolchainsBuildingRequest setGlobalToolchainsSource( Source globalToolchainsSource )
+ {
+ this.globalToolchainsSource = globalToolchainsSource;
+ return this;
+ }
+
+ @Override
+ public Source getUserToolchainsSource()
+ {
+ return userToolchainsSource;
+ }
+
+ @Override
+ public ToolchainsBuildingRequest setUserToolchainsSource( Source userToolchainsSource )
+ {
+ this.userToolchainsSource = userToolchainsSource;
+ return this;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
new file mode 100644
index 00000000..60ca2441
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
@@ -0,0 +1,66 @@
+package org.apache.maven.toolchain.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.building.Problem;
+import org.apache.maven.toolchain.model.PersistedToolchains;
+
+/**
+ * Holds the result of the merged toolchains and holds the problems during this build, if any.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public class DefaultToolchainsBuildingResult
+ implements ToolchainsBuildingResult
+{
+
+ private PersistedToolchains effectiveToolchains;
+
+ private List<Problem> problems;
+
+ /**
+ * Default constructor
+ *
+ * @param effectiveToolchains the merged toolchains, may not be {@code null}
+ * @param problems the problems while building the effectiveToolchains, if any.
+ */
+ public DefaultToolchainsBuildingResult( PersistedToolchains effectiveToolchains, List<Problem> problems )
+ {
+ this.effectiveToolchains = effectiveToolchains;
+ this.problems = ( problems != null ) ? problems : new ArrayList<Problem>();
+ }
+
+ @Override
+ public PersistedToolchains getEffectiveToolchains()
+ {
+ return effectiveToolchains;
+ }
+
+ @Override
+ public List<Problem> getProblems()
+ {
+ return problems;
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuilder.java
new file mode 100644
index 00000000..b2ef0d10
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuilder.java
@@ -0,0 +1,41 @@
+package org.apache.maven.toolchain.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Builds the effective toolchains from a user toolchains file and/or a global toolchains file.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public interface ToolchainsBuilder
+{
+
+ /**
+ * Builds the effective toolchains of the specified toolchains files.
+ *
+ * @param request The toolchains building request that holds the parameters, must not be {@code null}.
+ * @return The result of the toolchains building, never {@code null}.
+ * @throws ToolchainsBuildingException If the effective toolchains could not be built.
+ */
+ ToolchainsBuildingResult build( ToolchainsBuildingRequest request )
+ throws ToolchainsBuildingException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingException.java
new file mode 100644
index 00000000..56ed1d3e
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingException.java
@@ -0,0 +1,93 @@
+package org.apache.maven.toolchain.building;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.building.Problem;
+
+/**
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public class ToolchainsBuildingException
+ extends Exception
+{
+
+ private final List<Problem> problems;
+
+ /**
+ * Creates a new exception with the specified problems.
+ *
+ * @param problems The problems that causes this exception, must not be {@code null}.
+ */
+ public ToolchainsBuildingException( List<Problem> problems )
+ {
+ super( toMessage( problems ) );
+
+ this.problems = new ArrayList<Problem>();
+ if ( problems != null )
+ {
+ this.problems.addAll( problems );
+ }
+ }
+
+ /**
+ * Gets the problems that caused this exception.
+ *
+ * @return The problems that caused this exception, never {@code null}.
+ */
+ public List<Problem> getProblems()
+ {
+ return problems;
+ }
+
+ private static String toMessage( List<Problem> 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 toolchains" );
+ writer.println();
+
+ for ( Problem problem : problems )
+ {
+ writer.print( "[" );
+ writer.print( problem.getSeverity() );
+ writer.print( "] " );
+ writer.print( problem.getMessage() );
+ String location = problem.getLocation();
+ if ( !location.isEmpty() )
+ {
+ writer.print( " @ " );
+ writer.print( location );
+ }
+ writer.println();
+ }
+
+ return buffer.toString();
+ }
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingRequest.java
new file mode 100644
index 00000000..cf65d4cd
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingRequest.java
@@ -0,0 +1,64 @@
+package org.apache.maven.toolchain.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;
+
+/**
+ * Collects toolchains that control the building of effective toolchains.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public interface ToolchainsBuildingRequest
+{
+
+ /**
+ * Gets the global toolchains source.
+ *
+ * @return The global toolchains source or {@code null} if none.
+ */
+ Source getGlobalToolchainsSource();
+
+ /**
+ * Sets the global toolchains source. If both user toolchains and a global toolchains are given, the user toolchains
+ * take precedence.
+ *
+ * @param globalToolchainsSource The global toolchains source, may be {@code null} to disable global toolchains.
+ * @return This request, never {@code null}.
+ */
+ ToolchainsBuildingRequest setGlobalToolchainsSource( Source globalToolchainsSource );
+
+ /**
+ * Gets the user toolchains source.
+ *
+ * @return The user toolchains source or {@code null} if none.
+ */
+ Source getUserToolchainsSource();
+
+ /**
+ * Sets the user toolchains source. If both user toolchains and a global toolchains are given, the user toolchains
+ * take precedence.
+ *
+ * @param userToolchainsSource The user toolchains source, may be {@code null} to disable user toolchains.
+ * @return This request, never {@code null}.
+ */
+ ToolchainsBuildingRequest setUserToolchainsSource( Source userToolchainsSource );
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java
new file mode 100644
index 00000000..592fb98c
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java
@@ -0,0 +1,50 @@
+package org.apache.maven.toolchain.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.building.Problem;
+import org.apache.maven.toolchain.model.PersistedToolchains;
+
+/**
+ * Collects the output of the toolchains builder.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public interface ToolchainsBuildingResult
+{
+
+ /**
+ * Gets the assembled toolchains.
+ *
+ * @return The assembled toolchains, never {@code null}.
+ */
+ PersistedToolchains getEffectiveToolchains();
+
+ /**
+ * Return a list of problems, if any.
+ *
+ * @return a list of problems, never {@code null}.
+ */
+ List<Problem> getProblems();
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
new file mode 100644
index 00000000..8aeefe8b
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
@@ -0,0 +1,115 @@
+package org.apache.maven.toolchain.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 javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.toolchain.model.io.xpp3.MavenToolchainsXpp3Reader;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Handles deserialization of toolchains from the default textual format.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+@Named
+@Singleton
+public class DefaultToolchainsReader
+ implements ToolchainsReader
+{
+
+ @Override
+ public PersistedToolchains read( File input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input file missing" );
+ }
+
+ return read( ReaderFactory.newXmlReader( input ), options );
+ }
+
+ @Override
+ public PersistedToolchains read( Reader input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input reader missing" );
+ }
+
+ try
+ {
+ MavenToolchainsXpp3Reader r = new MavenToolchainsXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new ToolchainsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ @Override
+ public PersistedToolchains read( InputStream input, Map<String, ?> options )
+ throws IOException
+ {
+ if ( input == null )
+ {
+ throw new IllegalArgumentException( "input stream missing" );
+ }
+
+ try
+ {
+ MavenToolchainsXpp3Reader r = new MavenToolchainsXpp3Reader();
+ return r.read( input, isStrict( options ) );
+ }
+ catch ( XmlPullParserException e )
+ {
+ throw new ToolchainsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e );
+ }
+ finally
+ {
+ IOUtil.close( input );
+ }
+ }
+
+ private boolean isStrict( Map<String, ?> options )
+ {
+ Object value = ( options != null ) ? options.get( IS_STRICT ) : null;
+ return value == null || Boolean.parseBoolean( value.toString() );
+ }
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsParseException.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsParseException.java
new file mode 100644
index 00000000..95c2aed8
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsParseException.java
@@ -0,0 +1,94 @@
+package org.apache.maven.toolchain.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 toolchains due to invalid syntax (e.g. non-wellformed XML or unknown elements).
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public class ToolchainsParseException
+ 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 ToolchainsParseException( 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 ToolchainsParseException( 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-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsReader.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsReader.java
new file mode 100644
index 00000000..44dc2bdc
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/io/ToolchainsReader.java
@@ -0,0 +1,83 @@
+package org.apache.maven.toolchain.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.toolchain.model.PersistedToolchains;
+
+/**
+ * Handles deserialization of toolchains from some kind of textual format like XML.
+ *
+ * @author Robert Scholte
+ * @since 3.3.0
+ */
+public interface ToolchainsReader
+{
+
+ /**
+ * 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.toolchains.io.isStrict";
+
+ /**
+ * Reads the toolchains from the specified file.
+ *
+ * @param input The file to deserialize the toolchains 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 toolchains, never {@code null}.
+ * @throws IOException If the toolchains could not be deserialized.
+ * @throws ToolchainsParseException If the input format could not be parsed.
+ */
+ PersistedToolchains read( File input, Map<String, ?> options )
+ throws IOException, ToolchainsParseException;
+
+ /**
+ * Reads the toolchains from the specified character reader. The reader will be automatically closed before the
+ * method returns.
+ *
+ * @param input The reader to deserialize the toolchains 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 toolchains, never {@code null}.
+ * @throws IOException If the toolchains could not be deserialized.
+ * @throws ToolchainsParseException If the input format could not be parsed.
+ */
+ PersistedToolchains read( Reader input, Map<String, ?> options )
+ throws IOException, ToolchainsParseException;
+
+ /**
+ * Reads the toolchains from the specified byte stream. The stream will be automatically closed before the method
+ * returns.
+ *
+ * @param input The stream to deserialize the toolchains 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 toolchains, never {@code null}.
+ * @throws IOException If the toolchains could not be deserialized.
+ * @throws ToolchainsParseException If the input format could not be parsed.
+ */
+ PersistedToolchains read( InputStream input, Map<String, ?> options )
+ throws IOException, ToolchainsParseException;
+
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java
new file mode 100644
index 00000000..9cfcff38
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/DefaultJavaToolChain.java
@@ -0,0 +1,55 @@
+package org.apache.maven.toolchain.java;
+
+/*
+ * 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.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.logging.Logger;
+
+/**
+ * Provides backwards compatibility with Maven 3.2.3 and earlier. Clients that do not require compatibility with Maven
+ * 3.2.3 and earlier are encouraged to use {@link JavaToolchainImpl}.
+ * <strong>Note:</strong> This is an internal component whose interface can change without prior notice.
+ *
+ * @deprecated clients that do not require compatibility with Maven 3.2.3 and earlier should link to
+ * {@link JavaToolchainImpl} instead.
+ */
+public class DefaultJavaToolChain
+ extends JavaToolchainImpl
+{
+ public static final String KEY_JAVAHOME = JavaToolchainImpl.KEY_JAVAHOME;
+
+ public DefaultJavaToolChain( ToolchainModel model, Logger logger )
+ {
+ super( model, logger );
+ }
+
+ @Override
+ public String getJavaHome()
+ {
+ return super.getJavaHome();
+ }
+
+ @Override
+ public void setJavaHome( String javaHome )
+ {
+ super.setJavaHome( javaHome );
+ }
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java
new file mode 100644
index 00000000..cb14ada1
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchain.java
@@ -0,0 +1,67 @@
+package org.apache.maven.toolchain.java;
+
+/*
+ * 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.toolchain.Toolchain;
+
+/**
+ * JDK toolchain interface.
+ *
+ * @author Jason van Zyl
+ * @author Milos Kleint
+ * @since 2.0.9, renamed from JavaToolChain in 3.2.4
+ */
+public interface JavaToolchain
+ extends Toolchain
+{
+// /**
+// * Returns a list of {@link java.io.File}s which represents the bootstrap libraries for the
+// * runtime environment. The Bootstrap libraries include libraries in JRE's
+// * extension directory, if there are any.
+// *
+// * @return List
+// */
+// List getBootstrapLibraries();
+//
+// /**
+// * Returns a list of {@link java.io.File}s which represent the libraries recognized by
+// * default by the platform. Usually it corresponds to contents of CLASSPATH
+// * environment variable.
+// *
+// * @return List
+// */
+// List getStandardLibraries();
+//
+// /**
+// * Returns a {@link java.io.File}s which represent the locations of the source of the JDK,
+// * or an empty collection when the location is not set or is invalid.
+// *
+// * @return List
+// */
+// List getSourceDirectories();
+//
+// /**
+// * Returns a {@link java.io.File}s which represent the locations of the Javadoc for this platform,
+// * or empty collection if the location is not set or invalid
+// *
+// * @return List
+// */
+// List getJavadocFolders();
+}
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java
new file mode 100644
index 00000000..cd4aef01
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java
@@ -0,0 +1,127 @@
+package org.apache.maven.toolchain.java;
+
+/*
+ * 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.Map.Entry;
+import java.util.Properties;
+
+import org.apache.maven.toolchain.MisconfiguredToolchainException;
+import org.apache.maven.toolchain.RequirementMatcher;
+import org.apache.maven.toolchain.RequirementMatcherFactory;
+import org.apache.maven.toolchain.ToolchainFactory;
+import org.apache.maven.toolchain.ToolchainPrivate;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * JDK toolchain factory.
+ * This is a <code>ToolchainFactory</code> Plexus component registered with
+ * <code>jdk</code> hint.
+ *
+ * @author mkleint
+ * @since 2.0.9, renamed from <code>DefaultJavaToolchainFactory</code> in 3.2.4
+ */
+@Component( role = ToolchainFactory.class, hint = "jdk" )
+public class JavaToolchainFactory
+ implements ToolchainFactory
+{
+
+ @Requirement
+ private Logger logger;
+
+ public ToolchainPrivate createToolchain( ToolchainModel model )
+ throws MisconfiguredToolchainException
+ {
+ if ( model == null )
+ {
+ return null;
+ }
+
+ // use DefaultJavaToolChain for compatibility with maven 3.2.3 and earlier
+
+ @SuppressWarnings( "deprecation" )
+ JavaToolchainImpl jtc = new DefaultJavaToolChain( model, logger );
+
+ // populate the provides section
+ Properties provides = model.getProvides();
+ for ( Entry<Object, Object> provide : provides.entrySet() )
+ {
+ String key = (String) provide.getKey();
+ String value = (String) provide.getValue();
+
+ if ( value == null )
+ {
+ throw new MisconfiguredToolchainException(
+ "Provides token '" + key + "' doesn't have any value configured." );
+ }
+
+ RequirementMatcher matcher;
+ if ( "version".equals( key ) )
+ {
+ matcher = RequirementMatcherFactory.createVersionMatcher( value );
+ }
+ else
+ {
+ matcher = RequirementMatcherFactory.createExactMatcher( value );
+ }
+
+ jtc.addProvideToken( key, matcher );
+ }
+
+ // populate the configuration section
+ Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
+ Xpp3Dom javahome = dom.getChild( JavaToolchainImpl.KEY_JAVAHOME );
+ if ( javahome == null )
+ {
+ throw new MisconfiguredToolchainException( "Java toolchain without the "
+ + JavaToolchainImpl.KEY_JAVAHOME + " configuration element." );
+ }
+ File normal = new File( FileUtils.normalize( javahome.getValue() ) );
+ if ( normal.exists() )
+ {
+ jtc.setJavaHome( FileUtils.normalize( javahome.getValue() ) );
+ }
+ else
+ {
+ throw new MisconfiguredToolchainException( "Non-existing JDK home configuration at "
+ + normal.getAbsolutePath() );
+ }
+
+ return jtc;
+ }
+
+ public ToolchainPrivate createDefaultToolchain()
+ {
+ //not sure it's necessary to provide a default toolchain here.
+ //only version can be eventually supplied, and
+ return null;
+ }
+
+ protected Logger getLogger()
+ {
+ return logger;
+ }
+
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java
new file mode 100644
index 00000000..4a09ee06
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainImpl.java
@@ -0,0 +1,87 @@
+package org.apache.maven.toolchain.java;
+
+/*
+ * 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.toolchain.DefaultToolchain;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.Os;
+
+/**
+ * JDK toolchain implementation.
+ *
+ * @author Milos Kleint
+ * @since 2.0.9, renamed from DefaultJavaToolChain in 3.2.4
+ */
+class JavaToolchainImpl
+ extends DefaultToolchain
+ implements JavaToolchain
+{
+ private String javaHome;
+
+ public static final String KEY_JAVAHOME = "jdkHome"; //NOI18N
+
+ public JavaToolchainImpl( ToolchainModel model, Logger logger )
+ {
+ super( model, "jdk", logger );
+ }
+
+ public String getJavaHome()
+ {
+ return javaHome;
+ }
+
+ public void setJavaHome( String javaHome )
+ {
+ this.javaHome = javaHome;
+ }
+
+ public String toString()
+ {
+ return "JDK[" + getJavaHome() + "]";
+ }
+
+ public String findTool( String toolName )
+ {
+ File toRet = findTool( toolName, new File( FileUtils.normalize( getJavaHome() ) ) );
+ if ( toRet != null )
+ {
+ return toRet.getAbsolutePath();
+ }
+ return null;
+ }
+
+ private static File findTool( String toolName, File installFolder )
+ {
+ File bin = new File( installFolder, "bin" ); //NOI18N
+ if ( bin.exists() )
+ {
+ File tool = new File( bin, toolName + ( Os.isFamily( "windows" ) ? ".exe" : "" ) ); // NOI18N
+ if ( tool.exists() )
+ {
+ return tool;
+ }
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/merge/MavenToolchainMerger.java b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/merge/MavenToolchainMerger.java
new file mode 100644
index 00000000..538f79b3
--- /dev/null
+++ b/framework/src/maven/apache-maven-3.3.3/maven-core/src/main/java/org/apache/maven/toolchain/merge/MavenToolchainMerger.java
@@ -0,0 +1,103 @@
+package org.apache.maven.toolchain.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.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.maven.toolchain.model.PersistedToolchains;
+import org.apache.maven.toolchain.model.ToolchainModel;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ *
+ * @author Robert Scholte
+ * @since 3.2.4
+ */
+public class MavenToolchainMerger
+{
+
+ public void merge( PersistedToolchains dominant, PersistedToolchains recessive, String recessiveSourceLevel )
+ {
+ if ( dominant == null || recessive == null )
+ {
+ return;
+ }
+
+ recessive.setSourceLevel( recessiveSourceLevel );
+
+ shallowMerge( dominant.getToolchains(), recessive.getToolchains(), recessiveSourceLevel );
+ }
+
+ private void shallowMerge( List<ToolchainModel> dominant, List<ToolchainModel> recessive,
+ String recessiveSourceLevel )
+ {
+ Map<Object, ToolchainModel> merged = new LinkedHashMap<Object, ToolchainModel>();
+
+ for ( ToolchainModel dominantModel : dominant )
+ {
+ Object key = getToolchainModelKey( dominantModel );
+
+ merged.put( key, dominantModel );
+ }
+
+ for ( ToolchainModel recessiveModel : recessive )
+ {
+ Object key = getToolchainModelKey( recessiveModel );
+
+ ToolchainModel dominantModel = merged.get( key );
+ if ( dominantModel == null )
+ {
+ recessiveModel.setSourceLevel( recessiveSourceLevel );
+ dominant.add( recessiveModel );
+ }
+ else
+ {
+ mergeToolchainModel_Configuration( dominantModel, recessiveModel );
+ }
+ }
+ }
+
+ protected void mergeToolchainModel_Configuration( ToolchainModel target,
+ ToolchainModel source )
+ {
+ Xpp3Dom src = (Xpp3Dom) source.getConfiguration();
+ if ( src != null )
+ {
+ Xpp3Dom tgt = (Xpp3Dom) target.getConfiguration();
+ if ( tgt == null )
+ {
+ tgt = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( src ), tgt );
+ }
+ else
+ {
+ tgt = Xpp3Dom.mergeXpp3Dom( tgt, src );
+ }
+ target.setConfiguration( tgt );
+ }
+ }
+
+ protected Object getToolchainModelKey( ToolchainModel model )
+ {
+ return model;
+ }
+
+} \ No newline at end of file