[MNG-7553] New clean API with immutable model (#703) master
authorGuillaume Nodet <gnodet@gmail.com>
Sun, 2 Oct 2022 08:41:25 +0000 (10:41 +0200)
committerGitHub <noreply@github.com>
Sun, 2 Oct 2022 08:41:25 +0000 (10:41 +0200)
542 files changed:
apache-maven/src/assembly/maven/bin/m2.conf
apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
api/maven-api-core/pom.xml [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Event.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Metadata.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/MetadataStorage.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Node.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Project.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/RepositoryMetadata.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/ResolutionScope.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Scope.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Service.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Session.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Type.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/Version.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Component.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/InstantiationStrategy.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/LifecyclePhase.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactoryRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverResult.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorResult.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactoryRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/LocalRepositoryManager.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/Lookup.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/MavenException.java [moved from maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java with 52% similarity]
api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilderFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblemSeverity.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderResult.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderSource.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectManager.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/Prompter.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/PrompterException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/RepositoryFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManager.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/ToolchainManagerException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/TypeRegistry.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParser.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/VersionParserException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/ModelXmlFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/SettingsXmlFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/ToolchainsXmlFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlFactory.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterException.java [new file with mode: 0644]
api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlWriterRequest.java [new file with mode: 0644]
api/maven-api-meta/pom.xml [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Consumer.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Experimental.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Generated.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Immutable.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Nonnull.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/NotThreadSafe.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Nullable.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/Provider.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/ThreadSafe.java [new file with mode: 0644]
api/maven-api-meta/src/main/java/org/apache/maven/api/annotations/package-info.java [new file with mode: 0644]
api/maven-api-model/pom.xml [new file with mode: 0644]
api/maven-api-model/src/main/java/org/apache/maven/api/model/ImmutableCollections.java [new file with mode: 0644]
api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocation.java [new file with mode: 0644]
api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocationTracker.java [new file with mode: 0644]
api/maven-api-model/src/main/java/org/apache/maven/api/model/InputSource.java [new file with mode: 0644]
api/maven-api-model/src/main/java/org/apache/maven/api/model/package-info.java [moved from maven-model/src/main/java/org/apache/maven/model/package-info.java with 96% similarity]
api/maven-api-model/src/main/mdo/common.vm [new file with mode: 0644]
api/maven-api-model/src/main/mdo/maven.mdo [moved from maven-model/src/main/mdo/maven.mdo with 84% similarity]
api/maven-api-model/src/main/mdo/model.vm [new file with mode: 0644]
api/maven-api-settings/pom.xml [new file with mode: 0644]
api/maven-api-settings/src/main/java/org/apache/maven/api/settings/ImmutableCollections.java [new file with mode: 0644]
api/maven-api-settings/src/main/mdo/common.vm [new file with mode: 0644]
api/maven-api-settings/src/main/mdo/model.vm [new file with mode: 0644]
api/maven-api-settings/src/main/mdo/settings.mdo [moved from maven-settings/src/main/mdo/settings.mdo with 99% similarity]
api/maven-api-settings/src/site/apt/index.apt [new file with mode: 0644]
api/maven-api-settings/src/site/site.xml [new file with mode: 0644]
api/maven-api-toolchain/pom.xml [new file with mode: 0644]
api/maven-api-toolchain/src/main/java/org/apache/maven/api/toolchain/ImmutableCollections.java [new file with mode: 0644]
api/maven-api-toolchain/src/main/mdo/common.vm [new file with mode: 0644]
api/maven-api-toolchain/src/main/mdo/model.vm [new file with mode: 0644]
api/maven-api-toolchain/src/main/mdo/toolchains.mdo [moved from maven-toolchain-model/src/main/mdo/toolchains.mdo with 98% similarity]
api/maven-api-xml/pom.xml [new file with mode: 0644]
api/maven-api-xml/src/main/java/org/apache/maven/api/xml/Dom.java [new file with mode: 0644]
api/modello-plugin-velocity/pom.xml [new file with mode: 0644]
api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/Helper.java [new file with mode: 0644]
api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/ModelloVelocityMojo.java [new file with mode: 0644]
api/modello-plugin-velocity/src/main/java/org/codehaus/modello/plugin/velocity/VelocityGenerator.java [new file with mode: 0644]
api/modello-plugin-velocity/src/main/resources/META-INF/plexus/components.xml [new file with mode: 0644]
api/pom.xml [new file with mode: 0644]
build/checkstyle-suppressions.xml
maven-bom/pom.xml
maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java
maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java
maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java [deleted file]
maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java
maven-core/pom.xml
maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven-core/src/main/java/org/apache/maven/artifact/handler/DefaultArtifactHandler.java
maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java
maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedComponentConfigurator.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConfigurationConverter.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedConverterLookup.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulator.java
maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
maven-core/src/main/java/org/apache/maven/execution/SettingsAdapter.java [deleted file]
maven-core/src/main/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeModule.java
maven-core/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
maven-core/src/main/java/org/apache/maven/internal/impl/AbstractNode.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/AbstractSession.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifact.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactCoordinate.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactCoordinateFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactDeployer.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactInstaller.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactManager.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultArtifactResolver.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultDependency.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultDependencyCollector.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultDependencyCoordinate.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultDependencyCoordinateFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultEvent.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLocalRepository.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLocalRepositoryManager.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLog.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultLookup.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilder.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMessageBuilderFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultModelXmlFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultMojoExecution.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultNode.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectBuilder.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectManager.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultPrompter.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultRemoteRepository.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultRepositoryFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSession.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSessionFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultSettingsXmlFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainManager.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultToolchainsXmlFactory.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultTypeRegistry.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/DefaultVersionParser.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/EventSpyImpl.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/MappedCollection.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/MappedList.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/Utils.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/internal/impl/WrapperNode.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultMojoExecutionConfigurator.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultProjectArtifactFactory.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolver.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoDescriptorCreator.java
maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/BuilderCommon.java
maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMojo.java
maven-core/src/main/java/org/apache/maven/lifecycle/providers/AbstractLifecycleProvider.java
maven-core/src/main/java/org/apache/maven/lifecycle/providers/CleanLifecycleProvider.java
maven-core/src/main/java/org/apache/maven/model/plugin/DefaultLifecycleBindingsInjector.java
maven-core/src/main/java/org/apache/maven/plugin/CycleDetectedInPluginGraphException.java
maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorV4.java [new file with mode: 0644]
maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
maven-core/src/main/java/org/apache/maven/project/ExtensionDescriptorBuilder.java
maven-core/src/main/java/org/apache/maven/project/MavenProject.java
maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java
maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java
maven-core/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java
maven-core/src/main/java/org/apache/maven/project/artifact/ProjectArtifact.java
maven-core/src/main/java/org/apache/maven/session/scope/internal/SessionScopeModule.java
maven-core/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java
maven-core/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java
maven-core/src/main/java/org/apache/maven/settings/SettingsUtils.java
maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainManagerPrivate.java
maven-core/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java
maven-core/src/main/java/org/apache/maven/toolchain/ToolchainFactory.java
maven-core/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java
maven-core/src/main/java/org/apache/maven/toolchain/java/JavaToolchainFactory.java
maven-core/src/main/resources/META-INF/maven/extension.xml
maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorPathTest.java [new file with mode: 0644]
maven-core/src/test/java/org/apache/maven/internal/impl/TestApi.java [new file with mode: 0644]
maven-core/src/test/java/org/apache/maven/internal/impl/TestArtifactHandler.java [new file with mode: 0644]
maven-core/src/test/java/org/apache/maven/internal/impl/TestRepositorySystem.java [new file with mode: 0644]
maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/LifecycleExecutionPlanCalculatorStub.java
maven-core/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java
maven-core/src/test/java/org/apache/maven/project/ProjectModelResolverTest.java
maven-core/src/test/java/org/apache/maven/project/ProjectSorterTest.java
maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomAttributeIterator.java
maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodeIterator.java
maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomNodePointer.java
maven-core/src/test/java/org/apache/maven/project/harness/Xpp3DomPointerFactory.java
maven-core/src/test/java/org/apache/maven/repository/TestRepositorySystem.java
maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
maven-core/src/test/java/org/apache/maven/settings/SettingsUtilsTest.java
maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainManagerTest.java
maven-core/src/test/java/org/apache/maven/toolchain/DefaultToolchainTest.java
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.3/commons-logging-1.0.3.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.3/commons-logging-1.0.3.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.3/commons-logging-1.0.3.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.3/commons-logging-1.0.3.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.4/commons-logging-1.0.4-javadoc-resources.jar.lastUpdated [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.4/commons-logging-1.0.4.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.4/commons-logging-1.0.4.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.4/commons-logging-1.0.4.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/commons-logging/1.0.4/commons-logging-1.0.4.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/apache/3/apache-3.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/apache/3/apache-3.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/apache/3/apache-3.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/artifact/maven-artifact/3.0-SNAPSHOT/maven-artifact-3.0-SNAPSHOT.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-extension/1/test-extension-1.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-extension/1/test-extension-1.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-extension/1/test-extension-1.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-extension/1/test-extension-1.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-lifecycle-and-artifactHandler/1/test-lifecycle-and-artifactHandler-1.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-lifecycle-and-artifactHandler/1/test-lifecycle-and-artifactHandler-1.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-lifecycle-and-artifactHandler/1/test-lifecycle-and-artifactHandler-1.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/core/test/test-lifecycle-and-artifactHandler/1/test-lifecycle-and-artifactHandler-1.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/4/maven-parent-4.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/4/maven-parent-4.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/4/maven-parent-4.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/5/maven-parent-5.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/5/maven-parent-5.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/maven-parent/5/maven-parent-5.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-provider-api/1.0-beta-2/wagon-provider-api-1.0-beta-2.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-providers/1.0-beta-2/wagon-providers-1.0-beta-2.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-providers/1.0-beta-2/wagon-providers-1.0-beta-2.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-providers/1.0-beta-2/wagon-providers-1.0-beta-2.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon-webdav/1.0-beta-2/wagon-webdav-1.0-beta-2.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/apache/maven/wagon/wagon/1.0-beta-2/wagon-1.0-beta-2.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-active-collections/1.0-beta-1/plexus-active-collections-1.0-beta-1.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-10/plexus-classworlds-1.2-alpha-10.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-classworlds/1.2-alpha-7/plexus-classworlds-1.2-alpha-7.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/plexus-component-api-1.0-alpha-16.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-component-api/1.0-alpha-32/plexus-component-api-1.0-alpha-32.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-components/1.1.6/plexus-components-1.1.6.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-16/plexus-container-default-1.0-alpha-16.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-container-default/1.0-alpha-32/plexus-container-default-1.0-alpha-32.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-16/plexus-containers-1.0-alpha-16.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-16/plexus-containers-1.0-alpha-16.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-16/plexus-containers-1.0-alpha-16.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-32/plexus-containers-1.0-alpha-32.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-32/plexus-containers-1.0-alpha-32.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-containers/1.0-alpha-32/plexus-containers-1.0-alpha-32.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.jar.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus-utils/1.4.5/plexus-utils-1.4.5.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.10/plexus-1.0.10.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.11/plexus-1.0.11.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.4/plexus-1.0.4.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.8/plexus-1.0.8.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.9/plexus-1.0.9.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.9/plexus-1.0.9.pom.md5 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/codehaus/plexus/plexus/1.0.9/plexus-1.0.9.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc-resources.jar.lastUpdated [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.pom.sha1 [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom [new file with mode: 0644]
maven-core/src/test/resources/apiv4-repo/org/hamcrest/hamcrest-parent/1.3/hamcrest-parent-1.3.pom.sha1 [new file with mode: 0644]
maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
maven-embedder/src/main/java/org/apache/maven/cli/configuration/SettingsXmlConfigurationProcessor.java
maven-embedder/src/main/java/org/apache/maven/cli/internal/BootstrapCoreExtensionManager.java
maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java [new file with mode: 0644]
maven-model-builder/pom.xml
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuildingEvent.java
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelProcessor.java
maven-model-builder/src/main/java/org/apache/maven/model/building/FileToRawModelMerger.java
maven-model-builder/src/main/java/org/apache/maven/model/building/ModelCacheTag.java
maven-model-builder/src/main/java/org/apache/maven/model/building/ModelProblemUtils.java
maven-model-builder/src/main/java/org/apache/maven/model/composition/DefaultDependencyManagementImporter.java
maven-model-builder/src/main/java/org/apache/maven/model/composition/DependencyManagementImporter.java
maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java
maven-model-builder/src/main/java/org/apache/maven/model/inheritance/InheritanceAssembler.java
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/ModelInterpolator.java
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java [deleted file]
maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringVisitorModelInterpolator.java
maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelReader.java
maven-model-builder/src/main/java/org/apache/maven/model/io/DefaultModelWriter.java
maven-model-builder/src/main/java/org/apache/maven/model/io/ModelReader.java
maven-model-builder/src/main/java/org/apache/maven/model/io/ModelWriter.java
maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultDependencyManagementInjector.java
maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java
maven-model-builder/src/main/java/org/apache/maven/model/merge/MavenModelMerger.java
maven-model-builder/src/main/java/org/apache/maven/model/normalization/DefaultModelNormalizer.java
maven-model-builder/src/main/java/org/apache/maven/model/normalization/ModelNormalizer.java
maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelPathTranslator.java
maven-model-builder/src/main/java/org/apache/maven/model/path/DefaultModelUrlNormalizer.java
maven-model-builder/src/main/java/org/apache/maven/model/path/ProfileActivationFilePathInterpolator.java
maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportConfigurationExpander.java
maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultReportingConverter.java
maven-model-builder/src/main/java/org/apache/maven/model/profile/DefaultProfileInjector.java
maven-model-builder/src/main/java/org/apache/maven/model/resolution/InvalidRepositoryException.java
maven-model-builder/src/main/java/org/apache/maven/model/resolution/ModelResolver.java
maven-model-builder/src/main/java/org/apache/maven/model/superpom/DefaultSuperPomProvider.java
maven-model-builder/src/main/java/org/apache/maven/model/superpom/SuperPomProvider.java
maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderFactoryTest.java
maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderTest.java
maven-model-builder/src/test/java/org/apache/maven/model/building/FileToRawModelMergerTest.java
maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java [deleted file]
maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringVisitorModelInterpolatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/merge/MavenModelMergerTest.java
maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/AbstractProfileActivatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/FileProfileActivatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/PropertyProfileActivatorTest.java
maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
maven-model-transform/src/main/java/org/apache/maven/model/transform/pull/BufferingParser.java
maven-model/pom.xml
maven-model/src/main/java/org/apache/maven/model/BaseObject.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/InputLocation.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/InputLocationTracker.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/InputSource.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/WrapperList.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/WrapperProperties.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3Reader.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3Writer.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3WriterEx.java [new file with mode: 0644]
maven-model/src/main/java/org/apache/maven/model/merge/ModelMerger.java [deleted file]
maven-model/src/main/mdo/common.vm [new file with mode: 0644]
maven-model/src/main/mdo/merger.vm [new file with mode: 0644]
maven-model/src/main/mdo/model-v3.vm [new file with mode: 0644]
maven-model/src/main/mdo/reader-ex.vm [new file with mode: 0644]
maven-model/src/main/mdo/reader.vm [new file with mode: 0644]
maven-model/src/main/mdo/transformer.vm [new file with mode: 0644]
maven-model/src/main/mdo/writer-ex.vm [new file with mode: 0644]
maven-model/src/main/mdo/writer.vm [new file with mode: 0644]
maven-model/src/test/java/org/apache/maven/model/merge/MavenMergerTest.java [moved from maven-model/src/test/java/org/apache/maven/model/merge/ModelMergerTest.java with 84% similarity]
maven-plugin-api/pom.xml
maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
maven-plugin-api/src/main/java/org/apache/maven/plugin/lifecycle/ImmutableCollections.java [new file with mode: 0644]
maven-plugin-api/src/main/mdo/common.vm [new file with mode: 0644]
maven-plugin-api/src/main/mdo/merger.vm [new file with mode: 0644]
maven-plugin-api/src/main/mdo/model.vm [new file with mode: 0644]
maven-plugin-api/src/main/mdo/reader.vm [new file with mode: 0644]
maven-plugin-api/src/main/mdo/writer.vm [new file with mode: 0644]
maven-resolver-provider/pom.xml
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/ArtifactDescriptorUtils.java
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultModelResolver.java
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataInfoProvider.java
maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/RelocatedArtifact.java
maven-resolver-provider/src/test/java/org/apache/maven/repository/internal/DefaultModelResolverTest.java
maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingResult.java
maven-settings-builder/src/main/java/org/apache/maven/settings/building/SettingsBuildingResult.java
maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecrypter.java
maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionRequest.java
maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/DefaultSettingsDecryptionResult.java
maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionRequest.java
maven-settings-builder/src/main/java/org/apache/maven/settings/crypto/SettingsDecryptionResult.java
maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsReader.java
maven-settings-builder/src/main/java/org/apache/maven/settings/io/SettingsWriter.java
maven-settings-builder/src/main/java/org/apache/maven/settings/merge/MavenSettingsMerger.java
maven-settings-builder/src/main/java/org/apache/maven/settings/validation/DefaultSettingsValidator.java
maven-settings-builder/src/main/java/org/apache/maven/settings/validation/SettingsValidator.java
maven-settings-builder/src/test/java/org/apache/maven/settings/validation/DefaultSettingsValidatorTest.java
maven-settings/pom.xml
maven-settings/src/main/java/org/apache/maven/settings/WrapperList.java [new file with mode: 0644]
maven-settings/src/main/java/org/apache/maven/settings/WrapperProperties.java [new file with mode: 0644]
maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Reader.java [new file with mode: 0644]
maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Writer.java [new file with mode: 0644]
maven-settings/src/main/mdo/common.vm [new file with mode: 0644]
maven-settings/src/main/mdo/merger.vm [new file with mode: 0644]
maven-settings/src/main/mdo/model-v3.vm [new file with mode: 0644]
maven-settings/src/main/mdo/reader.vm [new file with mode: 0644]
maven-settings/src/main/mdo/writer.vm [new file with mode: 0644]
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilder.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/DefaultToolchainsBuildingResult.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/building/ToolchainsBuildingResult.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsWriter.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/ToolchainsReader.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/ToolchainsWriter.java
maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/merge/MavenToolchainMerger.java
maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/building/DefaultToolchainsBuilderTest.java
maven-toolchain-builder/src/test/java/org/apache/maven/toolchain/merge/MavenToolchainMergerTest.java
maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/merge/toolchains-jdks-extend.xml [moved from maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks-extend.xml with 100% similarity]
maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/merge/toolchains-jdks-extra.xml [moved from maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks-extra.xml with 100% similarity]
maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/merge/toolchains-jdks.xml [moved from maven-toolchain-builder/src/test/resources/org/apache/maven/toolchain/model/toolchains-jdks.xml with 100% similarity]
maven-toolchain-model/pom.xml
maven-toolchain-model/src/main/java/org/apache/maven/toolchain/model/WrapperList.java [new file with mode: 0644]
maven-toolchain-model/src/main/java/org/apache/maven/toolchain/model/WrapperProperties.java [new file with mode: 0644]
maven-toolchain-model/src/main/mdo/common.vm [new file with mode: 0644]
maven-toolchain-model/src/main/mdo/merger.vm [new file with mode: 0644]
maven-toolchain-model/src/main/mdo/model-v3.vm [new file with mode: 0644]
maven-toolchain-model/src/main/mdo/reader.vm [new file with mode: 0644]
maven-toolchain-model/src/main/mdo/writer.vm [new file with mode: 0644]
maven-xml-impl/pom.xml [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/DomBuilder.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/MavenXmlException.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/XmlPlexusConfiguration.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/Xpp3Dom.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/Xpp3DomBuilder.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/apache/maven/internal/xml/Xpp3DomWriter.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java [new file with mode: 0644]
maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java [new file with mode: 0644]
plexus-utils/pom.xml [new file with mode: 0644]
pom.xml

index c44656832dce472b6fa42244f12a1ecc3a2c68d4..c050dc07bf1abb2e71634a96273cec47017bca63 100644 (file)
@@ -7,4 +7,5 @@ load       ${maven.conf}/logging
 optionally ${maven.home}/lib/ext/redisson/*.jar
 optionally ${maven.home}/lib/ext/hazelcast/*.jar
 optionally ${maven.home}/lib/ext/*.jar
+load       ${maven.home}/lib/maven-*.jar
 load       ${maven.home}/lib/*.jar
index 70a11151fe53c2a2766b482fea2b1f4c20bc880e..7d1853b7a703fca3cc59a18b5ca1c00648e9e9fd 100644 (file)
@@ -25,7 +25,7 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+import org.apache.maven.settings.v4.SettingsXpp3Reader;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
diff --git a/api/maven-api-core/pom.xml b/api/maven-api-core/pom.xml
new file mode 100644 (file)
index 0000000..6ffef24
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-api</artifactId>
+    <version>4.0.0-alpha-1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-api-core</artifactId>
+  <name>Apache Maven Core API</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-api-meta</artifactId>
+      <version>4.0.0-alpha-1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-api-model</artifactId>
+      <version>4.0.0-alpha-1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-api-settings</artifactId>
+      <version>4.0.0-alpha-1-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-api-toolchain</artifactId>
+      <version>4.0.0-alpha-1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
new file mode 100644 (file)
index 0000000..5ebbc97
--- /dev/null
@@ -0,0 +1,107 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * An artifact points to a resource such as a jar file or war application.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface Artifact
+{
+
+    /**
+     * Returns a unique identifier for this artifact.
+     * The identifier is composed of groupId, artifactId, version, classifier, extension
+     * @return the unique identifier
+     */
+    default String key()
+    {
+        return getGroupId()
+                + ':' + getArtifactId()
+                + ':' + getExtension()
+                + ( getClassifier().length() > 0 ? ":" + getClassifier() : "" )
+                + ':' + getVersion();
+    }
+
+    /**
+     * The groupId of the artifact.
+     *
+     * @return The groupId.
+     */
+    @Nonnull
+    String getGroupId();
+
+    /**
+     * The artifactId of the artifact.
+     *
+     * @return The artifactId.
+     */
+    @Nonnull
+    String getArtifactId();
+
+    /**
+     * The version of the artifact.
+     *
+     * @return The version.
+     */
+    @Nonnull
+    Version getVersion();
+
+    /**
+     * The classifier of the artifact.
+     *
+     * @return The classifier or an empty string if none, never {@code null}.
+     */
+    @Nonnull
+    String getClassifier();
+
+    /**
+     * The file extension of the artifact.
+     *
+     * @return The extension.
+     */
+    @Nonnull
+    String getExtension();
+
+    /**
+     * Determines whether this artifact uses a snapshot version.
+     *
+     * @return {@code true} if the artifact is a snapshot, {@code false} otherwise.
+     * @see org.apache.maven.api.Session#isVersionSnapshot(String)
+     */
+    boolean isSnapshot();
+
+    /**
+     * Shortcut for {@code session.createArtifactCoordinate(artifact)}
+     *
+     * @return an {@link ArtifactCoordinate}
+     * @see org.apache.maven.api.Session#createArtifactCoordinate(Artifact)
+     */
+    @Nonnull
+    ArtifactCoordinate toCoordinate();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java
new file mode 100644 (file)
index 0000000..1f11e32
--- /dev/null
@@ -0,0 +1,89 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * The {@code Coordinate} object is used to point to an {@link Artifact}
+ * but the version may be specified as a range instead of an exact version.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactCoordinate
+{
+
+    /**
+     * The groupId of the artifact.
+     *
+     * @return The groupId.
+     */
+    @Nonnull
+    String getGroupId();
+
+    /**
+     * The artifactId of the artifact.
+     *
+     * @return The artifactId.
+     */
+    @Nonnull
+    String getArtifactId();
+
+    /**
+     * The classifier of the artifact.
+     *
+     * @return The classifier or an empty string if none, never {@code null}.
+     */
+    @Nonnull
+    String getClassifier();
+
+    /**
+     * The version of the artifact.
+     *
+     * @return The version.
+     */
+    @Nonnull
+    VersionRange getVersion();
+
+    /**
+     * The extension of the artifact.
+     *
+     * @return The extension or an empty string if none, never {@code null}.
+     */
+    @Nonnull
+    String getExtension();
+
+    /**
+     * Unique id identifying this artifact
+     */
+    default String getId()
+    {
+        return getGroupId()
+                + ":" + getArtifactId()
+                + ":" + getExtension()
+                + ( getClassifier().isEmpty() ? "" : ":" + getClassifier() )
+                + ":" + getVersion();
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
new file mode 100644 (file)
index 0000000..51fa632
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Nonnull;
+
+public interface Dependency extends Artifact
+{
+
+    /**
+     * The artifact type.
+     *
+     * @return The artifact type, never {@code null}.
+     */
+    @Nonnull
+    Type getType();
+
+    Scope getScope();
+
+    boolean isOptional();
+
+    /**
+     * Shortcut for {@code session.createDependencyCoordinate(dependency)}
+     *
+     * @return an {@link DependencyCoordinate}
+     * @see org.apache.maven.api.Session#createDependencyCoordinate(Dependency)
+     */
+    @Nonnull
+    DependencyCoordinate toCoordinate();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinate.java
new file mode 100644 (file)
index 0000000..e5ea7a4
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.Immutable;
+
+import java.util.Collection;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface DependencyCoordinate extends ArtifactCoordinate
+{
+    /**
+     * The type of the artifact.
+     *
+     * @return The type.
+     */
+    @Nonnull
+    Type getType();
+
+    @Nonnull
+    Scope getScope();
+
+    @Nullable
+    Boolean getOptional();
+
+    @Nonnull
+    Collection<Exclusion> getExclusions();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Event.java
new file mode 100644 (file)
index 0000000..0a30dba
--- /dev/null
@@ -0,0 +1,77 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.util.Optional;
+
+/**
+ * Event sent by maven during various phases of the build process.
+ * Such events can be listened to using {@link Listener}s objects
+ * registered in the {@link Session}.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface Event
+{
+
+    /**
+     * Gets the type of the event.
+     *
+     * @return The type of the event, never {@code null}.
+     */
+    @Nonnull
+    EventType getType();
+
+    /**
+     * Gets the session from which this event originates.
+     *
+     * @return The current session, never {@code null}.
+     */
+    @Nonnull
+    Session getSession();
+
+    /**
+     * Gets the current project (if any).
+     *
+     * @return The current project or {@code empty()} if not applicable.
+     */
+    @Nonnull
+    Optional<Project> getProject();
+
+    /**
+     * Gets the current mojo execution (if any).
+     *
+     * @return The current mojo execution or {@code empty()} if not applicable.
+     */
+    @Nonnull
+    Optional<MojoExecution> getMojoExecution();
+
+    /**
+     * Gets the exception that caused the event (if any).
+     *
+     * @return The exception or {@code empty()} if none.
+     */
+    Optional<Exception> getException();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java b/api/maven-api-core/src/main/java/org/apache/maven/api/EventType.java
new file mode 100644 (file)
index 0000000..0279d12
--- /dev/null
@@ -0,0 +1,49 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * The possible types of execution events.
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum EventType
+{
+    PROJECT_DISCOVERY_STARTED,
+    SESSION_STARTED,
+    SESSION_ENDED,
+    PROJECT_SKIPPED,
+    PROJECT_STARTED,
+    PROJECT_SUCCEEDED,
+    PROJECT_FAILED,
+    MOJO_SKIPPED,
+    MOJO_STARTED,
+    MOJO_SUCCEEDED,
+    MOJO_FAILED,
+    FORK_STARTED,
+    FORK_SUCCEEDED,
+    FORK_FAILED,
+    FORKED_PROJECT_STARTED,
+    FORKED_PROJECT_SUCCEEDED,
+    FORKED_PROJECT_FAILED,
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
new file mode 100644 (file)
index 0000000..143c6d2
--- /dev/null
@@ -0,0 +1,40 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nullable;
+
+/**
+ * A dependency exlusion.
+ *
+ * @since 4.0
+ * @see DependencyCoordinate#getExclusions()
+ */
+@Experimental
+public interface Exclusion
+{
+    @Nullable
+    String getGroupId();
+
+    @Nullable
+    String getArtifactId();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java b/api/maven-api-core/src/main/java/org/apache/maven/api/JavaToolchain.java
new file mode 100644 (file)
index 0000000..21eefa4
--- /dev/null
@@ -0,0 +1,35 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * A specific {@link Toolchain} dedicated for Java.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface JavaToolchain extends Toolchain
+{
+
+    String getJavaHome();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Listener.java
new file mode 100644 (file)
index 0000000..924ddae
--- /dev/null
@@ -0,0 +1,36 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A listener for session events.
+ *
+ * @since 4.0
+ */
+@Experimental
+@FunctionalInterface @Consumer
+public interface Listener
+{
+    void onEvent( @Nonnull Event event );
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
new file mode 100644 (file)
index 0000000..4d1101f
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * The local repository is used to cache artifacts downloaded from {@link RemoteRepository}
+ * and to hold artifacts that have been build locally.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface LocalRepository extends Repository
+{
+
+    @Nonnull
+    Path getPath();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Metadata.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Metadata.java
new file mode 100644 (file)
index 0000000..d86aef6
--- /dev/null
@@ -0,0 +1,41 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * TODO: investigate removing the Metadata api completely
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface Metadata
+{
+
+    String getGroupId();
+
+    String getArtifactId();
+
+    String getVersion();
+
+    MetadataStorage getStorage();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/MetadataStorage.java b/api/maven-api-core/src/main/java/org/apache/maven/api/MetadataStorage.java
new file mode 100644 (file)
index 0000000..1b988cf
--- /dev/null
@@ -0,0 +1,35 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * Storage location for metadata
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum MetadataStorage
+{
+    GROUP,
+    ARTIFACT,
+    VERSION
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java b/api/maven-api-core/src/main/java/org/apache/maven/api/MojoExecution.java
new file mode 100644 (file)
index 0000000..0d7ffd1
--- /dev/null
@@ -0,0 +1,47 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import org.apache.maven.api.model.Plugin;
+import org.apache.maven.api.xml.Dom;
+
+/**
+ * A {@code MojoExecution}
+ */
+@Experimental
+public interface MojoExecution
+{
+    @Nonnull
+    Plugin getPlugin();
+
+    @Nonnull
+    String getExecutionId();
+
+    @Nonnull
+    String getGoal();
+
+    @Nonnull
+    Optional<Dom> getConfiguration();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
new file mode 100644 (file)
index 0000000..f0bb78b
--- /dev/null
@@ -0,0 +1,103 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+/**
+ * Represents a dependency node within a Maven project's dependency collector.
+ *
+ * @since 4.0
+ * @see org.apache.maven.api.services.DependencyCollectorResult#getRoot()
+ */
+@Experimental
+@Immutable
+public interface Node
+{
+
+    /**
+     * @return dependency for this node
+     */
+    Dependency getDependency();
+
+    /**
+     * Gets the child nodes of this node.
+     *
+     * @return the child nodes of this node, never {@code null}
+     */
+    @Nonnull
+    List<Node> getChildren();
+
+    /**
+     * @return repositories of this node
+     */
+    @Nonnull
+    List<RemoteRepository> getRemoteRepositories();
+
+    /**
+     * The repository where this artifact has been downloaded from.
+     */
+    @Nonnull
+    Optional<RemoteRepository> getRepository();
+
+    /**
+     * Traverses this node and potentially its children using the specified visitor.
+     *
+     * @param visitor The visitor to call back, must not be {@code null}.
+     * @return {@code true} to visit siblings nodes of this node as well, {@code false} to skip siblings.
+     */
+    boolean accept( @Nonnull NodeVisitor visitor );
+
+    /**
+     * Returns a new tree starting at this node, filtering the children.
+     * Note that this node will not be filtered and only the children
+     * and its descendant will be checked.
+     *
+     * @param filter the filter to apply
+     * @return a new filtered graph
+     */
+    Node filter( Predicate<Node> filter );
+
+    /**
+     * Returns a string representation of this dependency node.
+     *
+     * @return the string representation
+     */
+    String asString();
+
+    /**
+     * Obtain a Stream containing this node and all its descendant.
+     *
+     * @return a stream containing this node and its descendant
+     */
+    @Nonnull
+    default Stream<Node> stream()
+    {
+        return Stream.concat( Stream.of( this ), getChildren().stream().flatMap( Node::stream ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java b/api/maven-api-core/src/main/java/org/apache/maven/api/NodeVisitor.java
new file mode 100644 (file)
index 0000000..39ae803
--- /dev/null
@@ -0,0 +1,53 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Defines a hierarchical visitor for collecting dependency node trees.
+ * 
+ * @since 4.0
+ */
+@Experimental
+@Consumer
+public interface NodeVisitor
+{
+    /**
+     * Starts the visit to the specified dependency node.
+     * 
+     * @param node the dependency node to visit
+     * @return <code>true</code> to visit the specified dependency node's children, <code>false</code> to skip the
+     *         specified dependency node's children and proceed to its next sibling
+     */
+    boolean enter( @Nonnull Node node );
+
+    /**
+     * Ends the visit to the specified dependency node.
+     *
+     * @param node the dependency node to visit
+     * @return <code>true</code> to visit the specified dependency node's next sibling, <code>false</code> to skip the
+     *         specified dependency node's next siblings and proceed to its parent
+     */
+    boolean leave( @Nonnull Node node );
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
new file mode 100644 (file)
index 0000000..0531724
--- /dev/null
@@ -0,0 +1,105 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.Build;
+import org.apache.maven.api.model.Model;
+
+/**
+ * Interface representing a Maven project.
+ * Projects can be built using the {@link org.apache.maven.api.services.ProjectBuilder} service.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface Project
+{
+
+    @Nonnull
+    String getGroupId();
+
+    @Nonnull
+    String getArtifactId();
+
+    @Nonnull
+    String getVersion();
+
+    @Nonnull
+    String getPackaging();
+
+    @Nonnull
+    Artifact getArtifact();
+
+    @Nonnull
+    Model getModel();
+
+    @Nonnull
+    default Build getBuild()
+    {
+        Build build = getModel().getBuild();
+        return build != null ? build : Build.newInstance();
+    }
+
+    /**
+     * Returns the path to the pom file for this project.
+     * A project is usually read from the file system and this will point to
+     * the file.  In some cases, a transient project can be created which
+     * will not point to an actual pom file.
+     * @return the path of the pom
+     */
+    @Nonnull
+    Optional<Path> getPomPath();
+
+    @Nonnull
+    default Optional<Path> getBasedir()
+    {
+        return getPomPath().map( Path::getParent );
+    }
+
+    @Nonnull
+    List<DependencyCoordinate> getDependencies();
+
+    @Nonnull
+    List<DependencyCoordinate> getManagedDependencies();
+
+    @Nonnull
+    default String getId()
+    {
+        return getModel().getId();
+    }
+
+    boolean isExecutionRoot();
+
+    @Nonnull
+    Optional<Project> getParent();
+
+    @Nonnull
+    List<RemoteRepository> getRemoteProjectRepositories();
+
+    @Nonnull
+    List<RemoteRepository> getRemotePluginRepositories();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
new file mode 100644 (file)
index 0000000..4dd629f
--- /dev/null
@@ -0,0 +1,40 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A remote repository that can be used to download or upload artifacts.
+ */
+@Experimental
+@Immutable
+public interface RemoteRepository extends Repository
+{
+
+    @Nonnull
+    String getUrl();
+
+    @Nonnull
+    String getProtocol();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
new file mode 100644 (file)
index 0000000..10551d7
--- /dev/null
@@ -0,0 +1,54 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A repository holds artifacts.
+ *
+ * @since 4.0
+ * @see RemoteRepository
+ * @see LocalRepository
+ */
+@Experimental
+@Immutable
+public interface Repository
+{
+
+    /**
+     * Gets the identifier of this repository.
+     *
+     * @return The (case-sensitive) identifier, never {@code null}.
+     */
+    @Nonnull
+    String getId();
+
+    /**
+     * Gets the type of the repository, for example "default".
+     *
+     * @return The (case-sensitive) type of the repository, never {@code null}.
+     */
+    @Nonnull
+    String getType();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/RepositoryMetadata.java b/api/maven-api-core/src/main/java/org/apache/maven/api/RepositoryMetadata.java
new file mode 100644 (file)
index 0000000..a648796
--- /dev/null
@@ -0,0 +1,31 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface RepositoryMetadata extends Metadata
+{
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ResolutionScope.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ResolutionScope.java
new file mode 100644 (file)
index 0000000..a68dc52
--- /dev/null
@@ -0,0 +1,104 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Dependencies resolution scopes available before
+ * <a href="/ref/current/maven-core/apidocs/org/apache/maven/lifecycle/internal/MojoExecutor.html">mojo execution</a>.
+ *
+ * Important note: The {@code id} values of this enum correspond to constants of
+ * {@code org.apache.maven.artifact.Artifact} class and MUST BE KEPT IN SYNC.
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum ResolutionScope
+{
+    /**
+     * empty resolution scope
+     */
+    NONE( null ),
+    /**
+     * <code>compile</code> resolution scope
+     * = <code>compile</code> + <code>system</code> + <code>provided</code> dependencies
+     */
+    COMPILE( "compile", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED ),
+    /**
+     * <code>compile+runtime</code> resolution scope (Maven 3 only)
+     * = <code>compile</code> + <code>system</code> + <code>provided</code> + <code>runtime</code> dependencies
+     */
+    COMPILE_PLUS_RUNTIME( "compile+runtime", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME ),
+    /**
+     * <code>runtime</code> resolution scope
+     * = <code>compile</code> + <code>runtime</code> dependencies
+     */
+    RUNTIME( "runtime", Scope.COMPILE, Scope.RUNTIME ),
+    /**
+     * <code>runtime+system</code> resolution scope (Maven 3 only)
+     * = <code>compile</code> + <code>system</code> + <code>runtime</code> dependencies
+     */
+    RUNTIME_PLUS_SYSTEM( "runtime+system", Scope.COMPILE, Scope.SYSTEM, Scope.RUNTIME ),
+    /**
+     * <code>test</code> resolution scope
+     * = <code>compile</code> + <code>system</code> + <code>provided</code> + <code>runtime</code> + <code>test</code>
+     * dependencies
+     */
+    TEST( "test", Scope.COMPILE, Scope.SYSTEM, Scope.PROVIDED, Scope.RUNTIME, Scope.TEST );
+
+    private static final Map<String, ResolutionScope> VALUES
+            = Stream.of( ResolutionScope.values() ).collect( Collectors.toMap( ResolutionScope::id, s -> s ) );
+
+    public static ResolutionScope fromString( String id )
+    {
+        return Optional.ofNullable( VALUES.get( id ) )
+                .orElseThrow( () -> new IllegalArgumentException( "Unknown resolution scope " + id ) );
+    }
+
+    private final String id;
+    private final Set<Scope> scopes;
+
+    ResolutionScope( String id, Scope... scopes )
+    {
+        this.id = id;
+        this.scopes = Collections.unmodifiableSet( new HashSet<>( Arrays.asList( scopes ) ) );
+    }
+
+    public String id()
+    {
+        return this.id;
+    }
+
+    public Set<Scope> scopes()
+    {
+        return scopes;
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Scope.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Scope.java
new file mode 100644 (file)
index 0000000..f246e9f
--- /dev/null
@@ -0,0 +1,57 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Scope for a dependency
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum Scope
+{
+    COMPILE( "compile" ),
+    PROVIDED ( "provided" ),
+    SYSTEM( "system" ),
+    RUNTIME( "runtime" ),
+    TEST( "test" ),
+    IMPORT( "import" );
+
+    private final String id;
+
+    Scope( String id )
+    {
+        this.id = id;
+    }
+
+    public String id()
+    {
+        return this.id;
+    }
+
+    public static Scope get( String scope )
+    {
+        return Enum.valueOf( Scope.class, scope.toUpperCase( Locale.ROOT ) );
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Service.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Service.java
new file mode 100644 (file)
index 0000000..a4cabca
--- /dev/null
@@ -0,0 +1,37 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+/**
+ * Marker interface for all services provided by the {@link Session}.
+ * <p>
+ * Services can be retrieved from the session using the
+ * {@link Session#getService(Class)} method.
+ * 
+ * @see Session#getService(Class) 
+ */
+@Experimental
+@ThreadSafe
+public interface Service
+{
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java
new file mode 100644 (file)
index 0000000..0d0cf07
--- /dev/null
@@ -0,0 +1,346 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+import java.time.Instant;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.Properties;
+
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.ThreadSafe;
+import org.apache.maven.api.model.Repository;
+import org.apache.maven.api.services.DependencyCoordinateFactory;
+import org.apache.maven.api.settings.Settings;
+
+/**
+ * The session to install / deploy / resolve artifacts and dependencies.
+ *
+ * @since 4.0
+ */
+@Experimental
+@ThreadSafe
+public interface Session
+{
+
+    @Nonnull
+    Settings getSettings();
+
+    @Nonnull
+    LocalRepository getLocalRepository();
+
+    @Nonnull
+    List<RemoteRepository> getRemoteRepositories();
+
+    @Nonnull
+    SessionData getData();
+
+    // TODO: investigate using Map<String, String> or Map<String, Object> for all properties in the new API
+    @Nonnull
+    Properties getUserProperties();
+
+    @Nonnull
+    Properties getSystemProperties();
+
+    /**
+     * Returns the current maven version
+     * @return the maven version, never {@code null}.
+     */
+    @Nonnull
+    String getMavenVersion();
+
+    int getDegreeOfConcurrency();
+
+    @Nonnull
+    Instant getStartTime();
+
+    @Nonnull
+    Path getMultiModuleProjectDirectory();
+
+    @Nonnull
+    Path getExecutionRootDirectory();
+
+    @Nonnull
+    List<Project> getProjects();
+
+    /**
+     * Returns the plugin context for mojo being executed and the specified
+     * {@link Project}, never returns {@code null} as if context not present, creates it.
+     *
+     * <strong>Implementation note:</strong> while this method return type is {@link Map}, the returned map instance
+     * implements {@link java.util.concurrent.ConcurrentMap} as well.
+     *
+     * @throws org.apache.maven.api.services.MavenException if not called from the within a mojo execution
+     */
+    @Nonnull
+    Map<String, Object> getPluginContext( @Nonnull Project project );
+
+    /**
+     * Retrieves the service for the interface
+     *
+     * @throws NoSuchElementException if the service could not be found
+     */
+    @Nonnull
+    <T extends Service> T getService( @Nonnull Class<T> clazz );
+
+    /**
+     * Creates a derived session using the given local repository.
+     *
+     * @param localRepository the new local repository
+     * @return the derived session
+     * @throws NullPointerException if {@code localRepository} is null
+     */
+    @Nonnull
+    Session withLocalRepository( @Nonnull LocalRepository localRepository );
+
+    /**
+     * Creates a derived session using the given remote repositories.
+     *
+     * @param repositories the new list of remote repositories
+     * @return the derived session
+     * @throws NullPointerException if {@code repositories} is null
+     */
+    @Nonnull
+    Session withRemoteRepositories( @Nonnull List<RemoteRepository> repositories );
+
+    /**
+     * Register the given listener which will receive all events.
+     *
+     * @param listener the listener to register
+     * @throws NullPointerException if {@code listener} is null
+     */
+    void registerListener( @Nonnull Listener listener );
+
+    /**
+     * Unregisters a previously registered listener.
+     *
+     * @param listener the listener to unregister
+     * @throws NullPointerException if {@code listener} is null
+     */
+    void unregisterListener( @Nonnull Listener listener );
+
+    /**
+     * Returns the list of registered listeners.
+     *
+     * @return an immutable collection of listeners, never {@code null}
+     */
+    @Nonnull
+    Collection<Listener> getListeners();
+
+    /**
+     * Shortcut for <code>getService(RepositoryFactory.class).createLocal(...)</code>
+     * @see org.apache.maven.api.services.RepositoryFactory#createLocal(Path)
+     */
+    LocalRepository createLocalRepository( Path path );
+
+    /**
+     * Shortcut for <code>getService(RepositoryFactory.class).createRemote(...)</code>
+     * @see org.apache.maven.api.services.RepositoryFactory#createRemote(String, String)
+     */
+    @Nonnull
+    RemoteRepository createRemoteRepository( @Nonnull String id, @Nonnull String url );
+
+    /**
+     * Shortcut for <code>getService(RepositoryFactory.class).createRemote(...)</code>
+     * @see org.apache.maven.api.services.RepositoryFactory#createRemote(Repository)
+     */
+    @Nonnull
+    RemoteRepository createRemoteRepository( @Nonnull Repository repository );
+
+    /**
+     * Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
+     * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String)
+     */
+    ArtifactCoordinate createArtifactCoordinate( String groupId, String artifactId, String version, String extension );
+
+    /**
+     * Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
+     * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
+     */
+    ArtifactCoordinate createArtifactCoordinate( String groupId, String artifactId, String version, String classifier,
+                                                 String extension, String type );
+
+    /**
+     * Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
+     * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
+     */
+    ArtifactCoordinate createArtifactCoordinate( Artifact artifact );
+
+    /**
+     * Shortcut for <code>getService(DependencyFactory.class).create(...)</code>
+     * @see DependencyCoordinateFactory#create(Session, ArtifactCoordinate)
+     */
+    @Nonnull
+    DependencyCoordinate createDependencyCoordinate( @Nonnull ArtifactCoordinate coordinate );
+
+    /**
+     * Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
+     * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String)
+     */
+    Artifact createArtifact( String groupId, String artifactId, String version, String extension );
+
+    /**
+     * Shortcut for <code>getService(ArtifactFactory.class).create(...)</code>
+     * @see org.apache.maven.api.services.ArtifactFactory#create(Session, String, String, String, String, String, String)
+     */
+    Artifact createArtifact( String groupId, String artifactId, String version, String classifier,
+                             String extension, String type );
+
+    /**
+     * Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+     */
+    Artifact resolveArtifact( ArtifactCoordinate coordinate );
+
+    /**
+     * Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+     */
+    Collection<Artifact> resolveArtifacts( ArtifactCoordinate... coordinates );
+
+    /**
+     * Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+     */
+    Collection<Artifact> resolveArtifacts( Collection<? extends ArtifactCoordinate> coordinates );
+
+    /**
+     * Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+     */
+    Artifact resolveArtifact( Artifact artifact );
+
+    /**
+     * Shortcut for <code>getService(ArtifactResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.ArtifactResolver#resolve(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactResolverException if the artifact resolution failed
+     */
+    Collection<Artifact> resolveArtifacts( Artifact... artifacts );
+
+    /**
+     * Shortcut for {@code getService(ArtifactInstaller.class).install(...)}
+     * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
+     */
+    void installArtifacts( Artifact... artifacts );
+
+    /**
+     * Shortcut for {@code getService(ArtifactInstaller.class).install(...)}
+     * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactInstallerException if the artifacts installation failed
+     */
+    void installArtifacts( Collection<Artifact> artifacts );
+
+    /**
+     * Shortcut for <code>getService(ArtifactDeployer.class).deploy(...)</code>
+     * @see org.apache.maven.api.services.ArtifactDeployer#deploy(Session, RemoteRepository, Collection)
+     *
+     * @throws org.apache.maven.api.services.ArtifactDeployerException if the artifacts deployment failed
+     */
+    void deployArtifact( RemoteRepository repository, Artifact... artifacts );
+
+    /**
+     * Shortcut for <code>getService(ArtifactManager.class).setPath(...)</code>
+     * @see org.apache.maven.api.services.ArtifactManager#setPath(Artifact, Path)
+     */
+    void setArtifactPath( @Nonnull Artifact artifact, @Nonnull Path path );
+
+    /**
+     * Shortcut for <code>getService(ArtifactManager.class).getPath(...)</code>
+     * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+     */
+    @Nonnull
+    Optional<Path> getArtifactPath( @Nonnull Artifact artifact );
+
+    /**
+     * Shortcut for <code>getService(ArtifactManager.class).isSnapshot(...)</code>
+     * @see org.apache.maven.api.services.VersionParser#isSnapshot(String)
+     */
+    boolean isVersionSnapshot( @Nonnull String version );
+
+    /**
+     * Shortcut for <code>getService(DependencyCollector.class).collect(...)</code>
+     * @see org.apache.maven.api.services.DependencyCollector#collect(Session, Artifact)
+     *
+     * @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
+     */
+    @Nonnull
+    Node collectDependencies( @Nonnull Artifact artifact );
+
+    /**
+     * Shortcut for <code>getService(DependencyCollector.class).collect(...)</code>
+     * @see org.apache.maven.api.services.DependencyCollector#collect(Session, Project)
+     *
+     * @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
+     */
+    @Nonnull
+    Node collectDependencies( @Nonnull Project project );
+
+    /**
+     * Shortcut for <code>getService(DependencyResolver.class).resolve(...)</code>
+     * @see org.apache.maven.api.services.DependencyCollector#collect(Session, DependencyCoordinate)
+     *
+     * @throws org.apache.maven.api.services.DependencyCollectorException if the dependency collection failed
+     */
+    @Nonnull
+    Node collectDependencies( @Nonnull DependencyCoordinate dependency );
+
+    Path getPathForLocalArtifact( @Nonnull Artifact artifact );
+
+    Path getPathForLocalMetadata( Metadata metadata );
+
+    Path getPathForRemoteArtifact( RemoteRepository remote, Artifact artifact );
+
+    Path getPathForRemoteMetadata( RemoteRepository remote, Metadata metadata );
+
+    /**
+     * Shortcut for <code>getService(VersionParser.class).parseVersion(...)</code>
+     * @see org.apache.maven.api.services.VersionParser#parseVersion(String)
+     *
+     * @throws org.apache.maven.api.services.VersionParserException if the parsing failed
+     */
+    @Nonnull
+    Version parseVersion( @Nonnull String version );
+
+    /**
+     * Shortcut for <code>getService(VersionParser.class).parseVersionRange(...)</code>
+     * @see org.apache.maven.api.services.VersionParser#parseVersionRange(String)
+     *
+     * @throws org.apache.maven.api.services.VersionParserException if the parsing failed
+     */
+    @Nonnull
+    VersionRange parseVersionRange( @Nonnull String versionRange );
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SessionData.java
new file mode 100644 (file)
index 0000000..8a8ef19
--- /dev/null
@@ -0,0 +1,86 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.Nullable;
+import org.apache.maven.api.annotations.Provider;
+import org.apache.maven.api.annotations.ThreadSafe;
+
+import java.util.function.Supplier;
+
+/**
+ * A container for data that is specific to a session.
+ * All components may use this storage to associate arbitrary data with a session.
+ * <p>
+ * Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be
+ * abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion.
+ * <p>
+ * <strong>Note:</strong> Actual implementations must be thread-safe.
+ * 
+ * @see Session#getData()
+ * @since 4.0
+ */
+@Experimental
+@ThreadSafe @Provider
+public interface SessionData
+{
+
+    /**
+     * Associates the specified session data with the given key.
+     * 
+     * @param key The key under which to store the session data, must not be {@code null}.
+     * @param value The data to associate with the key, may be {@code null} to remove the mapping.
+     */
+    void set( @Nonnull Object key, @Nullable Object value );
+
+    /**
+     * Associates the specified session data with the given key if the key is currently mapped to the given value. This
+     * method provides an atomic compare-and-update of some key's value.
+     * 
+     * @param key The key under which to store the session data, must not be {@code null}.
+     * @param oldValue The expected data currently associated with the key, may be {@code null}.
+     * @param newValue The data to associate with the key, may be {@code null} to remove the mapping.
+     * @return {@code true} if the key mapping was successfully updated from the old value to the new value,
+     *         {@code false} if the current key mapping didn't match the expected value and was not updated.
+     */
+    boolean set( @Nonnull Object key, @Nullable Object oldValue, @Nullable Object newValue );
+
+    /**
+     * Gets the session data associated with the specified key.
+     * 
+     * @param key The key for which to retrieve the session data, must not be {@code null}.
+     * @return The session data associated with the key or {@code null} if none.
+     */
+    @Nullable
+    Object get( @Nonnull Object key );
+
+    /**
+     * Retrieve of compute the data associated with the specified key.
+     *
+     * @param key The key for which to retrieve the session data, must not be {@code null}.
+     * @param supplier The supplier will compute the new value.
+     * @return The session data associated with the key.
+     */
+    @Nullable
+    Object computeIfAbsent( @Nonnull Object key, @Nonnull Supplier<Object> supplier );
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Toolchain.java
new file mode 100644 (file)
index 0000000..2f49719
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.annotations.Experimental;
+
+/**
+ * Toolchain interface.
+ *
+ * @since 4.0
+ */
+@Experimental
+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 );
+
+    /**
+     * Let the toolchain decide if it matches requirements defined
+     * in the toolchain plugin configuration.
+     * @param requirements Map&lt;String, String&gt; key value pair, may not be {@code null}
+     * @return {@code true} if the requirements match, otherwise {@code false}
+     */
+    boolean matchesRequirements( Map<String, String> requirements );
+}
\ No newline at end of file
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java
new file mode 100644 (file)
index 0000000..71a94b2
--- /dev/null
@@ -0,0 +1,72 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+
+/**
+ * An artifact's{@code Type} represents a known kind of artifacts.
+ * Such types are often associated to an extension and possibly
+ * a classifier, for example {@code java-source} has a {@code jar}
+ * extension and a {@code sources} classifier.
+ * It is also used to determine if a given dependency should be
+ * included in the classpath or if its transitive dependencies should.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface Type
+{
+
+    String POM = "pom";
+    String JAR = "jar";
+    String JAVA_SOURCE = "java-source";
+    String JAVADOC = "javadoc";
+    String MAVEN_PLUGIN = "maven-plugin";
+    String TEST_JAR = "test-jar";
+
+    /**
+     * Returns the dependency type name.
+     *
+     * @return the type name
+     */
+    String getName();
+
+    /**
+     * Get the file extension associated to the file represented by the dependency type.
+     *
+     * @return the file extension
+     */
+    String getExtension();
+
+    /**
+     * Get the classifier associated to the dependency type.
+     *
+     * @return the classifier
+     */
+    String getClassifier();
+
+    boolean isIncludesDependencies();
+
+    boolean isAddedToClasspath();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Version.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Version.java
new file mode 100644 (file)
index 0000000..bf75f6c
--- /dev/null
@@ -0,0 +1,46 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A version usually parsed using the {@link org.apache.maven.api.services.VersionParser} service.
+ *
+ * @since 4.0
+ * @see org.apache.maven.api.services.VersionParser#parseVersion(String)
+ * @see org.apache.maven.api.Session#parseVersion(String)
+ */
+@Experimental
+public interface Version
+    extends Comparable<Version>
+{
+
+    // TODO: add access to the version information
+
+    /**
+     * Returns a string representation of this version.
+     * @return the string representation of this version
+     */
+    @Nonnull
+    String asString();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
new file mode 100644 (file)
index 0000000..fb3e39b
--- /dev/null
@@ -0,0 +1,50 @@
+package org.apache.maven.api;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A range of versions.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface VersionRange
+{
+
+    // TODO: add access to the version information
+
+    /**
+     * Determines whether the specified version is contained within this range.
+     *
+     * @param version The version to test, must not be {@code null}.
+     * @return {@code true} if this range contains the specified version, {@code false} otherwise.
+     */
+    boolean contains( @Nonnull Version version );
+
+    /**
+     * Returns a string representation of this version range
+     * @return the string representation of this version range
+     */
+    @Nonnull
+    String asString();
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Log.java
new file mode 100644 (file)
index 0000000..f0eb2a6
--- /dev/null
@@ -0,0 +1,168 @@
+package org.apache.maven.api.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.function.Supplier;
+
+/**
+ * This interface supplies the API for providing feedback to the user from the <code>Mojo</code>, using standard
+ * <code>Maven</code> channels.<br>
+ * There should be no big surprises here, although you may notice that the methods accept
+ * <code>java.lang.CharSequence</code> rather than <code>java.lang.String</code>. This is provided mainly as a
+ * convenience, to enable developers to pass things like <code>java.lang.StringBuffer</code> directly into the logger,
+ * rather than formatting first by calling <code>toString()</code>.
+ *
+ * @since 4.0
+ */
+public interface Log
+{
+    /**
+     * @return true if the <b>debug</b> error level is enabled
+     */
+    boolean isDebugEnabled();
+
+    /**
+     * Send a message to the user in the <b>debug</b> error level.
+     *
+     * @param content
+     */
+    void debug( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>debug</b> error level.<br>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void debug( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>debug</b> error level.<br>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void debug( Throwable error );
+
+    void debug( Supplier<String> content );
+
+    void debug( Supplier<String> content, Throwable error );
+
+    /**
+     * @return true if the <b>info</b> error level is enabled
+     */
+    boolean isInfoEnabled();
+
+    /**
+     * Send a message to the user in the <b>info</b> error level.
+     *
+     * @param content
+     */
+    void info( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>info</b> error level.<br>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void info( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>info</b> error level.<br>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void info( Throwable error );
+
+    void info( Supplier<String> content );
+
+    void info( Supplier<String> content, Throwable error );
+
+    /**
+     * @return true if the <b>warn</b> error level is enabled
+     */
+    boolean isWarnEnabled();
+
+    /**
+     * Send a message to the user in the <b>warn</b> error level.
+     *
+     * @param content
+     */
+    void warn( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>warn</b> error level.<br>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void warn( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>warn</b> error level.<br>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void warn( Throwable error );
+
+    void warn( Supplier<String> content );
+
+    void warn( Supplier<String> content, Throwable error );
+
+    /**
+     * @return true if the <b>error</b> error level is enabled
+     */
+    boolean isErrorEnabled();
+
+    /**
+     * Send a message to the user in the <b>error</b> error level.
+     *
+     * @param content
+     */
+    void error( CharSequence content );
+
+    /**
+     * Send a message (and accompanying exception) to the user in the <b>error</b> error level.<br>
+     * The error's stacktrace will be output when this error level is enabled.
+     *
+     * @param content
+     * @param error
+     */
+    void error( CharSequence content, Throwable error );
+
+    /**
+     * Send an exception to the user in the <b>error</b> error level.<br>
+     * The stack trace for this exception will be output when this error level is enabled.
+     *
+     * @param error
+     */
+    void error( Throwable error );
+
+    void error( Supplier<String> content );
+
+    void error( Supplier<String> content, Throwable error );
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/Mojo.java
new file mode 100644 (file)
index 0000000..a6217bf
--- /dev/null
@@ -0,0 +1,46 @@
+package org.apache.maven.api.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.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * This interface forms the contract required for <code>Mojos</code> to interact with the <code>Maven</code>
+ * infrastructure.<br>
+ * It features an <code>execute()</code> method, which triggers the Mojo's build-process behavior, and can throw
+ * a MojoException if error conditions occur.<br>
+ *
+ * @since 4.0
+ */
+@Experimental
+@FunctionalInterface @Consumer
+public interface Mojo
+{
+    /**
+     * Perform whatever build-process behavior this <code>Mojo</code> implements.<br>
+     * This is the main trigger for the <code>Mojo</code> inside the <code>Maven</code> system, and allows
+     * the <code>Mojo</code> to communicate errors.
+     *
+     * @throws MojoException if a problem occurs.
+     */
+    void execute();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/MojoException.java
new file mode 100644 (file)
index 0000000..5e5b0c7
--- /dev/null
@@ -0,0 +1,98 @@
+package org.apache.maven.api.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.api.annotations.Experimental;
+import org.apache.maven.api.services.MavenException;
+
+/**
+ * An exception occurring during the execution of a plugin.
+ *
+ * @since 4.0
+ */
+@Experimental
+public class MojoException
+    extends MavenException
+{
+
+    protected Object source;
+
+    protected String longMessage;
+
+    /**
+     * Construct a new <code>MojoExecutionException</code> exception providing the source and a short and long message:
+     * these messages are used to improve the message written at the end of Maven build.
+     */
+    public MojoException( Object source, String shortMessage, String longMessage )
+    {
+        super( shortMessage );
+        this.source = source;
+        this.longMessage = longMessage;
+    }
+
+    /**
+     * Construct a new <code>MojoExecutionException</code> exception wrapping an underlying <code>Exception</code>
+     * and providing a <code>message</code>.
+     */
+    public MojoException( String message, Exception cause )
+    {
+        super( message, cause );
+    }
+
+    /**
+     * Construct a new <code>MojoExecutionException</code> exception wrapping an underlying <code>Throwable</code>
+     * and providing a <code>message</code>.
+     */
+    public MojoException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    /**
+     * Construct a new <code>MojoExecutionException</code> exception providing a <code>message</code>.
+     */
+    public MojoException( String message )
+    {
+        super( message );
+    }
+
+    /**
+     * Constructs a new {@code MojoExecutionException} exception wrapping an underlying {@code Throwable}.
+     *
+     * @param cause the cause which is saved for later retrieval by the {@link #getCause()} method.
+     *              A {@code null} value is permitted, and indicates that the cause is nonexistent or unknown.
+     * @since 3.8.3
+     */
+    public MojoException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    public String getLongMessage()
+    {
+        return longMessage;
+    }
+
+    public Object getSource()
+    {
+        return source;
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Component.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Component.java
new file mode 100644 (file)
index 0000000..f963dfa
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Used to configure injection of Plexus components by
+ * <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/MavenPluginManager.html">
+ * <code>MavenPluginManager.getConfiguredMojo(...)</code></a>.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER } )
+@Inherited
+public @interface Component
+{
+    /**
+     * role of the component to inject.
+     * @return the role
+     */
+    Class<?> role() default Object.class;
+
+    /**
+     * hint of the component to inject.
+     * @return the hint
+     */
+    String hint() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Execute.java
new file mode 100644 (file)
index 0000000..e4f8707
--- /dev/null
@@ -0,0 +1,64 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Used if your Mojo needs to fork a <a href="/ref/3.0.4/maven-core/lifecycles.html">lifecycle</a>.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( ElementType.TYPE )
+@Inherited
+public @interface Execute
+{
+    /**
+     * lifecycle phase to fork. Note that specifying a phase overrides specifying a goal.
+     * @return the phase
+     */
+    LifecyclePhase phase() default LifecyclePhase.NONE;
+
+    /**
+     * goal to fork. Note that specifying a phase overrides specifying a goal. The specified <code>goal</code> must be
+     * another goal of the same plugin.
+     * @return the goal
+     */
+    String goal() default "";
+
+    /**
+     * lifecycle id of the lifecycle that defines {@link #phase()}. Only valid in combination with {@link #phase()}. If
+     * not specified, Maven will use the lifecycle of the current build.
+     *
+     * @see <a href="https://maven.apache.org/maven-plugin-api/lifecycle-mappings.html">Lifecycle Mappings</a>
+     * @return the lifecycle id
+     */
+    String lifecycle() default "";
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/InstantiationStrategy.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/InstantiationStrategy.java
new file mode 100644 (file)
index 0000000..c5cfc75
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * Component instantiation strategy.
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum InstantiationStrategy
+{
+    PER_LOOKUP( "per-lookup" ),
+    SINGLETON( "singleton" ),
+    KEEP_ALIVE( "keep-alive" ),
+    POOLABLE( "poolable" );
+
+    private final String id;
+
+    InstantiationStrategy( String id )
+    {
+        this.id = id;
+    }
+
+    public String id()
+    {
+        return this.id;
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/LifecyclePhase.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/LifecyclePhase.java
new file mode 100644 (file)
index 0000000..84c567b
--- /dev/null
@@ -0,0 +1,80 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * <a href="/ref/3.0.4/maven-core/lifecycles.html">Lifecycle phases</a>.
+ *
+ * @since 4.0
+ */
+@Experimental
+public enum LifecyclePhase
+{
+
+    VALIDATE( "validate" ),
+    INITIALIZE( "initialize" ),
+    GENERATE_SOURCES( "generate-sources" ),
+    PROCESS_SOURCES( "process-sources" ),
+    GENERATE_RESOURCES( "generate-resources" ),
+    PROCESS_RESOURCES( "process-resources" ),
+    COMPILE( "compile" ),
+    PROCESS_CLASSES( "process-classes" ),
+    GENERATE_TEST_SOURCES( "generate-test-sources" ),
+    PROCESS_TEST_SOURCES( "process-test-sources" ),
+    GENERATE_TEST_RESOURCES( "generate-test-resources" ),
+    PROCESS_TEST_RESOURCES( "process-test-resources" ),
+    TEST_COMPILE( "test-compile" ),
+    PROCESS_TEST_CLASSES( "process-test-classes" ),
+    TEST( "test" ),
+    PREPARE_PACKAGE( "prepare-package" ),
+    PACKAGE( "package" ),
+    PRE_INTEGRATION_TEST( "pre-integration-test" ),
+    INTEGRATION_TEST( "integration-test" ),
+    POST_INTEGRATION_TEST( "post-integration-test" ),
+    VERIFY( "verify" ),
+    INSTALL( "install" ),
+    DEPLOY( "deploy" ),
+
+    PRE_CLEAN( "pre-clean" ),
+    CLEAN( "clean" ),
+    POST_CLEAN( "post-clean" ),
+
+    PRE_SITE( "pre-site" ),
+    SITE( "site" ),
+    POST_SITE( "post-site" ),
+    SITE_DEPLOY( "site-deploy" ),
+
+    NONE( "" );
+
+    private final String id;
+
+    LifecyclePhase( String id )
+    {
+        this.id = id;
+    }
+
+    public String id()
+    {
+        return this.id;
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Mojo.java
new file mode 100644 (file)
index 0000000..e873411
--- /dev/null
@@ -0,0 +1,98 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.ResolutionScope;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * This annotation will mark your class as a Mojo (ie. goal in a Maven plugin).
+ *
+ * @since 4.0
+ */
+@Experimental
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( ElementType.TYPE )
+@Inherited
+public @interface Mojo
+{
+    /**
+     * goal name (required).
+     * @return the goal name
+     */
+    String name();
+
+    /**
+     * default phase to bind your mojo.
+     * @return the default phase
+     */
+    LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
+
+    /**
+     * the required dependency resolution scope.
+     * @return the required dependency resolution scope
+     */
+    ResolutionScope requiresDependencyResolution() default ResolutionScope.NONE;
+
+    /**
+     * the required dependency collection scope.
+     * @return the required dependency collection scope 
+     */
+    ResolutionScope requiresDependencyCollection() default ResolutionScope.NONE;
+
+    /**
+     * your Mojo instantiation strategy. (Only <code>per-lookup</code> and <code>singleton</code> are supported)
+     * @return the instantiation strategy
+     */
+    InstantiationStrategy instantiationStrategy() default InstantiationStrategy.PER_LOOKUP;
+
+    /**
+     * does your mojo requires a project to be executed?
+     * @return requires a project
+     */
+    boolean requiresProject() default true;
+
+    /**
+     * if the Mojo uses the Maven project and its child modules.
+     * @return uses the Maven project and its child modules
+     */
+    boolean aggregator() default false;
+
+    /**
+     * does this Mojo need to be online to be executed?
+     * @return need to be online
+     */
+    boolean requiresOnline() default false;
+
+    /**
+     * configurator bean name.
+     * @return the configurator bean name
+     */
+    String configurator() default "";
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java b/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java
new file mode 100644 (file)
index 0000000..27ada3d
--- /dev/null
@@ -0,0 +1,94 @@
+package org.apache.maven.api.plugin.annotations;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Used to configure your Mojo parameters to be injected by
+ * <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/MavenPluginManager.html">
+ * <code>MavenPluginManager.getConfiguredMojo(...)</code></a>.
+ * <p>
+ * Beans injected into Mojo parameters are prepared by <a href="https://www.eclipse.org/sisu/">Sisu</a> JSR330-based
+ * container: this annotation is only effective on fields of the Mojo class itself, nested bean injection
+ * requires Sisu or JSR330 annotations.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.FIELD, ElementType.METHOD } )
+@Inherited
+public @interface Parameter
+{
+    /**
+     * name of the bean property used to get/set the field: by default, field name is used.
+     * @return the name of the bean property
+     */
+    String name() default "";
+
+    /**
+     * alias supported to get parameter value.
+     * @return the alias
+     */
+    String alias() default "";
+
+    /**
+     * Property to use to retrieve a value. Can come from <code>-D</code> execution, setting properties or pom
+     * properties.
+     * @return property name
+     */
+    String property() default "";
+
+    /**
+     * parameter default value, may contain <code>${...}</code> expressions which will be interpreted at
+     * inject time: see
+     * <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">
+     * PluginParameterExpressionEvaluator</a>. 
+     * @return the default value
+     */
+    String defaultValue() default "";
+
+    /**
+     * is the parameter required?
+     * @return <code>true</code> if the Mojo should fail when the parameter cannot be injected
+     */
+    boolean required() default false;
+
+    /**
+     * Specifies that this parameter cannot be configured directly by the user (as in the case of POM-specified
+     * configuration). This is useful when you want to force the user to use common POM elements rather than plugin
+     * configurations, as in the case where you want to use the artifact's final name as a parameter. In this case, you
+     * want the user to modify <code>&lt;build&gt;&lt;finalName/&gt;&lt;/build&gt;</code> rather than specifying a value
+     * for finalName directly in the plugin configuration section. It is also useful to ensure that - for example - a
+     * List-typed parameter which expects items of type Artifact doesn't get a List full of Strings.
+     * 
+     * @return <code>true</code> if the user should not be allowed to configure the parameter directly
+     */
+    boolean readonly() default false;
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactory.java
new file mode 100644 (file)
index 0000000..a1da371
--- /dev/null
@@ -0,0 +1,71 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.Artifact;
+import org.apache.maven.api.ArtifactCoordinate;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Service used to create {@link ArtifactCoordinate} objects.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface ArtifactCoordinateFactory extends Service
+{
+
+    /**
+     * Creates a coordinate.
+     *
+     * @param request the request holding coordinate creation parameters
+     * @return an {@code Artifact}, never {@code null}
+     * @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
+     */
+    @Nonnull
+    ArtifactCoordinate create( @Nonnull ArtifactCoordinateFactoryRequest request );
+
+    @Nonnull
+    default ArtifactCoordinate create( @Nonnull Session session, String groupId,
+                                       String artifactId, String version, String extension )
+    {
+        return create( ArtifactCoordinateFactoryRequest.build( session, groupId, artifactId, version, extension ) );
+    }
+
+    @Nonnull
+    default ArtifactCoordinate create( @Nonnull Session session, String groupId, String artifactId, String version,
+                                       String classifier, String extension, String type )
+    {
+        return create( ArtifactCoordinateFactoryRequest.build( session, groupId, artifactId,
+                                                     version, classifier, extension, type ) );
+    }
+
+    @Nonnull
+    default ArtifactCoordinate create( @Nonnull Session session, Artifact artifact )
+    {
+        return create( ArtifactCoordinateFactoryRequest.build( session,
+                artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion().asString(),
+                artifact.getClassifier(), artifact.getExtension(), null ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinateFactoryRequest.java
new file mode 100644 (file)
index 0000000..8c8b9af
--- /dev/null
@@ -0,0 +1,222 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.ArtifactCoordinate;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+
+/**
+ * A request for creating a {@link ArtifactCoordinate} object.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactCoordinateFactoryRequest
+{
+
+    @Nonnull
+    Session getSession();
+
+    String getGroupId();
+
+    String getArtifactId();
+
+    String getVersion();
+
+    String getClassifier();
+
+    String getExtension();
+
+    String getType();
+
+    static ArtifactCoordinateFactoryRequest build( Session session, String groupId, String artifactId,
+                                                   String version, String extension )
+    {
+        return ArtifactCoordinateFactoryRequest.builder()
+                .session( session )
+                .groupId( groupId )
+                .artifactId( artifactId )
+                .version( version )
+                .extension( extension )
+                .build();
+    }
+
+    static ArtifactCoordinateFactoryRequest build( Session session, String groupId, String artifactId,
+                                                   String version, String classifier, String extension, String type )
+    {
+        return ArtifactCoordinateFactoryRequest.builder()
+                .session( session )
+                .groupId( groupId )
+                .artifactId( artifactId )
+                .version( version )
+                .classifier( classifier )
+                .extension( extension )
+                .type( type )
+                .build();
+    }
+
+    static ArtifactCoordinateFactoryRequest build( Session session, ArtifactCoordinate coordinate )
+    {
+        return ArtifactCoordinateFactoryRequest.builder()
+                .session( session )
+                .groupId( coordinate.getGroupId() )
+                .artifactId( coordinate.getArtifactId() )
+                .classifier( coordinate.getClassifier() )
+                .version( coordinate.getVersion().asString() )
+                .extension( coordinate.getExtension() )
+                .build();
+    }
+
+
+    static ArtifactFactoryRequestBuilder builder()
+    {
+        return new ArtifactFactoryRequestBuilder();
+    }
+
+    @NotThreadSafe
+    class ArtifactFactoryRequestBuilder
+    {
+        private Session session;
+        private String groupId;
+        private String artifactId;
+        private String version;
+        private String classifier;
+        private String extension;
+        private String type;
+
+        public ArtifactFactoryRequestBuilder session( Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder groupId( String groupId )
+        {
+            this.groupId = groupId;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder artifactId( String artifactId )
+        {
+            this.artifactId = artifactId;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder version( String version )
+        {
+            this.version = version;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder classifier( String classifier )
+        {
+            this.classifier = classifier;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder extension( String extension )
+        {
+            this.extension = extension;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder type( String type )
+        {
+            this.type = type;
+            return this;
+        }
+
+        public ArtifactCoordinateFactoryRequest build()
+        {
+            return new DefaultArtifactFactoryRequestArtifact( session, groupId, artifactId, version,
+                                                      classifier, extension, type );
+        }
+
+        private static class DefaultArtifactFactoryRequestArtifact extends BaseRequest implements
+                                                                                       ArtifactCoordinateFactoryRequest
+        {
+            private final String groupId;
+            private final String artifactId;
+            private final String version;
+            private final String classifier;
+            private final String extension;
+            private final String type;
+
+            DefaultArtifactFactoryRequestArtifact( @Nonnull Session session,
+                                                   String groupId,
+                                                   String artifactId,
+                                                   String version,
+                                                   String classifier,
+                                                   String extension,
+                                                   String type )
+            {
+                super( session );
+                this.groupId = groupId;
+                this.artifactId = artifactId;
+                this.version = version;
+                this.classifier = classifier;
+                this.extension = extension;
+                this.type = type;
+            }
+
+            @Override
+            public String getGroupId()
+            {
+                return groupId;
+            }
+
+            @Override
+            public String getArtifactId()
+            {
+                return artifactId;
+            }
+
+            @Override
+            public String getVersion()
+            {
+                return version;
+            }
+
+            @Override
+            public String getClassifier()
+            {
+                return classifier;
+            }
+
+            @Override
+            public String getExtension()
+            {
+                return extension;
+            }
+
+            @Override
+            public String getType()
+            {
+                return type;
+            }
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java
new file mode 100644 (file)
index 0000000..38c243d
--- /dev/null
@@ -0,0 +1,61 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Deploys {@link Artifact}s to a {@link RemoteRepository}.
+ *
+ * @since 4.0
+ * @see Session#deployArtifact(RemoteRepository, Artifact...)
+ */
+@Experimental
+public interface ArtifactDeployer extends Service
+{
+
+    /**
+     * @param request {@link ArtifactDeployerRequest}
+     * @throws ArtifactDeployerException if the deployment failed
+     */
+    void deploy( @Nonnull ArtifactDeployerRequest request );
+
+    /**
+     * @param session the repository session
+     * @param repository the repository to deploy to
+     * @param artifacts the collection of artifacts to deploy
+     * @throws ArtifactDeployerException if the deployment failed
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     */
+    default void deploy( @Nonnull Session session,
+                         @Nonnull RemoteRepository repository,
+                         @Nonnull Collection<Artifact> artifacts )
+    {
+        deploy( ArtifactDeployerRequest.build( session, repository, artifacts ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerException.java
new file mode 100644 (file)
index 0000000..fbb206a
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * An artifact could not correctly being deployed.
+ *
+ * @since 4.0
+ */
+@Experimental
+public class ArtifactDeployerException
+    extends MavenException
+{
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 7421964724059077698L;
+
+    /**
+     * @param message The message of the error.
+     * @param e {@link Exception}
+     */
+    public ArtifactDeployerException( String message, Exception e )
+    {
+        super( message, e );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java
new file mode 100644 (file)
index 0000000..a87c0fb
--- /dev/null
@@ -0,0 +1,153 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.util.Collection;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.RemoteRepository;
+
+import static org.apache.maven.api.services.BaseRequest.nonNull;
+
+/**
+ * A request for deploying one or more artifacts to a remote repository.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactDeployerRequest
+{
+
+    @Nonnull
+    Session getSession();
+
+    @Nonnull
+    RemoteRepository getRepository();
+
+    @Nonnull
+    Collection<Artifact> getArtifacts();
+
+    int getRetryFailedDeploymentCount();
+
+    @Nonnull
+    static ArtifactDeployerRequestBuilder builder()
+    {
+        return new ArtifactDeployerRequestBuilder();
+    }
+
+    @Nonnull
+    static ArtifactDeployerRequest build( @Nonnull Session session,
+                                          @Nonnull RemoteRepository repository,
+                                          @Nonnull Collection<Artifact> artifacts )
+    {
+        return builder()
+                .session( nonNull( session, "session can not be null" ) )
+                .repository( repository )
+                .artifacts( artifacts )
+                .build();
+    }
+
+    class ArtifactDeployerRequestBuilder
+    {
+        Session session;
+        RemoteRepository repository;
+        Collection<Artifact> artifacts;
+        int retryFailedDeploymentCount;
+
+        @Nonnull
+        public ArtifactDeployerRequestBuilder session( Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactDeployerRequestBuilder repository( RemoteRepository repository )
+        {
+            this.repository = repository;
+            return this;
+        }
+
+        public ArtifactDeployerRequestBuilder artifacts( Collection<Artifact> artifacts )
+        {
+            this.artifacts = artifacts;
+            return this;
+        }
+
+        public ArtifactDeployerRequestBuilder retryFailedDeploymentCount( int retryFailedDeploymentCount )
+        {
+            this.retryFailedDeploymentCount = retryFailedDeploymentCount;
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactDeployerRequest build()
+        {
+            return new DefaultArtifactDeployerRequest( session, repository, artifacts, retryFailedDeploymentCount );
+        }
+
+        private static class DefaultArtifactDeployerRequest extends BaseRequest
+                implements ArtifactDeployerRequest
+        {
+
+            private final RemoteRepository repository;
+            private final Collection<Artifact> artifacts;
+            private final int retryFailedDeploymentCount;
+
+            DefaultArtifactDeployerRequest( @Nonnull Session session,
+                                            @Nonnull RemoteRepository repository,
+                                            @Nonnull Collection<Artifact> artifacts,
+                                            int retryFailedDeploymentCount )
+            {
+                super( session );
+                this.repository = nonNull( repository, "repository can not be null" );
+                this.artifacts = nonNull( artifacts, "artifacts can not be null" );
+                this.retryFailedDeploymentCount = retryFailedDeploymentCount;
+            }
+
+            @Nonnull
+            @Override
+            public RemoteRepository getRepository()
+            {
+                return repository;
+            }
+
+            @Nonnull
+            @Override
+            public Collection<Artifact> getArtifacts()
+            {
+                return artifacts;
+            }
+
+            @Override
+            public int getRetryFailedDeploymentCount()
+            {
+                return retryFailedDeploymentCount;
+            }
+        }
+
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactory.java
new file mode 100644 (file)
index 0000000..c9f2095
--- /dev/null
@@ -0,0 +1,61 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * Service used to create {@link Artifact} objects.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface ArtifactFactory extends Service
+{
+
+    /**
+     * Creates an artifact.
+     *
+     * @param request the request holding artifact creation parameters
+     * @return an {@code Artifact}, never {@code null}
+     * @throws IllegalArgumentException if {@code request} is null or {@code request.session} is null or invalid
+     */
+    @Nonnull
+    Artifact create( @Nonnull ArtifactFactoryRequest request );
+
+    @Nonnull
+    default Artifact create( @Nonnull Session session, String groupId,
+                             String artifactId, String version, String extension )
+    {
+        return create( ArtifactFactoryRequest.build( session, groupId, artifactId, version, extension ) );
+    }
+
+    @Nonnull
+    default Artifact create( @Nonnull Session session, String groupId, String artifactId, String version,
+                             String classifier, String extension, String type )
+    {
+        return create( ArtifactFactoryRequest.build( session, groupId, artifactId,
+                                                     version, classifier, extension, type ) );
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactFactoryRequest.java
new file mode 100644 (file)
index 0000000..eb7e3f9
--- /dev/null
@@ -0,0 +1,208 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.NotThreadSafe;
+
+/**
+ *
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactFactoryRequest
+{
+
+    @Nonnull
+    Session getSession();
+
+    String getGroupId();
+
+    String getArtifactId();
+
+    String getVersion();
+
+    String getClassifier();
+
+    String getExtension();
+
+    String getType();
+
+    static ArtifactFactoryRequest build( Session session, String groupId, String artifactId,
+                                         String version, String extension )
+    {
+        return ArtifactFactoryRequest.builder()
+                .session( session )
+                .groupId( groupId )
+                .artifactId( artifactId )
+                .version( version )
+                .extension( extension )
+                .build();
+    }
+
+    static ArtifactFactoryRequest build( Session session, String groupId, String artifactId,
+                                         String version, String classifier, String extension, String type )
+    {
+        return ArtifactFactoryRequest.builder()
+                .session( session )
+                .groupId( groupId )
+                .artifactId( artifactId )
+                .version( version )
+                .classifier( classifier )
+                .extension( extension )
+                .type( type )
+                .build();
+    }
+
+    static ArtifactFactoryRequestBuilder builder()
+    {
+        return new ArtifactFactoryRequestBuilder();
+    }
+
+    @NotThreadSafe
+    class ArtifactFactoryRequestBuilder
+    {
+        private Session session;
+        private String groupId;
+        private String artifactId;
+        private String version;
+        private String classifier;
+        private String extension;
+        private String type;
+
+        public ArtifactFactoryRequestBuilder session( Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder groupId( String groupId )
+        {
+            this.groupId = groupId;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder artifactId( String artifactId )
+        {
+            this.artifactId = artifactId;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder version( String version )
+        {
+            this.version = version;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder classifier( String classifier )
+        {
+            this.classifier = classifier;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder extension( String extension )
+        {
+            this.extension = extension;
+            return this;
+        }
+
+        public ArtifactFactoryRequestBuilder type( String type )
+        {
+            this.type = type;
+            return this;
+        }
+
+        public ArtifactFactoryRequest build()
+        {
+            return new DefaultArtifactFactoryRequest( session, groupId, artifactId, version,
+                                                      classifier, extension, type );
+        }
+
+        private static class DefaultArtifactFactoryRequest extends BaseRequest implements ArtifactFactoryRequest
+        {
+            private final String groupId;
+            private final String artifactId;
+            private final String version;
+            private final String classifier;
+            private final String extension;
+            private final String type;
+
+            DefaultArtifactFactoryRequest( @Nonnull Session session,
+                                           String groupId,
+                                           String artifactId,
+                                           String version,
+                                           String classifier,
+                                           String extension,
+                                           String type )
+            {
+                super( session );
+                this.groupId = groupId;
+                this.artifactId = artifactId;
+                this.version = version;
+                this.classifier = classifier;
+                this.extension = extension;
+                this.type = type;
+            }
+
+            @Override
+            public String getGroupId()
+            {
+                return groupId;
+            }
+
+            @Override
+            public String getArtifactId()
+            {
+                return artifactId;
+            }
+
+            @Override
+            public String getVersion()
+            {
+                return version;
+            }
+
+            @Override
+            public String getClassifier()
+            {
+                return classifier;
+            }
+
+            @Override
+            public String getExtension()
+            {
+                return extension;
+            }
+
+            @Override
+            public String getType()
+            {
+                return type;
+            }
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java
new file mode 100644 (file)
index 0000000..5b07a88
--- /dev/null
@@ -0,0 +1,74 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Installs {@link Artifact}s to the local repository.
+ *
+ * @since 4.0
+ * @see Session#withLocalRepository(org.apache.maven.api.LocalRepository)
+ */
+@Experimental
+public interface ArtifactInstaller extends Service
+{
+    /**
+     * @param request {@link ArtifactInstallerRequest}
+     * @throws ArtifactInstallerException in case of an error.
+     * @throws IllegalArgumentException in case {@code request} is {@code null}.
+     */
+    void install( ArtifactInstallerRequest request );
+
+    /**
+     * @param session the repository session
+     * @param artifact the {@link Artifact} to install
+     * @throws ArtifactInstallerException In case of an error which can be the a given artifact can not be found or the
+     *             installation has failed.
+     * @throws IllegalArgumentException in case of parameter {@code session} is {@code null} or
+     *          {@code artifact} is {@code null}.
+     */
+    default void install( Session session, Artifact artifact )
+    {
+        install( session, Collections.singletonList( artifact ) );
+    }
+
+    /**
+     * @param session the repository session
+     * @param artifacts Collection of {@link Artifact MavenArtifacts}
+     * @throws ArtifactInstallerException In case of an error which can be the a given artifact can not be found or the
+     *             installation has failed.
+     * @throws IllegalArgumentException in case of parameter {@code request} is {@code null} or parameter
+     *             {@code localRepository} is {@code null} or {@code localRepository} is not a directory
+     *             or parameter {@code mavenArtifacts} is {@code null} or
+     *             {@code mavenArtifacts.isEmpty()} is {@code true}.
+     */
+    default void install( Session session, Collection<Artifact> artifacts )
+    {
+        install( ArtifactInstallerRequest.build( session, artifacts ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerException.java
new file mode 100644 (file)
index 0000000..e6c6dc6
--- /dev/null
@@ -0,0 +1,46 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * @since 4.0
+ */
+@Experimental
+public class ArtifactInstallerException
+    extends MavenException
+{
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 3652561971360586373L;
+
+    /**
+     * @param message The message of the error.
+     * @param e {@link Exception}
+     */
+    public ArtifactInstallerException( String message, Exception e )
+    {
+        super( message, e );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java
new file mode 100644 (file)
index 0000000..772203a
--- /dev/null
@@ -0,0 +1,113 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+import org.apache.maven.api.annotations.Nullable;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+
+/**
+ * A request for installing one or more artifacts in the local repository.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactInstallerRequest
+{
+
+    @Nonnull
+    Session getSession();
+
+    @Nonnull
+    Collection<Artifact> getArtifacts();
+
+    @Nonnull
+    static ArtifactInstallerRequestBuilder builder()
+    {
+        return new ArtifactInstallerRequestBuilder();
+    }
+
+    @Nonnull
+    static ArtifactInstallerRequest build( Session session, Collection<Artifact> artifacts )
+    {
+        return builder()
+                .session( session )
+                .artifacts( artifacts )
+                .build();
+    }
+
+    @NotThreadSafe
+    class ArtifactInstallerRequestBuilder
+    {
+        Session session;
+        Collection<Artifact> artifacts = Collections.emptyList();
+
+        @Nonnull
+        public ArtifactInstallerRequestBuilder session( @Nonnull Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactInstallerRequestBuilder artifacts( @Nullable Collection<Artifact> artifacts )
+        {
+            this.artifacts = artifacts != null ? artifacts : Collections.emptyList();
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactInstallerRequest build()
+        {
+            return new DefaultArtifactInstallerRequest( session, artifacts );
+        }
+
+        static class DefaultArtifactInstallerRequest extends BaseRequest
+                implements ArtifactInstallerRequest
+        {
+
+            private final Collection<Artifact> artifacts;
+
+            DefaultArtifactInstallerRequest( @Nonnull Session session,
+                                             @Nonnull Collection<Artifact> artifacts )
+            {
+                super( session );
+                this.artifacts = nonNull( artifacts, "artifacts can not be null" );
+            }
+
+            @Nonnull
+            @Override
+            public Collection<Artifact> getArtifacts()
+            {
+                return artifacts;
+            }
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactManager.java
new file mode 100644 (file)
index 0000000..4fa7713
--- /dev/null
@@ -0,0 +1,64 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.Service;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.Optional;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.Metadata;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface ArtifactManager extends Service
+{
+
+    /**
+     * Returns the path of the file previously associated to this artifact
+     * or {@code Optional.empty()} if no path has been associated.
+     */
+    @Nonnull
+    Optional<Path> getPath( @Nonnull Artifact artifact );
+
+    /**
+     * Associates the given file path to the artifact.
+     */
+    void setPath( @Nonnull Artifact artifact, Path path );
+
+    /**
+     * TODO: investigate removing the Metadata api completely
+     */
+    @Nonnull
+    Collection<Metadata> getAttachedMetadatas( @Nonnull Artifact artifact );
+
+    /**
+     * TODO: investigate removing the Metadata api completely
+     */
+    void attachMetadata( @Nonnull Artifact artifact, @Nonnull Metadata metadata );
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java
new file mode 100644 (file)
index 0000000..99f49d2
--- /dev/null
@@ -0,0 +1,61 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.ArtifactCoordinate;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * Resolves the artifact, i.e download the file when required and attach it to the artifact
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface ArtifactResolver extends Service
+{
+
+    /**
+     * @param request {@link ArtifactResolverRequest}
+     * @return {@link ArtifactResolverResult}
+     * @throws ArtifactResolverException in case of an error.
+     * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
+     *             parameter {@code mavenArtifact} is {@code null} or invalid.
+     */
+    ArtifactResolverResult resolve( ArtifactResolverRequest request );
+
+    /**
+     * @param session {@link Session}
+     * @param coordinates array of {@link ArtifactCoordinate}
+     * @return {@link ArtifactResolverResult}
+     * @throws ArtifactResolverException in case of an error.
+     * @throws IllegalArgumentException in case of parameter {@code buildingRequest} is {@code null} or
+     *             parameter {@code coordinate} is {@code null} or invalid.
+     */
+    default ArtifactResolverResult resolve( Session session,
+                                            Collection<? extends ArtifactCoordinate> coordinates )
+    {
+        return resolve( ArtifactResolverRequest.build( session, coordinates ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverException.java
new file mode 100644 (file)
index 0000000..ba6e548
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ *
+ *
+ * @since 4.0
+ */
+@Experimental
+public class ArtifactResolverException
+    extends MavenException
+{
+
+    private static final long serialVersionUID = 7252294837746943917L;
+
+    /**
+     * @param message The message for the exception.
+     * @param e The exception itself.
+     */
+    public ArtifactResolverException( String message, Exception e )
+    {
+        super( message, e );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverRequest.java
new file mode 100644 (file)
index 0000000..f35f326
--- /dev/null
@@ -0,0 +1,108 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.ArtifactCoordinate;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+
+/**
+ * A request for resolving an artifact.
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface ArtifactResolverRequest
+{
+    @Nonnull
+    Session getSession();
+
+    @Nonnull
+    Collection<? extends ArtifactCoordinate> getCoordinates();
+
+    @Nonnull
+    static ArtifactResolverRequestBuilder builder()
+    {
+        return new ArtifactResolverRequestBuilder();
+    }
+
+    @Nonnull
+    static ArtifactResolverRequest build( Session session, Collection<? extends ArtifactCoordinate> coordinates )
+    {
+        return builder()
+                .session( session )
+                .coordinates( coordinates )
+                .build();
+    }
+
+    @NotThreadSafe
+    class ArtifactResolverRequestBuilder
+    {
+        Session session;
+        Collection<? extends ArtifactCoordinate> coordinates;
+
+        @Nonnull
+        public ArtifactResolverRequestBuilder session( Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactResolverRequestBuilder coordinates( Collection<? extends ArtifactCoordinate> coordinates )
+        {
+            this.coordinates = coordinates;
+            return this;
+        }
+
+        @Nonnull
+        public ArtifactResolverRequest build()
+        {
+            return new DefaultArtifactResolverRequest( session, coordinates );
+        }
+
+        private static class DefaultArtifactResolverRequest extends BaseRequest implements ArtifactResolverRequest
+        {
+            @Nonnull
+            private final Collection<? extends ArtifactCoordinate> coordinates;
+
+            DefaultArtifactResolverRequest( @Nonnull Session session,
+                                            @Nonnull Collection<? extends ArtifactCoordinate> coordinates )
+            {
+                super( session );
+                this.coordinates = nonNull( coordinates, "coordinates can not be null" );
+            }
+
+            @Nonnull
+            @Override
+            public Collection<? extends ArtifactCoordinate> getCoordinates()
+            {
+                return coordinates;
+            }
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolverResult.java
new file mode 100644 (file)
index 0000000..74bd5a7
--- /dev/null
@@ -0,0 +1,43 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+import java.util.Map;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * The Artifact Result
+ * 
+ * @since 4.0
+ */
+@Experimental
+public interface ArtifactResolverResult
+{
+    /**
+     * @return {@link Artifact}
+     */
+    @Nonnull
+    Map<Artifact, Path> getArtifacts();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/BaseRequest.java
new file mode 100644 (file)
index 0000000..86afa5a
--- /dev/null
@@ -0,0 +1,67 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.maven.api.Session;
+
+/**
+ * Base class for requests.
+ *
+ * @since 4.0
+ */
+@Experimental
+abstract class BaseRequest
+{
+
+    private final Session session;
+
+    protected BaseRequest( @Nonnull Session session )
+    {
+        this.session = nonNull( session, "session can not be null" );
+    }
+
+    @Nonnull
+    public Session getSession()
+    {
+        return session;
+    }
+
+    public static <T> T nonNull( T obj, String message )
+    {
+        if ( obj == null )
+        {
+            throw new IllegalArgumentException( message );
+        }
+        return obj;
+    }
+
+    protected static <T> Collection<T> unmodifiable( Collection<T> obj )
+    {
+        return obj != null && !obj.isEmpty()
+                ? Collections.unmodifiableCollection( new ArrayList<>( obj ) ) : Collections.emptyList();
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollector.java
new file mode 100644 (file)
index 0000000..e21b2c4
--- /dev/null
@@ -0,0 +1,117 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.Service;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.DependencyCoordinate;
+import org.apache.maven.api.Project;
+
+/**
+ * The DependencyCollector service can be used to collect dependencies
+ * for a given artifact and builds a graph of them.
+ * The dependencies collection mechanism will not download any artifacts,
+ * and only the pom files will be downloaded.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface DependencyCollector extends Service
+{
+
+    /**
+     * Collects the transitive dependencies and builds a dependency graph.
+     * Note that this operation is only concerned about determining the coordinates of the
+     * transitive dependencies and does not actually resolve the artifact files.
+     *
+     * @param request The dependency collection request, must not be {@code null}.
+     * @return The collection result, never {@code null}.
+     * @throws DependencyCollectorException If the dependency tree could not be built.
+     * @throws IllegalArgumentException if an argument is null or invalid
+     *
+     * @see DependencyCollector#collect(Session, Project)
+     * @see DependencyCollector#collect(Session, DependencyCoordinate)
+     * @see DependencyCollector#collect(Session, Artifact)
+     */
+    @Nonnull
+    DependencyCollectorResult collect( @Nonnull DependencyCollectorRequest request );
+
+    /**
+     * Collects the transitive dependencies of some artifacts and builds a dependency graph. Note that this operation is
+     * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the
+     * artifact files.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param root The Maven Dependency, must not be {@code null}.
+     * @return The collection result, never {@code null}.
+     * @throws DependencyCollectorException If the dependency tree could not be built.
+     * @throws IllegalArgumentException if an argument is null or invalid
+     * @see #collect(DependencyCollectorRequest)
+     */
+    @Nonnull
+    default DependencyCollectorResult collect( @Nonnull Session session,
+                                               @Nonnull DependencyCoordinate root )
+    {
+        return collect( DependencyCollectorRequest.build( session, root ) );
+    }
+
+    /**
+     * Collects the transitive dependencies of some artifacts and builds a dependency graph. Note that this operation is
+     * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the
+     * artifact files.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param project The {@link Project}, must not be {@code null}.
+     * @return The collection result, never {@code null}.
+     * @throws DependencyCollectorException If the dependency tree could not be built.
+     * @throws IllegalArgumentException if an argument is null or invalid
+     * @see #collect(DependencyCollectorRequest)
+     */
+    @Nonnull
+    default DependencyCollectorResult collect( @Nonnull Session session,
+                                               @Nonnull Project project )
+    {
+        return collect( DependencyCollectorRequest.build( session, project ) );
+    }
+
+    /**
+     * Collects the transitive dependencies of some artifacts and builds a dependency graph. Note that this operation is
+     * only concerned about determining the coordinates of the transitive dependencies and does not actually resolve the
+     * artifact files.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param artifact The {@link Artifact}, must not be {@code null}.
+     * @return The collection result, never {@code null}.
+     * @throws DependencyCollectorException If the dependency tree could not be built.
+     * @throws IllegalArgumentException if an argument is null or invalid
+     * @see #collect(DependencyCollectorRequest)
+     */
+    @Nonnull
+    default DependencyCollectorResult collect( @Nonnull Session session,
+                                               @Nonnull Artifact artifact )
+    {
+        return collect( DependencyCollectorRequest.build( session, artifact ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorException.java
new file mode 100644 (file)
index 0000000..019fedb
--- /dev/null
@@ -0,0 +1,47 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * Thrown in case of bad artifact descriptors, version ranges or other
+ * issues encountered during calculation of the dependency graph.
+ *
+ * @since 4.0
+ */
+@Experimental
+public class DependencyCollectorException
+    extends MavenException
+{
+    /**
+     *
+     */
+    private static final long serialVersionUID = -3134726259840210686L;
+
+    /**
+     * @param message The message you would give for the exception.
+     * @param cause The cause which is related to the message.
+     */
+    public DependencyCollectorException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorRequest.java
new file mode 100644 (file)
index 0000000..b096320
--- /dev/null
@@ -0,0 +1,331 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.Optional;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.DependencyCoordinate;
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+import org.apache.maven.api.annotations.Nullable;
+
+import static org.apache.maven.api.services.BaseRequest.nonNull;
+
+/**
+ * A request to collect the transitive dependencies and to build a dependency graph from them. There are three ways to
+ * create a dependency graph. First, only the root dependency can be given. Second, a root dependency and direct
+ * dependencies can be specified in which case the specified direct dependencies are merged with the direct dependencies
+ * retrieved from the artifact descriptor of the root dependency. And last, only direct dependencies can be specified in
+ * which case the root node of the resulting graph has no associated dependency.
+ *
+ * @since 4.0
+ * @see DependencyCollector#collect(DependencyCollectorRequest)
+ */
+@Experimental
+@Immutable
+public interface DependencyCollectorRequest
+{
+
+    @Nonnull
+    Session getSession();
+
+    @Nonnull
+    Optional<Artifact> getRootArtifact();
+
+    @Nonnull
+    Optional<DependencyCoordinate> getRoot();
+
+    @Nonnull
+    Collection<DependencyCoordinate> getDependencies();
+
+    @Nonnull
+    Collection<DependencyCoordinate> getManagedDependencies();
+
+    boolean getVerbose();
+
+    @Nonnull
+    static DependencyCollectorRequest build( @Nonnull Session session, Artifact root )
+    {
+        return builder()
+                .session( nonNull( session, "session can not be null" ) )
+                .rootArtifact( nonNull( root, "root can not be null" ) )
+                .build();
+    }
+
+    @Nonnull
+    static DependencyCollectorRequest build( @Nonnull Session session, @Nonnull DependencyCoordinate root )
+    {
+        return builder()
+                .session( nonNull( session, "session can not be null" ) )
+                .root( nonNull( root, "root can not be null" ) )
+                .build();
+    }
+
+    @Nonnull
+    static DependencyCollectorRequest build( @Nonnull Session session, @Nonnull Project project )
+    {
+        nonNull( session, "session can not be null" );
+        nonNull( project, "project can not be null" );
+        return builder()
+                .session( session )
+                .rootArtifact( project.getArtifact() )
+                .dependencies( project.getDependencies() )
+                .managedDependencies( project.getManagedDependencies() )
+                .build();
+    }
+
+    @Nonnull
+    static DependencyCollectorRequestBuilder builder()
+    {
+        return new DependencyCollectorRequestBuilder();
+    }
+
+    @NotThreadSafe
+    class DependencyCollectorRequestBuilder
+    {
+
+        Session session;
+        Artifact rootArtifact;
+        DependencyCoordinate root;
+        List<DependencyCoordinate> dependencies = Collections.emptyList();
+        List<DependencyCoordinate> managedDependencies = Collections.emptyList();
+        boolean verbose;
+
+        @Nonnull
+        public DependencyCollectorRequestBuilder session( @Nonnull Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        /**
+         * Sets the root artifact for the dependency graph.
+         * This must not be confused with {@link #root(DependencyCoordinate)}: The root <em>dependency</em>, like any
+         * other specified dependency, will be subject to dependency collection/resolution, i.e. should have an artifact
+         * descriptor and a corresponding artifact file. The root <em>artifact</em> on the other hand is only used
+         * as a label for the root node of the graph in case no root dependency was specified. As such, the configured
+         * root artifact is ignored if {@link #root(DependencyCoordinate)} has been set.
+         *
+         * @param rootArtifact The root artifact for the dependency graph, may be {@code null}.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder rootArtifact( @Nullable Artifact rootArtifact )
+        {
+            this.rootArtifact = rootArtifact;
+            return this;
+        }
+
+        /**
+         * @param root The root dependency
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder root( @Nonnull DependencyCoordinate root )
+        {
+            this.root = root;
+            return this;
+        }
+
+        /**
+         * Sets the direct dependencies. If both a root dependency and direct dependencies are given in the request, the
+         * direct dependencies from the request will be merged with the direct dependencies from the root dependency's
+         * artifact descriptor, giving higher priority to the dependencies from the request.
+         *
+         * @param dependencies The direct dependencies, may be {@code null}.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder dependencies( @Nullable List<DependencyCoordinate> dependencies )
+        {
+            this.dependencies = ( dependencies != null ) ? dependencies : Collections.emptyList();
+            return this;
+        }
+
+        /**
+         * Adds the specified direct dependency.
+         *
+         * @param dependency The dependency to add, may be {@code null}.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder dependency( @Nullable DependencyCoordinate dependency )
+        {
+            if ( dependency != null )
+            {
+                if ( this.dependencies.isEmpty() )
+                {
+                    this.dependencies = new ArrayList<>();
+                }
+                this.dependencies.add( dependency );
+            }
+            return this;
+        }
+
+
+        /**
+         * Sets the dependency management to apply to transitive dependencies. To clarify, this management does not
+         * apply to
+         * the direct dependencies of the root node.
+         *
+         * @param managedDependencies The dependency management, may be {@code null}.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder managedDependencies(
+                        @Nullable List<DependencyCoordinate> managedDependencies )
+        {
+            this.managedDependencies = ( managedDependencies != null ) ? managedDependencies : Collections.emptyList();
+            return this;
+        }
+
+        /**
+         * Adds the specified managed dependency.
+         *
+         * @param managedDependency The managed dependency to add, may be {@code null} in which case the call
+         *                          will have no effect.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder managedDependency( @Nullable DependencyCoordinate managedDependency )
+        {
+            if ( managedDependency != null )
+            {
+                if ( this.managedDependencies.isEmpty() )
+                {
+                    this.managedDependencies = new ArrayList<>();
+                }
+                this.managedDependencies.add( managedDependency );
+            }
+            return this;
+        }
+
+        /**
+         * Specifies that the collection should be verbose.
+         *
+         * @param verbose whether the collection should be verbose or not.
+         * @return This request for chaining, never {@code null}.
+         */
+        @Nonnull
+        public DependencyCollectorRequestBuilder verbose( boolean verbose )
+        {
+            this.verbose = verbose;
+            return this;
+        }
+
+        @Nonnull
+        public DependencyCollectorRequest build()
+        {
+            return new DefaultDependencyCollectorRequest(
+                    session,
+                    rootArtifact,
+                    root,
+                    dependencies,
+                    managedDependencies,
+                    verbose );
+        }
+
+        static class DefaultDependencyCollectorRequest extends BaseRequest
+                implements DependencyCollectorRequest
+        {
+            private final Artifact rootArtifact;
+            private final DependencyCoordinate root;
+            private final Collection<DependencyCoordinate> dependencies;
+            private final Collection<DependencyCoordinate> managedDependencies;
+            private final boolean verbose;
+
+
+            /**
+             * Creates a request with the specified properties.
+             *
+             * @param session      {@link Session}
+             * @param rootArtifact The root dependency whose transitive dependencies should be collected, may be {@code
+             *                     null}.
+             */
+            DefaultDependencyCollectorRequest(
+                    @Nonnull Session session,
+                    @Nullable Artifact rootArtifact,
+                    @Nullable DependencyCoordinate root,
+                    @Nonnull Collection<DependencyCoordinate> dependencies,
+                    @Nonnull Collection<DependencyCoordinate> managedDependencies,
+                    boolean verbose )
+            {
+                super( session );
+                this.rootArtifact = rootArtifact;
+                this.root = root;
+                this.dependencies = unmodifiable( dependencies );
+                this.managedDependencies = unmodifiable( managedDependencies );
+                this.verbose = verbose;
+            }
+
+            @Nonnull
+            @Override
+            public Optional<Artifact> getRootArtifact()
+            {
+                return Optional.ofNullable( rootArtifact );
+            }
+
+            @Nonnull
+            @Override
+            public Optional<DependencyCoordinate> getRoot()
+            {
+                return Optional.ofNullable( root );
+            }
+
+            @Nonnull
+            @Override
+            public Collection<DependencyCoordinate> getDependencies()
+            {
+                return dependencies;
+            }
+
+            @Nonnull
+            @Override
+            public Collection<DependencyCoordinate> getManagedDependencies()
+            {
+                return managedDependencies;
+            }
+
+            @Override
+            public boolean getVerbose()
+            {
+                return verbose;
+            }
+
+            @Nonnull
+            @Override
+            public String toString()
+            {
+                return getRoot() + " -> " + getDependencies();
+            }
+
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorResult.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCollectorResult.java
new file mode 100644 (file)
index 0000000..09388cc
--- /dev/null
@@ -0,0 +1,50 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.Node;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ * The result of a dependency collection request.
+ *
+ * @since 4.0
+ * @see DependencyCollector#collect(DependencyCollectorRequest)
+ */
+@Experimental
+public interface DependencyCollectorResult
+{
+  /**
+   * Gets the exceptions that occurred while building the dependency graph.
+   *
+   * @return The exceptions that occurred, never {@code null}.
+   */
+  List<Exception> getExceptions();
+
+  /**
+   * Gets the root node of the dependency graph.
+   *
+   * @return The root node of the dependency graph or {@code null} if none.
+   */
+  Node getRoot();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactory.java
new file mode 100644 (file)
index 0000000..d3c7a6f
--- /dev/null
@@ -0,0 +1,89 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.ArtifactCoordinate;
+import org.apache.maven.api.DependencyCoordinate;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.model.Dependency;
+import org.apache.maven.api.model.Plugin;
+import org.apache.maven.api.model.ReportPlugin;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface DependencyCoordinateFactory extends Service
+{
+
+    /**
+     * Creates a new {@link DependencyCoordinate} object from the request.
+     *
+     * @param request the request containing the various data
+     * @return a new {@link DependencyCoordinate} object.
+     *
+     * @throws IllegalArgumentException if {@code request} is null or
+     *         if {@code request.getSession()} is null or invalid
+     */
+    @Nonnull
+    DependencyCoordinate create( @Nonnull DependencyCoordinateFactoryRequest request );
+
+    @Nonnull
+    default DependencyCoordinate create( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
+    {
+        return create( DependencyCoordinateFactoryRequest.build( session, coordinate ) );
+    }
+
+    @Nonnull
+    default DependencyCoordinate create( @Nonnull Session session, @Nonnull org.apache.maven.api.Dependency dependency )
+    {
+        return create( DependencyCoordinateFactoryRequest.build( session, dependency ) );
+    }
+
+    @Nonnull
+    default DependencyCoordinate create( @Nonnull Session session, Dependency dependency )
+    {
+        return create( DependencyCoordinateFactoryRequest.build( session,
+                dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
+                dependency.getClassifier(), null, dependency.getType() ) );
+    }
+
+    @Nonnull
+    default DependencyCoordinate create( @Nonnull Session session, Plugin plugin )
+    {
+        // TODO: hard coded string
+        return create( DependencyCoordinateFactoryRequest.build( session,
+                plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
+                null, null, "maven-plugin" ) );
+    }
+
+    @Nonnull
+    default DependencyCoordinate create( @Nonnull Session session, ReportPlugin reportPlugin )
+    {
+        // TODO: hard coded string
+        return create( DependencyCoordinateFactoryRequest.build( session,
+                reportPlugin.getGroupId(), reportPlugin.getArtifactId(), reportPlugin.getVersion(),
+                null, null, "maven-plugin" ) );
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinateFactoryRequest.java
new file mode 100644 (file)
index 0000000..b42853c
--- /dev/null
@@ -0,0 +1,292 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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 org.apache.maven.api.ArtifactCoordinate;
+import org.apache.maven.api.Dependency;
+import org.apache.maven.api.Exclusion;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Immutable;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.NotThreadSafe;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+@Immutable
+public interface DependencyCoordinateFactoryRequest extends ArtifactCoordinateFactoryRequest
+{
+
+    String getScope();
+
+    boolean isOptional();
+
+    @Nonnull
+    Collection<Exclusion> getExclusions();
+
+    static DependencyCoordinateFactoryRequest build( Session session, String groupId, String artifactId,
+                                                   String version, String classifier, String extension, String type )
+    {
+        return DependencyCoordinateFactoryRequest.builder()
+                .session( session )
+                .groupId( groupId )
+                .artifactId( artifactId )
+                .version( version )
+                .classifier( classifier )
+                .extension( extension )
+                .type( type )
+                .build();
+    }
+
+    static DependencyCoordinateFactoryRequest build( Session session, ArtifactCoordinate coordinate )
+    {
+        return builder()
+                .session( session )
+                .groupId( coordinate.getGroupId() )
+                .artifactId( coordinate.getArtifactId() )
+                .version( coordinate.getVersion().asString() )
+                .classifier( coordinate.getClassifier() )
+                .extension( coordinate.getExtension() )
+                .build();
+    }
+
+    static DependencyCoordinateFactoryRequest build( Session session, Dependency dependency )
+    {
+        return builder()
+                .session( session )
+                .groupId( dependency.getGroupId() )
+                .artifactId( dependency.getArtifactId() )
+                .version( dependency.getVersion().asString() )
+                .classifier( dependency.getClassifier() )
+                .extension( dependency.getExtension() )
+                .type( dependency.getType().getName() )
+                .scope( dependency.getScope().id() )
+                .optional( dependency.isOptional() )
+                .build();
+    }
+
+    static DependencyCoordinateFactoryRequestBuilder builder()
+    {
+        return new DependencyCoordinateFactoryRequestBuilder();
+    }
+
+    @NotThreadSafe
+    class DependencyCoordinateFactoryRequestBuilder
+    {
+        private Session session;
+        private String groupId;
+        private String artifactId;
+        private String version;
+        private String classifier;
+        private String extension;
+        private String type;
+        private String scope;
+        private boolean optional;
+        private Collection<Exclusion> exclusions = Collections.emptyList();
+
+        public DependencyCoordinateFactoryRequestBuilder session( Session session )
+        {
+            this.session = session;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder groupId( String groupId )
+        {
+            this.groupId = groupId;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder artifactId( String artifactId )
+        {
+            this.artifactId = artifactId;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder version( String version )
+        {
+            this.version = version;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder classifier( String classifier )
+        {
+            this.classifier = classifier;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder extension( String extension )
+        {
+            this.extension = extension;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder type( String type )
+        {
+            this.type = type;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder scope( String scope )
+        {
+            this.scope = scope;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder optional( boolean optional )
+        {
+            this.optional = optional;
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder exclusions( Collection<Exclusion> exclusions )
+        {
+            if ( exclusions != null )
+            {
+                if ( this.exclusions.isEmpty() )
+                {
+                    this.exclusions = new ArrayList<>();
+                }
+                this.exclusions.addAll( exclusions );
+            }
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequestBuilder exclusion( Exclusion exclusion )
+        {
+            if ( exclusion != null )
+            {
+                if ( this.exclusions.isEmpty() )
+                {
+                    this.exclusions = new ArrayList<>();
+                }
+                this.exclusions.add( exclusion );
+            }
+            return this;
+        }
+
+        public DependencyCoordinateFactoryRequest build()
+        {
+            return new DefaultDependencyCoordinateFactoryRequest( session, groupId, artifactId, version,
+                    classifier, extension, type, scope, optional, exclusions );
+        }
+
+        private static class DefaultDependencyCoordinateFactoryRequest
+                extends BaseRequest
+                implements DependencyCoordinateFactoryRequest
+        {
+            private final String groupId;
+            private final String artifactId;
+            private final String version;
+            private final String classifier;
+            private final String extension;
+            private final String type;
+            private final String scope;
+            private final boolean optional;
+            private final Collection<Exclusion> exclusions;
+
+            @SuppressWarnings( "checkstyle:ParameterNumber" )
+            private DefaultDependencyCoordinateFactoryRequest(
+                            @Nonnull Session session, String groupId,
+                            String artifactId,
+                            String version,
+                            String classifier,
+                            String extension,
+                            String type,
+                            String scope,
+                            boolean optional,
+                            Collection<Exclusion> exclusions )
+            {
+                super( session );
+                this.groupId = groupId;
+                this.artifactId = artifactId;
+                this.version = version;
+                this.classifier = classifier;
+                this.extension = extension;
+                this.type = type;
+                this.scope = scope;
+                this.optional = optional;
+                this.exclusions = exclusions;
+            }
+
+            @Override
+            public String getGroupId()
+            {
+                return groupId;
+            }
+
+            @Override
+            public String getArtifactId()
+            {
+                return artifactId;
+            }
+
+            @Override
+            public String getVersion()
+            {
+                return version;
+            }
+
+            @Override
+            public String getClassifier()
+            {
+                return classifier;
+            }
+
+            @Override
+            public String getExtension()
+            {
+                return extension;
+            }
+
+            @Override
+            public String getType()
+            {
+                return type;
+            }
+
+            @Override
+            public String getScope()
+            {
+                return scope;
+            }
+
+            @Override
+            public boolean isOptional()
+            {
+                return optional;
+            }
+
+            @Nonnull
+            @Override
+            public Collection<Exclusion> getExclusions()
+            {
+                return exclusions;
+            }
+        }
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/LocalRepositoryManager.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/LocalRepositoryManager.java
new file mode 100644 (file)
index 0000000..5e40ac8
--- /dev/null
@@ -0,0 +1,48 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.Artifact;
+import org.apache.maven.api.LocalRepository;
+import org.apache.maven.api.Metadata;
+import org.apache.maven.api.RemoteRepository;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Experimental;
+
+/**
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface LocalRepositoryManager extends Service
+{
+
+    Path getPathForLocalArtifact( Session session, LocalRepository local, Artifact artifact );
+
+    Path getPathForLocalMetadata( Session session, LocalRepository local, Metadata metadata );
+
+    Path getPathForRemoteArtifact( Session session, LocalRepository local, RemoteRepository remote, Artifact artifact );
+
+    Path getPathForRemoteMetadata( Session session, LocalRepository local, RemoteRepository remote, Metadata metadata );
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/Lookup.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/Lookup.java
new file mode 100644 (file)
index 0000000..93e2499
--- /dev/null
@@ -0,0 +1,38 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR 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.api.Service;
+
+public interface Lookup extends Service
+{
+
+    <T> T lookup( Class<T> type );
+
+    <T> T lookup( Class<T> type, String name );
+
+    <T> List<T> lookupList( Class<T> type );
+
+    <T> Map<String, T> lookupMap( Class<T> type );
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/LookupException.java
new file mode 100644 (file)
index 0000000..d885491
--- /dev/null
@@ -0,0 +1,50 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * The Exception class throw by the {@link Lookup} service.
+ *
+ * @since 4.0
+ */
+@Experimental
+public class LookupException
+    extends MavenException
+{
+    /**
+     * @param message The message to give.
+     * @param e The {@link Exception}.
+     */
+    public LookupException( String message, Exception e )
+    {
+        super( message, e );
+    }
+
+    /**
+     * @param e The {@link Exception}.
+     */
+    public LookupException( Exception e )
+    {
+        super( e );
+    }
+
+}
similarity index 52%
rename from maven-settings/src/main/java/org/apache/maven/settings/RuntimeInfo.java
rename to api/maven-api-core/src/main/java/org/apache/maven/api/services/MavenException.java
index 39ffb7ef92f3d1642b691ba14f9ad79bb1eb698b..aba7dd7219c1c2b0e181ec6a9f3d494f01871acc 100644 (file)
@@ -1,4 +1,4 @@
-package org.apache.maven.settings;
+package org.apache.maven.api.services;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,37 +19,33 @@ package org.apache.maven.settings;
  * under the License.
  */
 
-import java.io.File;
+import org.apache.maven.api.annotations.Experimental;
 
 /**
- * To handle runtime information like local repository or profiles.
+ * Base class for all maven exceptions.
  *
+ * @since 4.0
  */
-@Deprecated
-public class RuntimeInfo
+@Experimental
+public class MavenException extends RuntimeException
 {
-    @SuppressWarnings( "checkstyle:constantname" )
-    public static final String userHome = System.getProperty( "user.home" );
-
-    @SuppressWarnings( "checkstyle:constantname" )
-    public static final File userMavenConfigurationHome = new File( userHome, ".m2" );
-
-    public static final File DEFAULT_USER_SETTINGS_FILE = new File( userMavenConfigurationHome, "settings.xml" );
-
-    private File settings;
+    public MavenException()
+    {
+    }
 
-    public RuntimeInfo()
+    public MavenException( String message )
     {
-        this.settings = DEFAULT_USER_SETTINGS_FILE;
+        super( message );
     }
 
-    public RuntimeInfo( File settings )
+    public MavenException( String message, Throwable cause )
     {
-        this.settings = settings;
+        super( message, cause );
     }
 
-    public File getFile()
+    public MavenException( Throwable cause )
     {
-        return settings;
+        super( cause );
     }
+
 }
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilder.java
new file mode 100644 (file)
index 0000000..1d86911
--- /dev/null
@@ -0,0 +1,157 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Nonnull;
+
+/**
+ * Message builder that supports configurable styling.
+ *
+ * @since 4.0
+ * @see MessageBuilderFactory
+ */
+public interface MessageBuilder
+{
+    /**
+     * Append message content in success style.
+     * By default, bold green
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder success( Object message );
+    
+    /**
+     * Append message content in warning style.
+     * By default, bold yellow
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder warning( Object message );
+    
+    /**
+     * Append message content in failure style.
+     * By default, bold red
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder failure( Object message );
+
+    /**
+     * Append message content in strong style.
+     * By default, bold
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder strong( Object message );
+    
+    /**
+     * Append message content in mojo style.
+     * By default, green
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder mojo( Object message );
+    
+    /**
+     * Append message content in project style.
+     * By default, cyan
+     * @param message the message to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder project( Object message );
+    
+    //
+    // message building methods modelled after Ansi methods
+    //
+    /**
+     * Append content to the message buffer.
+     * @param value the content to append
+     * @param offset the index of the first {@code char} to append
+     * @param len the number of {@code char}s to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder a( char[] value, int offset, int len );
+
+    /**
+     * Append content to the message buffer.
+     * @param value the content to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder a( char[] value );
+
+    /**
+     * Append content to the message buffer.
+     * @param value the content to append
+     * @param start the starting index of the subsequence to be appended
+     * @param end the end index of the subsequence to be appended
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder a( CharSequence value, int start, int end );
+
+    /**
+     * Append content to the message buffer.
+     * @param value the content to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder a( CharSequence value );
+
+    /**
+     * Append content to the message buffer.
+     * @param value the content to append
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder a( Object value );
+
+    /**
+     * Append newline to the message buffer.
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder newline();
+
+    /**
+     * Append formatted content to the buffer.
+     * @see String#format(String, Object...)
+     * @param pattern a <a href="../util/Formatter.html#syntax">format string</a>
+     * @param args arguments referenced by the format specifiers in the format string.
+     * @return the current builder
+     */
+    @Nonnull
+    MessageBuilder format( String pattern, Object... args );
+
+    /**
+     * Return the built message.
+     * @return the message
+     */
+    @Nonnull
+    String build();
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilderFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/MessageBuilderFactory.java
new file mode 100644 (file)
index 0000000..5290dab
--- /dev/null
@@ -0,0 +1,71 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.Service;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+/**
+ * A factory for {@link MessageBuilder}.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface MessageBuilderFactory extends Service
+{
+    /**
+     * Checks if the underlying output does support styling or not.
+     * @return whether color styling is supported or not
+     */
+    boolean isColorEnabled();
+
+    /**
+     * Returns the terminal width or <code>-1</code> if not supported.
+     * @return the terminal width
+     */
+    int getTerminalWidth();
+
+    /**
+     * Creates a new message builder.
+     * @return a new message builder
+     */
+    @Nonnull
+    MessageBuilder builder();
+
+    /**
+     * Creates a new message builder backed by the given string builder.
+     * @param stringBuilder a string builder
+     * @return a new message builder
+     */
+    @Nonnull
+    MessageBuilder builder( @Nonnull StringBuilder stringBuilder );
+
+    /**
+     * Creates a new message builder of the specified size.
+     * @param size the initial size of the message builder buffer
+     * @return a new message builder
+     */
+    @Nonnull
+    default MessageBuilder builder( int size )
+    {
+        return builder( new StringBuilder( size ) );
+    }
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilder.java
new file mode 100644 (file)
index 0000000..d782975
--- /dev/null
@@ -0,0 +1,110 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.ArtifactCoordinate;
+import org.apache.maven.api.Service;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+
+import java.nio.file.Path;
+
+import org.apache.maven.api.Session;
+import org.apache.maven.api.Artifact;
+
+/**
+ * @since 4.0
+ */
+@Experimental
+public interface ProjectBuilder extends Service
+{
+
+    /**
+     * Creates a {@link org.apache.maven.api.Project} from a POM file.
+     *
+     * @param request {@link ProjectBuilderRequest}
+     * @return the {@link ProjectBuilderResult} containing the built project and possible errors
+     * @throws ProjectBuilderException if the project can not be created
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     */
+    @Nonnull
+    ProjectBuilderResult build( ProjectBuilderRequest request );
+
+    /**
+     * Creates a {@link org.apache.maven.api.Project} from a POM file.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param source The {@link ProjectBuilderSource}, must not be {@code null}.
+     * @throws ProjectBuilderException if the project can not be created
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     * @see #build(ProjectBuilderRequest)
+     */
+    @Nonnull
+    default ProjectBuilderResult build( @Nonnull Session session, @Nonnull ProjectBuilderSource source )
+    {
+        return build( ProjectBuilderRequest.build( session, source ) );
+    }
+
+    /**
+     * Creates a {@link org.apache.maven.api.Project} from a POM file.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param path The {@link Path}, must not be {@code null}.
+     * @throws ProjectBuilderException if the project can not be created
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     * @see #build(ProjectBuilderRequest)
+     */
+    @Nonnull
+    default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Path path )
+    {
+        return build( ProjectBuilderRequest.build( session, path ) );
+    }
+
+    /**
+     * Creates a {@link org.apache.maven.api.Project} from an artifact.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param artifact The {@link Artifact}, must not be {@code null}.
+     * @throws ProjectBuilderException if the project can not be created
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     * @see #build(ProjectBuilderRequest)
+     */
+    @Nonnull
+    default ProjectBuilderResult build( @Nonnull Session session, @Nonnull Artifact artifact )
+    {
+        return build( ProjectBuilderRequest.build( session, artifact ) );
+    }
+
+    /**
+     * Creates a {@link org.apache.maven.api.Project} from a coordinate.
+     *
+     * @param session The {@link Session}, must not be {@code null}.
+     * @param coordinate The {@link ArtifactCoordinate}, must not be {@code null}.
+     * @throws ProjectBuilderException if the project can not be created
+     * @throws IllegalArgumentException if an argument is {@code null} or invalid
+     * @see #build(ProjectBuilderRequest)
+     */
+    @Nonnull
+    default ProjectBuilderResult build( @Nonnull Session session, @Nonnull ArtifactCoordinate coordinate )
+    {
+        return build( ProjectBuilderRequest.build( session, coordinate ) );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderException.java
new file mode 100644 (file)
index 0000000..2256bd1
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * The Exception class throw by the {@link ProjectBuilder} service.
+ *
+ * @since 4.0
+ */
+@Experimental
+public class ProjectBuilderException
+    extends MavenException
+{
+    /**
+     * @param message The message to give.
+     * @param e The {@link Exception}.
+     */
+    public ProjectBuilderException( String message, Exception e )
+    {
+        super( message, e );
+    }
+
+}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectBuilderProblem.java
new file mode 100644 (file)
index 0000000..fef6cea
--- /dev/null
@@ -0,0 +1,90 @@
+package org.apache.maven.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES 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.api.annotations.Experimental;
+
+/**
+ * Describes a problem that was encountered during project building. A problem can either be an exception that was
+ * thrown or a simple string message. In addition, a problem carries a hint about its source.
+ *
+ * @since 4.0
+ */
+@Experimental
+public interface ProjectBuilderProblem
+{
+