From fc333aa86b96281b36dcaa2059bdb3c258540111 Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Fri, 26 Apr 2024 10:41:48 +0200 Subject: [PATCH] [MNG-7266] Remove maven-compat --- apache-maven/pom.xml | 5 - maven-bom/pom.xml | 1 - maven-compat/pom.xml | 172 ---- .../apache/maven/ArtifactFilterManager.java | 56 -- .../maven/ArtifactFilterManagerDelegate.java | 32 - .../maven/DefaultArtifactFilterManager.java | 97 -- .../DefaultProjectDependenciesResolver.java | 222 ----- .../maven/ProjectDependenciesResolver.java | 105 -- .../maven/artifact/ArtifactScopeEnum.java | 114 --- .../apache/maven/artifact/ArtifactStatus.java | 110 --- .../UnknownRepositoryLayoutException.java | 47 - .../artifact/deployer/ArtifactDeployer.java | 67 -- .../deployer/ArtifactDeploymentException.java | 36 - .../deployer/DefaultArtifactDeployer.java | 149 --- .../ArtifactInstallationException.java | 36 - .../artifact/installer/ArtifactInstaller.java | 58 -- .../installer/DefaultArtifactInstaller.java | 121 --- .../artifact/manager/DefaultWagonManager.java | 168 ---- .../manager/WagonConfigurationException.java | 32 - .../maven/artifact/manager/WagonManager.java | 54 - .../metadata/AbstractArtifactMetadata.java | 33 - .../ArtifactMetadataRetrievalException.java | 61 -- .../metadata/ArtifactMetadataSource.java | 51 - .../artifact/metadata/ResolutionGroup.java | 47 - .../repository/ArtifactRepositoryFactory.java | 62 -- .../repository/DefaultArtifactRepository.java | 245 ----- .../DefaultArtifactRepositoryFactory.java | 123 --- .../LegacyLocalRepositoryManager.java | 354 ------- .../layout/FlatRepositoryLayout.java | 84 -- .../metadata/AbstractRepositoryMetadata.java | 188 ---- .../metadata/ArtifactRepositoryMetadata.java | 107 -- .../DefaultRepositoryMetadataManager.java | 431 -------- .../metadata/GroupRepositoryMetadata.java | 97 -- .../repository/metadata/MetadataBridge.java | 146 --- .../repository/metadata/MetadataUtils.java | 34 - .../metadata/RepositoryMetadata.java | 88 -- ...RepositoryMetadataDeploymentException.java | 34 - ...positoryMetadataInstallationException.java | 34 - .../metadata/RepositoryMetadataManager.java | 66 -- .../RepositoryMetadataReadException.java | 34 - ...RepositoryMetadataResolutionException.java | 34 - .../SnapshotArtifactRepositoryMetadata.java | 82 -- .../artifact/resolver/ArtifactCollector.java | 46 - .../resolver/ArtifactResolutionRequest.java | 296 ------ .../resolver/ArtifactResolutionResult.java | 327 ------ .../artifact/resolver/ArtifactResolver.java | 130 --- .../resolver/DebugResolutionListener.java | 141 --- .../resolver/DefaultArtifactCollector.java | 32 - .../resolver/DefaultArtifactResolver.java | 612 ------------ .../DefaultResolutionErrorHandler.java | 83 -- .../resolver/ResolutionErrorHandler.java | 28 - .../artifact/resolver/ResolutionListener.java | 101 -- .../ResolutionListenerForDepMgmt.java | 38 - .../artifact/resolver/ResolutionNode.java | 215 ---- .../resolver/UnresolvedArtifacts.java | 59 -- .../resolver/WarningResolutionListener.java | 58 -- .../filter/InversionArtifactFilter.java | 59 -- .../resolver/filter/OrArtifactFilter.java | 79 -- .../resolver/filter/TypeArtifactFilter.java | 57 -- .../versioning/ManagedVersionMap.java | 51 - .../execution/DefaultRuntimeInformation.java | 57 -- .../maven/execution/RuntimeInformation.java | 31 - .../apache/maven/plugin/PluginManager.java | 78 -- .../plugin/internal/DefaultPluginManager.java | 223 ----- .../maven/profiles/DefaultProfileManager.java | 206 ---- .../apache/maven/profiles/ProfileManager.java | 57 -- .../profiles/ProfilesConversionUtils.java | 135 --- .../activation/DetectedProfileActivator.java | 33 - .../activation/FileProfileActivator.java | 93 -- .../activation/JdkPrefixProfileActivator.java | 82 -- .../OperatingSystemProfileActivator.java | 133 --- .../ProfileActivationException.java | 36 - .../profiles/activation/ProfileActivator.java | 34 - .../SystemPropertyProfileActivator.java | 95 -- .../project/DefaultMavenProjectBuilder.java | 287 ------ .../DefaultProjectBuilderConfiguration.java | 93 -- .../project/InvalidProjectModelException.java | 70 -- .../maven/project/MavenProjectBuilder.java | 77 -- .../MissingRepositoryElementException.java | 36 - .../org/apache/maven/project/ModelUtils.java | 60 -- .../project/ProjectBuilderConfiguration.java | 52 - .../apache/maven/project/ProjectUtils.java | 100 -- .../artifact/ActiveProjectArtifact.java | 334 ------- .../artifact/DefaultMavenMetadataCache.java | 324 ------ .../artifact/DefaultMetadataSource.java | 51 - .../project/artifact/MavenMetadataCache.java | 47 - .../project/artifact/MavenMetadataSource.java | 712 ------------- .../artifact/ProjectArtifactMetadata.java | 110 --- .../DefaultModelInheritanceAssembler.java | 53 - .../ModelInheritanceAssembler.java | 37 - .../AbstractStringBasedModelInterpolator.java | 332 ------- .../BuildTimestampValueSource.java | 55 -- .../ModelInterpolationException.java | 59 -- .../interpolation/ModelInterpolator.java | 55 -- .../PathTranslatingPostProcessor.java | 59 -- .../RegexBasedModelInterpolator.java | 47 - .../StringSearchModelInterpolator.java | 303 ------ .../project/path/DefaultPathTranslator.java | 217 ---- .../maven/project/path/PathTranslator.java | 38 - .../validation/DefaultModelValidator.java | 69 -- .../validation/ModelValidationResult.java | 87 -- .../project/validation/ModelValidator.java | 33 - .../maven/reporting/MavenReportException.java | 34 - .../ArtifactDoesNotExistException.java | 33 - .../repository/ArtifactTransferEvent.java | 299 ------ .../ArtifactTransferFailedException.java | 33 - .../repository/ArtifactTransferListener.java | 37 - .../repository/ArtifactTransferResource.java | 63 -- .../repository/DefaultMirrorSelector.java | 207 ---- .../DelegatingLocalArtifactRepository.java | 175 ---- .../repository/LocalArtifactRepository.java | 34 - ...LocalRepositoryNotAccessibleException.java | 38 - .../repository/MavenArtifactMetadata.java | 101 -- .../maven/repository/MetadataGraph.java | 81 -- .../maven/repository/MetadataGraphNode.java | 87 -- .../repository/MetadataResolutionRequest.java | 199 ---- .../repository/MetadataResolutionResult.java | 311 ------ .../maven/repository/MirrorSelector.java | 41 - .../maven/repository/RepositorySystem.java | 168 ---- .../UserLocalArtifactRepository.java | 69 -- .../repository/VersionNotFoundException.java | 74 -- .../legacy/ChecksumFailedException.java | 36 - .../legacy/DefaultUpdateCheckManager.java | 331 ------- .../legacy/DefaultWagonManager.java | 709 ------------- .../legacy/LegacyRepositorySystem.java | 798 --------------- .../repository/legacy/MavenArtifact.java | 78 -- .../legacy/TransferListenerAdapter.java | 153 --- .../repository/legacy/UpdateCheckManager.java | 42 - .../legacy/WagonConfigurationException.java | 55 -- .../maven/repository/legacy/WagonManager.java | 87 -- .../metadata/AbstractArtifactMetadata.java | 59 -- .../ArtifactMetadataRetrievalException.java | 67 -- .../metadata/ArtifactMetadataSource.java | 73 -- .../DefaultMetadataResolutionRequest.java | 113 --- .../metadata/MetadataResolutionRequest.java | 109 -- .../legacy/metadata/ResolutionGroup.java | 81 -- .../repository/ArtifactRepositoryFactory.java | 61 -- .../DefaultArtifactRepositoryFactory.java | 129 --- .../DefaultLegacyArtifactCollector.java | 753 -------------- .../resolver/LegacyArtifactCollector.java | 75 -- .../resolver/conflict/ConflictResolver.java | 41 - .../conflict/ConflictResolverFactory.java | 45 - .../ConflictResolverNotFoundException.java | 43 - .../conflict/DefaultConflictResolver.java | 33 - .../DefaultConflictResolverFactory.java | 73 -- .../conflict/FarthestConflictResolver.java | 46 - .../conflict/NearestConflictResolver.java | 46 - .../conflict/NewestConflictResolver.java | 58 -- .../conflict/OldestConflictResolver.java | 58 -- .../AbstractVersionTransformation.java | 117 --- .../transform/ArtifactTransformation.java | 80 -- .../ArtifactTransformationManager.java | 83 -- .../DefaultArtifactTransformationManager.java | 89 -- .../LatestArtifactTransformation.java | 69 -- .../ReleaseArtifactTransformation.java | 90 -- .../transform/SnapshotTransformation.java | 151 --- .../repository/metadata/ArtifactMetadata.java | 330 ------- .../metadata/ClasspathContainer.java | 126 --- .../metadata/ClasspathTransformation.java | 44 - .../DefaultClasspathTransformation.java | 155 --- .../DefaultGraphConflictResolutionPolicy.java | 68 -- .../DefaultGraphConflictResolver.java | 221 ----- .../GraphConflictResolutionException.java | 42 - .../GraphConflictResolutionPolicy.java | 32 - .../metadata/GraphConflictResolver.java | 46 - .../repository/metadata/MetadataGraph.java | 435 -------- .../metadata/MetadataGraphEdge.java | 167 ---- .../MetadataGraphTransformationException.java | 41 - .../metadata/MetadataGraphVertex.java | 178 ---- .../metadata/MetadataResolution.java | 63 -- .../metadata/MetadataResolutionException.java | 45 - .../metadata/MetadataResolutionRequest.java | 68 -- .../MetadataResolutionRequestTypeEnum.java | 44 - .../metadata/MetadataResolutionResult.java | 135 --- .../metadata/MetadataRetrievalException.java | 51 - .../repository/metadata/MetadataSource.java | 37 - .../repository/metadata/MetadataTreeNode.java | 125 --- .../settings/DefaultMavenSettingsBuilder.java | 138 --- .../maven/settings/MavenSettingsBuilder.java | 71 -- .../toolchain/DefaultToolchainsBuilder.java | 59 -- .../maven/toolchain/ToolchainsBuilder.java | 43 - .../ExpressionDocumentationException.java | 35 - .../plugin/ExpressionDocumenter.java | 143 --- maven-compat/src/main/mdo/paramdoc.mdo | 154 --- maven-compat/src/main/mdo/profiles.mdo | 400 -------- .../plugin-expressions/project.paramdoc.xml | 172 ---- .../plugin-expressions/rootless.paramdoc.xml | 48 - .../plugin-expressions/settings.paramdoc.xml | 53 - .../main/resources/META-INF/maven/plugin.xml | 218 ---- maven-compat/src/site/apt/index.apt | 32 - maven-compat/src/site/site.xml | 35 - .../AbstractCoreMavenComponentTestCase.java | 302 ------ .../ProjectDependenciesResolverTest.java | 111 --- .../AbstractArtifactComponentTestCase.java | 347 ------- .../deployer/ArtifactDeployerTest.java | 76 -- .../SimpleArtifactMetadataSource.java | 57 -- .../factory/DefaultArtifactFactoryTest.java | 70 -- .../installer/ArtifactInstallerTest.java | 67 -- .../metadata/SwitchableMetadataSource.java | 80 -- .../artifact/metadata/TestMetadataSource.java | 91 -- .../MavenArtifactRepositoryTest.java | 56 -- .../ArtifactResolutionExceptionTest.java | 59 -- .../resolver/ArtifactResolverTest.java | 274 ----- .../resolver/DefaultArtifactResolverTest.java | 94 -- .../artifact/resolver/TestFileWagon.java | 76 -- .../resolver/TestMavenWorkspaceReader.java | 80 -- .../resolver/TestTransferListener.java | 37 - .../filter/AndArtifactFilterTest.java | 52 - .../resolver/filter/FilterHashEqualsTest.java | 48 - .../resolver/filter/OrArtifactFilterTest.java | 53 - .../filter/ScopeArtifactFilterTest.java | 92 -- .../artifact/testutils/TestFileManager.java | 165 ---- .../transform/TransformationManagerTest.java | 60 -- .../manager/DefaultProfileManagerTest.java | 234 ----- .../project/AbstractMavenProjectTestCase.java | 167 ---- .../project/ClasspathArtifactResolver.java | 80 -- .../EmptyLifecycleBindingsInjector.java | 155 --- .../maven/project/EmptyLifecycleExecutor.java | 93 -- .../project/LegacyLocalRepositoryManager.java | 163 --- .../project/ProjectClasspathTestType.java | 139 --- .../maven/project/TestArtifactResolver.java | 38 - .../project/TestMavenRepositorySystem.java | 34 - .../maven/project/TestProjectBuilder.java | 70 -- .../DefaultMavenMetadataCacheTest.java | 73 -- .../artifact/MavenMetadataSourceTest.java | 176 ---- .../AbstractProjectInheritanceTestCase.java | 61 -- .../t00/ProjectInheritanceTest.java | 91 -- .../t01/ProjectInheritanceTest.java | 91 -- .../t02/ProjectInheritanceTest.java | 162 --- .../t03/ProjectInheritanceTest.java | 67 -- .../t04/ProjectInheritanceTest.java | 81 -- .../t05/ProjectInheritanceTest.java | 76 -- .../t06/ProjectInheritanceTest.java | 79 -- .../t07/ProjectInheritanceTest.java | 79 -- .../t08/ProjectInheritanceTest.java | 80 -- .../t09/ProjectInheritanceTest.java | 121 --- .../t10/ProjectInheritanceTest.java | 94 -- .../t11/ProjectInheritanceTest.java | 65 -- .../t12/ProjectInheritanceTest.java | 70 -- .../t12scm/ProjectInheritanceTest.java | 123 --- .../path/DefaultPathTranslatorTest.java | 56 -- .../repository/DefaultMirrorSelectorTest.java | 35 - .../LegacyRepositorySystemTest.java | 220 ----- .../maven/repository/MirrorProcessorTest.java | 247 ----- .../maven/repository/TestArtifactHandler.java | 78 -- .../repository/TestRepositorySystem.java | 301 ------ .../legacy/DefaultUpdateCheckManagerTest.java | 243 ----- .../legacy/DefaultWagonManagerTest.java | 340 ------- .../legacy/LegacyRepositorySystemTest.java | 67 -- .../repository/legacy/PerLookupWagon.java | 32 - .../maven/repository/legacy/StringWagon.java | 84 -- .../maven/repository/legacy/WagonA.java | 34 - .../maven/repository/legacy/WagonB.java | 34 - .../maven/repository/legacy/WagonC.java | 34 - .../maven/repository/legacy/WagonMock.java | 43 - .../DefaultArtifactCollectorTest.java | 932 ------------------ .../AbstractConflictResolverTest.java | 125 --- .../FarthestConflictResolverTest.java | 100 -- .../conflict/NearestConflictResolverTest.java | 100 -- .../conflict/NewestConflictResolverTest.java | 100 -- .../conflict/OldestConflictResolverTest.java | 100 -- ...efaultClasspathTransformationTestType.java | 120 --- ...aultGraphConflictResolutionPolicyTest.java | 59 -- .../DefaultGraphConflictResolverTest.java | 202 ---- .../metadata/TestMetadataSource.java | 88 -- .../it0063/jdk/jre/placeholder.txt | 1 - .../it0063/jdk/lib/tools.jar | Bin 345 -> 0 bytes .../it0063/pom.xml | 55 -- .../project-with-exclusions/pom.xml | 41 - .../org/apache/maven/its/a/0.1/a-0.1.jar | Bin 1898 -> 0 bytes .../org/apache/maven/its/a/0.1/a-0.1.pom | 41 - .../org/apache/maven/its/a/maven-metadata.xml | 12 - .../org/apache/maven/its/b/0.1/b-0.1.jar | Bin 1936 -> 0 bytes .../org/apache/maven/its/b/0.1/b-0.1.pom | 49 - .../org/apache/maven/its/b/maven-metadata.xml | 12 - .../repository-system/maven-core-2.1.0.jar | 0 .../maven/org.apache.maven.api.di.Inject | 1 - .../artifact-install/artifact-1.0.jar | 1 - .../t00/maven/poms/p0-1.0.pom | 11 - .../t00/maven/poms/p1-1.0.pom | 16 - .../t00/maven/poms/p2-1.0.pom | 18 - .../t00/maven/poms/p3-1.0.pom | 14 - .../t00/maven/poms/p4-1.0.pom | 13 - .../t01/maven.t01/poms/p0-1.0.pom | 11 - .../t01/maven.t01/poms/p1-1.0.pom | 16 - .../t01/maven.t01/poms/p2-1.0.pom | 16 - .../t01/maven.t01/poms/p3-1.0.pom | 16 - .../t01/maven.t01/poms/p4-1.0.pom | 16 - .../t02/p0/p1/p2/p3/p4/p5/pom.xml | 32 - .../t02/p0/p1/p2/p3/p4/pom.xml | 32 - .../inheritance-repo/t02/p0/p1/p2/p3/pom.xml | 33 - .../inheritance-repo/t02/p0/p1/p2/pom.xml | 37 - .../inheritance-repo/t02/p0/p1/pom.xml | 51 - .../resources/inheritance-repo/t02/p0/pom.xml | 30 - .../inheritance-repo/t03/p0/p1/pom.xml | 45 - .../resources/inheritance-repo/t03/p0/pom.xml | 30 - .../t04/maven-test/jars/t04-a-1.0.jar | 1 - .../t04/maven-test/jars/t04-b-1.0.jar | 1 - .../t04/maven-test/jars/t04-b-2.0.jar | 1 - .../t04/maven-test/jars/t04-c-1.0.jar | 1 - .../t04/maven-test/jars/t04-c-2.0.jar | 1 - .../t04/maven-test/poms/t04-a-1.0.pom | 21 - .../t04/maven-test/poms/t04-b-1.0.pom | 7 - .../t04/maven-test/poms/t04-b-2.0.pom | 7 - .../t04/maven-test/poms/t04-c-1.0.pom | 7 - .../t04/maven-test/poms/t04-c-2.0.pom | 7 - .../inheritance-repo/t04/p0/p1/pom.xml | 41 - .../resources/inheritance-repo/t04/p0/pom.xml | 37 - .../t05/maven-test/jars/t05-a-1.0.jar | 1 - .../t05/maven-test/jars/t05-a-2.0.jar | 1 - .../t05/maven-test/jars/t05-b-1.0.jar | 1 - .../t05/maven-test/jars/t05-b-1.1.jar | 1 - .../t05/maven-test/jars/t05-b-2.0.jar | 1 - .../t05/maven-test/jars/t05-c-1.0.jar | 1 - .../t05/maven-test/jars/t05-d-1.0.jar | 1 - .../t05/maven-test/jars/t05-d-1.1.jar | 1 - .../t05/maven-test/jars/t05-d-1.2.jar | 1 - .../t05/maven-test/poms/t05-a-1.0.pom | 23 - .../t05/maven-test/poms/t05-a-2.0.pom | 23 - .../t05/maven-test/poms/t05-b-1.0.pom | 24 - .../t05/maven-test/poms/t05-b-1.1.pom | 24 - .../t05/maven-test/poms/t05-b-2.0.pom | 24 - .../t05/maven-test/poms/t05-c-1.0.pom | 17 - .../t05/maven-test/poms/t05-d-1.0.pom | 7 - .../t05/maven-test/poms/t05-d-1.1.pom | 7 - .../t05/maven-test/poms/t05-d-1.2.pom | 7 - .../inheritance-repo/t05/p0/p1/pom.xml | 54 - .../resources/inheritance-repo/t05/p0/pom.xml | 36 - .../t06/maven-test/jars/t06-a-1.0.jar | 1 - .../t06/maven-test/jars/t06-b-1.0.jar | 1 - .../t06/maven-test/jars/t06-b-1.1.jar | 1 - .../t06/maven-test/jars/t06-c-1.0.jar | 1 - .../t06/maven-test/jars/t06-d-1.0.jar | 1 - .../t06/maven-test/jars/t06-d-1.1.jar | 1 - .../t06/maven-test/jars/t06-d-1.2.jar | 1 - .../t06/maven-test/poms/t06-a-1.0.pom | 23 - .../t06/maven-test/poms/t06-b-1.0.pom | 24 - .../t06/maven-test/poms/t06-b-1.1.pom | 24 - .../t06/maven-test/poms/t06-c-1.0.pom | 17 - .../t06/maven-test/poms/t06-d-1.0.pom | 7 - .../t06/maven-test/poms/t06-d-1.1.pom | 7 - .../t06/maven-test/poms/t06-d-1.2.pom | 7 - .../inheritance-repo/t06/p0/p1/pom.xml | 54 - .../resources/inheritance-repo/t06/p0/pom.xml | 37 - .../t07/maven-test/jars/t07-a-1.0.jar | 1 - .../t07/maven-test/jars/t07-b-1.0.jar | 1 - .../t07/maven-test/jars/t07-b-1.1.jar | 1 - .../t07/maven-test/jars/t07-c-1.0.jar | 1 - .../t07/maven-test/jars/t07-d-1.0.jar | 1 - .../t07/maven-test/jars/t07-d-1.1.jar | 1 - .../t07/maven-test/jars/t07-d-1.2.jar | 1 - .../t07/maven-test/poms/t07-a-1.0.pom | 23 - .../t07/maven-test/poms/t07-b-1.0.pom | 24 - .../t07/maven-test/poms/t07-b-1.1.pom | 24 - .../t07/maven-test/poms/t07-c-1.0.pom | 17 - .../t07/maven-test/poms/t07-d-1.0.pom | 7 - .../t07/maven-test/poms/t07-d-1.1.pom | 7 - .../t07/maven-test/poms/t07-d-1.2.pom | 7 - .../inheritance-repo/t07/p0/p1/pom.xml | 54 - .../resources/inheritance-repo/t07/p0/pom.xml | 37 - .../t08/maven-test/jars/t08-a-1.0.jar | 1 - .../t08/maven-test/jars/t08-b-1.0.jar | 1 - .../t08/maven-test/jars/t08-b-1.1.jar | 1 - .../t08/maven-test/jars/t08-c-1.0.jar | 1 - .../t08/maven-test/jars/t08-d-1.0.jar | 1 - .../t08/maven-test/jars/t08-d-1.1.jar | 1 - .../t08/maven-test/jars/t08-d-1.2.jar | 1 - .../t08/maven-test/poms/t08-a-1.0.pom | 23 - .../t08/maven-test/poms/t08-b-1.0.pom | 24 - .../t08/maven-test/poms/t08-b-1.1.pom | 24 - .../t08/maven-test/poms/t08-c-1.0.pom | 17 - .../t08/maven-test/poms/t08-d-1.0.pom | 7 - .../t08/maven-test/poms/t08-d-1.1.pom | 7 - .../t08/maven-test/poms/t08-d-1.2.pom | 7 - .../inheritance-repo/t08/p0/p1/pom.xml | 59 -- .../resources/inheritance-repo/t08/p0/pom.xml | 37 - .../t09/maven-test/jars/t09-a-1.0.jar | 1 - .../t09/maven-test/jars/t09-b-1.0.jar | 1 - .../t09/maven-test/jars/t09-c-1.0.jar | 1 - .../t09/maven-test/jars/t09-d-1.0.jar | 1 - .../t09/maven-test/poms/t09-a-1.0.pom | 24 - .../t09/maven-test/poms/t09-b-1.0.pom | 17 - .../t09/maven-test/poms/t09-c-1.0.pom | 7 - .../t09/maven-test/poms/t09-d-1.0.pom | 17 - .../inheritance-repo/t09/p0/p1/pom.xml | 36 - .../inheritance-repo/t09/p0/p2/pom.xml | 42 - .../resources/inheritance-repo/t09/p0/pom.xml | 38 - .../t10/maven-test/jars/t10-a-1.0.jar | 1 - .../t10/maven-test/jars/t10-b-1.0.jar | 1 - .../t10/maven-test/jars/t10-c-1.0.jar | 1 - .../t10/maven-test/poms/t10-a-1.0.pom | 24 - .../t10/maven-test/poms/t10-b-1.0.pom | 7 - .../t10/maven-test/poms/t10-c-1.0.pom | 7 - .../inheritance-repo/t10/p0/p1/pom.xml | 42 - .../resources/inheritance-repo/t10/p0/pom.xml | 41 - .../inheritance-repo/t11/p0/p1/pom.xml | 16 - .../resources/inheritance-repo/t11/p0/pom.xml | 27 - .../inheritance-repo/t12/p0/p1/pom.xml | 29 - .../resources/inheritance-repo/t12/p0/pom.xml | 30 - .../t12scm/maven/p0/1.0/p0-1.0.pom | 18 - .../t12scm/maven/p1/1.0/p1-1.0.pom | 11 - .../t12scm/p0/modules/p1/pom.xml | 11 - .../inheritance-repo/t12scm/p0/pom.xml | 18 - .../src/test/resources/local-repo/marker.txt | 1 - .../maven-test/jars/maven-test-a-1.0.jar | 1 - .../maven-test/jars/maven-test-b-1.0.jar | 1 - .../maven-test/jars/maven-test-c-1.0.jar | 1 - .../maven-test/jars/maven-test-d-1.0.jar | 1 - .../maven-test/poms/maven-test-a-1.0.pom | 23 - .../maven-test/poms/maven-test-b-1.0.pom | 23 - .../maven-test/poms/maven-test-c-1.0.pom | 16 - .../maven-test/poms/maven-test-d-1.1.pom | 7 - .../maven-test/poms/maven-test-d-1.2.pom | 7 - .../jars/maven-snapshot-a-1.0-SNAPSHOT.jar | 1 - ...apshot-a-1.0-SNAPSHOT.jar.snapshot-version | 1 - .../jars/maven-snapshot-b-1.0-SNAPSHOT.jar | 1 - ...apshot-b-1.0-SNAPSHOT.jar.snapshot-version | 1 - .../jars/maven-snapshot-e-1.0-SNAPSHOT.jar | 1 - ...apshot-e-1.0-SNAPSHOT.jar.snapshot-version | 1 - .../maven-test-snapshot-resolving-1.0.pom | 49 - .../deployer/ArtifactDeployerTest.xml | 23 - .../installer/ArtifactInstallerTest.xml | 23 - .../manager/DefaultWagonManagerTest.xml | 48 - .../resolver/ArtifactResolverTest.xml | 71 -- .../resolver/ArtifactUpdatePolicyTest.xml | 29 - maven-compat/src/test/resources/pom.xml | 155 --- .../project-with-scoped-dependencies.xml | 99 -- .../projects/scope/transitive-compile-dep.xml | 57 -- .../projects/scope/transitive-default-dep.xml | 58 -- .../scope/transitive-provided-dep.xml | 57 -- .../projects/scope/transitive-runtime-dep.xml | 58 -- .../projects/scope/transitive-test-dep.xml | 58 -- maven-core/pom.xml | 1 - .../filter/ExclusionArtifactFilter.java | 2 - .../maven/lifecycle/DefaultLifecycles.java | 7 +- .../Maven3CompatDependenciesValidator.java | 62 -- .../resources/META-INF/maven/extension.xml | 1 - .../filter/ExclusionArtifactFilterTest.java | 2 +- .../project-with-inheritance/pom.xml | 6 - .../project-with-inheritance/pom.xml | 6 - .../org/apache/maven/lifecycle/pom.xml | 6 - pom.xml | 6 - src/site/resources/images/maven-deps.svg | 1 + 443 files changed, 4 insertions(+), 34671 deletions(-) delete mode 100644 maven-compat/pom.xml delete mode 100644 maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/ProjectDependenciesResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/plugin/PluginManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/path/PathTranslator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java delete mode 100644 maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java delete mode 100644 maven-compat/src/main/mdo/paramdoc.mdo delete mode 100644 maven-compat/src/main/mdo/profiles.mdo delete mode 100644 maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml delete mode 100644 maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml delete mode 100644 maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml delete mode 100644 maven-compat/src/main/resources/META-INF/maven/plugin.xml delete mode 100644 maven-compat/src/site/apt/index.apt delete mode 100644 maven-compat/src/site/site.xml delete mode 100644 maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/metadata/SwitchableMetadataSource.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestMavenWorkspaceReader.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleBindingsInjector.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTestType.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/TestArtifactHandler.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/TestRepositorySystem.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTestType.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java delete mode 100644 maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java delete mode 100644 maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/jre/placeholder.txt delete mode 100644 maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/lib/tools.jar delete mode 100644 maven-compat/src/test/projects/project-dependencies-resolver/it0063/pom.xml delete mode 100644 maven-compat/src/test/projects/project-dependencies-resolver/project-with-exclusions/pom.xml delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.pom delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.pom delete mode 100644 maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml delete mode 100644 maven-compat/src/test/repository-system/maven-core-2.1.0.jar delete mode 100644 maven-compat/src/test/resources/META-INF/maven/org.apache.maven.api.di.Inject delete mode 100644 maven-compat/src/test/resources/artifact-install/artifact-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml delete mode 100644 maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml delete mode 100644 maven-compat/src/test/resources/local-repo/marker.txt delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom delete mode 100644 maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version delete mode 100644 maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom delete mode 100644 maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml delete mode 100644 maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml delete mode 100644 maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml delete mode 100644 maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml delete mode 100644 maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml delete mode 100644 maven-compat/src/test/resources/pom.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml delete mode 100644 maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml delete mode 100644 maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index f73fb6787924..161db00b6f20 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -45,11 +45,6 @@ under the License. org.apache.maven maven-core - - org.apache.maven - maven-compat - - commons-cli commons-cli diff --git a/maven-bom/pom.xml b/maven-bom/pom.xml index e3941069b68f..9e127f4c690a 100644 --- a/maven-bom/pom.xml +++ b/maven-bom/pom.xml @@ -64,7 +64,6 @@ under the License. diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml deleted file mode 100644 index e42eba4687e9..000000000000 --- a/maven-compat/pom.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - 4.0.0 - - - org.apache.maven - maven - 4.0.0-beta-4-SNAPSHOT - - - maven-compat - - Maven Compat (deprecated) - Deprecated Maven2 classes maintained as compatibility layer. - - - - org.apache.maven - maven-model - - - org.apache.maven - maven-model-builder - - - org.apache.maven - maven-settings - - - org.apache.maven - maven-settings-builder - - - org.apache.maven - maven-artifact - - - org.apache.maven - maven-core - - - org.apache.maven - maven-resolver-provider - - - org.apache.maven - maven-repository-metadata - - - org.apache.maven.resolver - maven-resolver-api - - - org.apache.maven.resolver - maven-resolver-util - - - org.apache.maven.resolver - maven-resolver-impl - - - org.codehaus.plexus - plexus-interpolation - - - org.apache.maven.wagon - wagon-provider-api - - - - javax.inject - javax.inject - provided - - - org.eclipse.sisu - org.eclipse.sisu.plexus - provided - - - - org.hamcrest - hamcrest - test - - - org.eclipse.sisu - org.eclipse.sisu.inject - test - - - com.google.inject - guice - test - - - - org.codehaus.plexus - plexus-testing - test - - - org.mockito - mockito-core - test - - - org.apache.maven.wagon - wagon-file - test - - - org.apache.maven.resolver - maven-resolver-connector-basic - test - - - org.apache.maven.resolver - maven-resolver-transport-wagon - test - - - - - - - org.eclipse.sisu - sisu-maven-plugin - - - org.codehaus.modello - modello-maven-plugin - - 1.0.0 - - src/main/mdo/profiles.mdo - src/main/mdo/paramdoc.mdo - - - - - modello - - java - xpp3-reader - xpp3-writer - - - - - - - - diff --git a/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java b/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java deleted file mode 100644 index e756a9ce4a1a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManager.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import java.util.Set; - -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; - -/** - * ArtifactFilterManager - */ -@Deprecated -public interface ArtifactFilterManager { - /** - * Returns a filter for core + extension artifacts. - * - * @return the artifact filter - * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin - * extensions. - */ - ArtifactFilter getArtifactFilter(); - - /** - * Returns a filter for only the core artifacts. - * - * @return the artifact filter - */ - ArtifactFilter getCoreArtifactFilter(); - - /** - * Exclude an extension artifact (doesn't affect getArtifactFilter's result, only getExtensionArtifactFilter). - * - * @param artifactId an artifact id - * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core and plugin - * extensions. - */ - void excludeArtifact(String artifactId); - - Set getCoreArtifactExcludes(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java b/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java deleted file mode 100644 index c9e752e453fd..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/ArtifactFilterManagerDelegate.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import java.util.Set; - -/** - * @deprecated use {@code META-INF/maven/extension.xml} to define artifacts exported by Maven core extensions. - */ -@Deprecated -public interface ArtifactFilterManagerDelegate { - - void addExcludes(Set excludes); - - void addCoreExcludes(Set excludes); -} diff --git a/maven-compat/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java b/maven-compat/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java deleted file mode 100644 index f698d53c652c..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/DefaultArtifactFilterManager.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; -import org.apache.maven.extension.internal.CoreExports; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactFilterManager implements ArtifactFilterManager { - - // this is a live injected collection - protected final List delegates; - - protected Set excludedArtifacts; - - private final Set coreArtifacts; - - @Inject - public DefaultArtifactFilterManager(List delegates, CoreExports coreExports) { - this.delegates = delegates; - this.coreArtifacts = coreExports.getExportedArtifacts(); - } - - private synchronized Set getExcludedArtifacts() { - if (excludedArtifacts == null) { - excludedArtifacts = new LinkedHashSet<>(coreArtifacts); - } - return excludedArtifacts; - } - - /** - * Returns the artifact filter for the core + extension artifacts. - * - * @see org.apache.maven.ArtifactFilterManager#getArtifactFilter() - */ - public ArtifactFilter getArtifactFilter() { - Set excludes = new LinkedHashSet<>(getExcludedArtifacts()); - - for (ArtifactFilterManagerDelegate delegate : delegates) { - delegate.addExcludes(excludes); - } - - return new ExclusionSetFilter(excludes); - } - - /** - * Returns the artifact filter for the standard core artifacts. - * - * @see org.apache.maven.ArtifactFilterManager#getCoreArtifactFilter() - */ - public ArtifactFilter getCoreArtifactFilter() { - return new ExclusionSetFilter(getCoreArtifactExcludes()); - } - - public void excludeArtifact(String artifactId) { - getExcludedArtifacts().add(artifactId); - } - - public Set getCoreArtifactExcludes() { - Set excludes = new LinkedHashSet<>(coreArtifacts); - - for (ArtifactFilterManagerDelegate delegate : delegates) { - delegate.addCoreExcludes(excludes); - } - - return excludes; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java b/maven-compat/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java deleted file mode 100644 index ce24588292b1..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException; -import org.apache.maven.artifact.resolver.ResolutionErrorHandler; -import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.ProjectArtifact; -import org.apache.maven.repository.RepositorySystem; - -/** - * @deprecated As of 3.2.2, and there is no direct replacement. This is an internal class which was not marked as such, - * but should have been. - * - */ -@Named -@Singleton -@Deprecated -public class DefaultProjectDependenciesResolver implements ProjectDependenciesResolver { - - private final RepositorySystem repositorySystem; - - private final ResolutionErrorHandler resolutionErrorHandler; - - @Inject - public DefaultProjectDependenciesResolver( - RepositorySystem repositorySystem, ResolutionErrorHandler resolutionErrorHandler) { - this.repositorySystem = repositorySystem; - this.resolutionErrorHandler = resolutionErrorHandler; - } - - public Set resolve(MavenProject project, Collection scopesToResolve, MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolve(Collections.singleton(project), scopesToResolve, session); - } - - public Set resolve( - MavenProject project, - Collection scopesToCollect, - Collection scopesToResolve, - MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException { - Set mavenProjects = Collections.singleton(project); - return resolveImpl( - mavenProjects, scopesToCollect, scopesToResolve, session, getIgnorableArtifacts(mavenProjects)); - } - - public Set resolve( - Collection projects, Collection scopesToResolve, MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveImpl(projects, null, scopesToResolve, session, getIgnorableArtifacts(projects)); - } - - public Set resolve( - MavenProject project, - Collection scopesToCollect, - Collection scopesToResolve, - MavenSession session, - Set ignorableArtifacts) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveImpl( - Collections.singleton(project), - scopesToCollect, - scopesToResolve, - session, - getIgnorableArtifacts(ignorableArtifacts)); - } - - private Set resolveImpl( - Collection projects, - Collection scopesToCollect, - Collection scopesToResolve, - MavenSession session, - Set projectIds) - throws ArtifactResolutionException, ArtifactNotFoundException { - Set resolved = new LinkedHashSet<>(); - - if (projects == null || projects.isEmpty()) { - return resolved; - } - - if ((scopesToCollect == null || scopesToCollect.isEmpty()) - && (scopesToResolve == null || scopesToResolve.isEmpty())) { - return resolved; - } - - /* - - Logic for transitive global exclusions - - List exclusions = new ArrayList(); - - for ( Dependency d : project.getDependencies() ) - { - if ( d.getExclusions() != null ) - { - for ( Exclusion e : d.getExclusions() ) - { - exclusions.add( e.getGroupId() + ":" + e.getArtifactId() ); - } - } - } - - ArtifactFilter scopeFilter = new ScopeArtifactFilter( scope ); - - ArtifactFilter filter; - - if ( ! exclusions.isEmpty() ) - { - filter = new AndArtifactFilter( Arrays.asList( new ArtifactFilter[]{ - new ExcludesArtifactFilter( exclusions ), scopeFilter } ) ); - } - else - { - filter = scopeFilter; - } - */ - - CumulativeScopeArtifactFilter resolutionScopeFilter = new CumulativeScopeArtifactFilter(scopesToResolve); - - CumulativeScopeArtifactFilter collectionScopeFilter = new CumulativeScopeArtifactFilter(scopesToCollect); - collectionScopeFilter = new CumulativeScopeArtifactFilter(collectionScopeFilter, resolutionScopeFilter); - - ArtifactResolutionRequest request = new ArtifactResolutionRequest() - .setResolveRoot(false) - .setResolveTransitively(true) - .setCollectionFilter(collectionScopeFilter) - .setResolutionFilter(resolutionScopeFilter) - .setLocalRepository(session.getLocalRepository()) - .setOffline(session.isOffline()) - .setForceUpdate(session.getRequest().isUpdateSnapshots()); - request.setServers(session.getRequest().getServers()); - request.setMirrors(session.getRequest().getMirrors()); - request.setProxies(session.getRequest().getProxies()); - - for (MavenProject project : projects) { - request.setArtifact(new ProjectArtifact(project)); - request.setArtifactDependencies(project.getDependencyArtifacts()); - request.setManagedVersionMap(project.getManagedVersionMap()); - request.setRemoteRepositories(project.getRemoteArtifactRepositories()); - - ArtifactResolutionResult result = repositorySystem.resolve(request); - - try { - resolutionErrorHandler.throwErrors(request, result); - } catch (MultipleArtifactsNotFoundException e) { - - Collection missing = new HashSet<>(e.getMissingArtifacts()); - - for (Iterator it = missing.iterator(); it.hasNext(); ) { - String key = ArtifactUtils.key(it.next()); - if (projectIds.contains(key)) { - it.remove(); - } - } - - if (!missing.isEmpty()) { - throw e; - } - } - - resolved.addAll(result.getArtifacts()); - } - - return resolved; - } - - private Set getIgnorableArtifacts(Collection projects) { - Set projectIds = new HashSet<>(projects.size() * 2); - - for (MavenProject p : projects) { - String key = ArtifactUtils.key(p.getGroupId(), p.getArtifactId(), p.getVersion()); - projectIds.add(key); - } - return projectIds; - } - - private Set getIgnorableArtifacts(Iterable artifactIterable) { - Set projectIds = new HashSet<>(); - - for (Artifact artifact : artifactIterable) { - String key = ArtifactUtils.key(artifact); - projectIds.add(key); - } - return projectIds; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/ProjectDependenciesResolver.java b/maven-compat/src/main/java/org/apache/maven/ProjectDependenciesResolver.java deleted file mode 100644 index 509ee5e9ed93..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/ProjectDependenciesResolver.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import java.util.Collection; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; - -/** - * @deprecated As of 3.2.2, and there is no direct replacement. This is an internal class which was not marked as such, - * but should have been. - * - */ -@Deprecated -public interface ProjectDependenciesResolver { - - /** - * Resolves the transitive dependencies of the specified project. - * - * @param project The project whose dependencies should be resolved, must not be {@code null}. - * @param scopesToResolve The dependency scopes that should be resolved, may be {@code null}. - * @param session The current build session, must not be {@code null}. - * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. - * @throws ArtifactResolutionException in case of resolution issue - * @throws ArtifactNotFoundException if an artifact is not found - */ - Set resolve(MavenProject project, Collection scopesToResolve, MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Resolves the transitive dependencies of the specified project. - * - * @param project The project whose dependencies should be resolved, must not be {@code null}. - * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}. - * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}. - * @param session The current build session, must not be {@code null}. - * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. - * @throws ArtifactResolutionException in case of resolution issue - * @throws ArtifactNotFoundException if an artifact is not found - */ - Set resolve( - MavenProject project, - Collection scopesToCollect, - Collection scopesToResolve, - MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Resolves the transitive dependencies of the specified project. - * - * @param project The project whose dependencies should be resolved, must not be {@code null}. - * @param scopesToCollect The dependency scopes that should be collected, may be {@code null}. - * @param scopesToResolve The dependency scopes that should be collected and also resolved, may be {@code null}. - * @param session The current build session, must not be {@code null}. - * @param ignorableArtifacts Artifacts that need not be resolved - * @return The transitive dependencies of the specified project that match the requested scopes, never {@code null}. - * @throws ArtifactResolutionException in case of resolution issue - * @throws ArtifactNotFoundException if an artifact is not found - */ - Set resolve( - MavenProject project, - Collection scopesToCollect, - Collection scopesToResolve, - MavenSession session, - Set ignorableArtifacts) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Resolves the transitive dependencies of the specified projects. Note that dependencies which can't be resolved - * from any repository but are present among the set of specified projects will not cause an exception. Instead, - * those unresolved artifacts will be returned in the result set, allowing the caller to take special care of - * artifacts that haven't been build yet. - * - * @param projects The projects whose dependencies should be resolved, may be {@code null}. - * @param scopes The dependency scopes that should be resolved, may be {@code null}. - * @param session The current build session, must not be {@code null}. - * @return The transitive dependencies of the specified projects that match the requested scopes, never - * {@code null}. - * @throws ArtifactResolutionException in case of resolution issue - * @throws ArtifactNotFoundException if an artifact is not found - */ - Set resolve(Collection projects, Collection scopes, MavenSession session) - throws ArtifactResolutionException, ArtifactNotFoundException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java deleted file mode 100644 index 34178d5bc4ff..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact; - -/** - * Type safe reincarnation of Artifact scope. Also supplies the {@code DEFAULT_SCOPE} as well - * as convenience method to deal with scope relationships. - * - * - */ -@Deprecated -public enum ArtifactScopeEnum { - compile(1), - test(2), - runtime(3), - provided(4), - system(5), - runtime_plus_system(6); - - public static final ArtifactScopeEnum DEFAULT_SCOPE = compile; - - private int id; - - // Constructor - ArtifactScopeEnum(int id) { - this.id = id; - } - - int getId() { - return id; - } - - /** - * Helper method to simplify null processing - * - * @param scope a scope or {@code null} - * @return the provided scope or DEFAULT_SCOPE - */ - public static ArtifactScopeEnum checkScope(ArtifactScopeEnum scope) { - return scope == null ? DEFAULT_SCOPE : scope; - } - - /** - * - * @return unsafe String representation of this scope. - */ - public String getScope() { - if (id == 1) { - return Artifact.SCOPE_COMPILE; - } else if (id == 2) { - return Artifact.SCOPE_TEST; - - } else if (id == 3) { - return Artifact.SCOPE_RUNTIME; - - } else if (id == 4) { - return Artifact.SCOPE_PROVIDED; - } else if (id == 5) { - return Artifact.SCOPE_SYSTEM; - } else { - return Artifact.SCOPE_RUNTIME_PLUS_SYSTEM; - } - } - - private static final ArtifactScopeEnum[][][] COMPLIANCY_SETS = { - {{compile}, {compile, provided, system}}, - {{test}, {compile, test, provided, system}}, - {{runtime}, {compile, runtime, system}}, - {{provided}, {compile, test, provided}} - }; - - /** - * scope relationship function. Used by the graph conflict resolution policies - * - * @param scope a scope - * @return true is supplied scope is an inclusive sub-scope of current one. - */ - public boolean encloses(ArtifactScopeEnum scope) { - final ArtifactScopeEnum s = checkScope(scope); - - // system scope is historic only - and simple - if (id == system.id) { - return scope.id == system.id; - } - - for (ArtifactScopeEnum[][] set : COMPLIANCY_SETS) { - if (id == set[0][0].id) { - for (ArtifactScopeEnum ase : set[1]) { - if (s.id == ase.id) { - return true; - } - } - break; - } - } - return false; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java deleted file mode 100644 index 3a6a2bdf5014..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact; - -import java.util.HashMap; -import java.util.Map; - -/** - * Type safe enumeration for the artifact status field. - * - */ -@Deprecated -public final class ArtifactStatus implements Comparable { - /** - * No trust - no information about status. - */ - public static final ArtifactStatus NONE = new ArtifactStatus("none", 0); - - /** - * No trust - information was generated with defaults. - */ - public static final ArtifactStatus GENERATED = new ArtifactStatus("generated", 1); - - /** - * Low trust - was converted from the Maven 1.x repository. - */ - public static final ArtifactStatus CONVERTED = new ArtifactStatus("converted", 2); - - /** - * Moderate trust - it was deployed directly from a partner. - */ - public static final ArtifactStatus PARTNER = new ArtifactStatus("partner", 3); - - /** - * Moderate trust - it was deployed directly by a user. - */ - public static final ArtifactStatus DEPLOYED = new ArtifactStatus("deployed", 4); - - /** - * Trusted, as it has had its data verified by hand. - */ - public static final ArtifactStatus VERIFIED = new ArtifactStatus("verified", 5); - - private final int rank; - - private final String key; - - private static Map map; - - private ArtifactStatus(String key, int rank) { - this.rank = rank; - this.key = key; - - if (map == null) { - map = new HashMap<>(); - } - map.put(key, this); - } - - public static ArtifactStatus valueOf(String status) { - ArtifactStatus retVal = null; - - if (status != null) { - retVal = map.get(status); - } - - return retVal != null ? retVal : NONE; - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - final ArtifactStatus that = (ArtifactStatus) o; - - return rank == that.rank; - } - - public int hashCode() { - return rank; - } - - public String toString() { - return key; - } - - public int compareTo(ArtifactStatus s) { - return rank - s.rank; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java b/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java deleted file mode 100644 index dcaa874cb6dd..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact; - -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - * Exception which is meant to occur when a layout specified for a particular - * repository doesn't have a corresponding {@link org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout} - * component in the current container. - * - */ -@Deprecated -public class UnknownRepositoryLayoutException extends InvalidRepositoryException { - - private final String layoutId; - - public UnknownRepositoryLayoutException(String repositoryId, String layoutId) { - super("Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId); - this.layoutId = layoutId; - } - - public UnknownRepositoryLayoutException(String repositoryId, String layoutId, ComponentLookupException e) { - super("Cannot find ArtifactRepositoryLayout instance for: " + layoutId, repositoryId, e); - this.layoutId = layoutId; - } - - public String getLayoutId() { - return layoutId; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java deleted file mode 100644 index 43dbd13ea591..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.deployer; - -import java.io.File; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * ArtifactDeployer - */ -@Deprecated -public interface ArtifactDeployer { - String ROLE = ArtifactDeployer.class.getName(); - - /** - * Deploy an artifact from a particular directory. The artifact handler is used to determine the - * filename of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact without extension - * @param artifact the artifact definition - * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into - * @throws ArtifactDeploymentException if an error occurred deploying the artifact - * @deprecated to be removed before 2.0 after the install/deploy plugins use the alternate - * method - */ - @Deprecated - void deploy( - String basedir, - String finalName, - Artifact artifact, - ArtifactRepository deploymentRepository, - ArtifactRepository localRepository) - throws ArtifactDeploymentException; - - /** - * Deploy an artifact from a particular file. - * - * @param source the file to deploy - * @param artifact the artifact definition - * @param deploymentRepository the repository to deploy to - * @param localRepository the local repository to install into - * @throws ArtifactDeploymentException if an error occurred deploying the artifact - */ - void deploy( - File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java deleted file mode 100644 index 6351873bfa12..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.deployer; - -/** - */ -@Deprecated -public class ArtifactDeploymentException extends Exception { - public ArtifactDeploymentException(String message) { - super(message); - } - - public ArtifactDeploymentException(Throwable cause) { - super(cause); - } - - public ArtifactDeploymentException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java deleted file mode 100644 index 3ecc9ab80e0b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.deployer; - -import javax.inject.Inject; -import javax.inject.Named; - -import java.io.File; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.MetadataBridge; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.deployment.DeployRequest; -import org.eclipse.aether.deployment.DeployResult; -import org.eclipse.aether.deployment.DeploymentException; -import org.eclipse.aether.metadata.MergeableMetadata; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.util.artifact.SubArtifact; - -/** - * DefaultArtifactDeployer - */ -@Named -@Deprecated -public class DefaultArtifactDeployer extends AbstractLogEnabled implements ArtifactDeployer { - - @Inject - private RepositorySystem repoSystem; - - @Inject - private LegacySupport legacySupport; - - private Map relatedMetadata = new ConcurrentHashMap<>(); - - /** - * @deprecated we want to use the artifact method only, and ensure artifact.file is set - * correctly. - */ - @Deprecated - public void deploy( - String basedir, - String finalName, - Artifact artifact, - ArtifactRepository deploymentRepository, - ArtifactRepository localRepository) - throws ArtifactDeploymentException { - String extension = artifact.getArtifactHandler().getExtension(); - File source = new File(basedir, finalName + "." + extension); - deploy(source, artifact, deploymentRepository, localRepository); - } - - public void deploy( - File source, Artifact artifact, ArtifactRepository deploymentRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException { - RepositorySystemSession session = - LegacyLocalRepositoryManager.overlay(localRepository, legacySupport.getRepositorySession(), repoSystem); - - DeployRequest request = new DeployRequest(); - - request.setTrace(RequestTrace.newChild(null, legacySupport.getSession().getCurrentProject())); - - org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact(artifact); - mainArtifact = mainArtifact.setFile(source); - request.addArtifact(mainArtifact); - - String versionKey = artifact.getGroupId() + ':' + artifact.getArtifactId(); - String snapshotKey = null; - if (artifact.isSnapshot()) { - snapshotKey = versionKey + ':' + artifact.getBaseVersion(); - request.addMetadata(relatedMetadata.get(snapshotKey)); - } - request.addMetadata(relatedMetadata.get(versionKey)); - - for (ArtifactMetadata metadata : artifact.getMetadataList()) { - if (metadata instanceof ProjectArtifactMetadata) { - org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact(mainArtifact, "", "pom"); - pomArtifact = pomArtifact.setFile(((ProjectArtifactMetadata) metadata).getFile()); - request.addArtifact(pomArtifact); - } else if (metadata instanceof SnapshotArtifactRepositoryMetadata - || metadata instanceof ArtifactRepositoryMetadata) { - // eaten, handled by repo system - } else { - request.addMetadata(new MetadataBridge(metadata)); - } - } - - RemoteRepository remoteRepo = RepositoryUtils.toRepo(deploymentRepository); - /* - * NOTE: This provides backward-compat with maven-deploy-plugin:2.4 which bypasses the repository factory when - * using an alternative deployment location. - */ - if (deploymentRepository instanceof DefaultArtifactRepository - && deploymentRepository.getAuthentication() == null) { - RemoteRepository.Builder builder = new RemoteRepository.Builder(remoteRepo); - builder.setAuthentication(session.getAuthenticationSelector().getAuthentication(remoteRepo)); - builder.setProxy(session.getProxySelector().getProxy(remoteRepo)); - remoteRepo = builder.build(); - } - request.setRepository(remoteRepo); - - DeployResult result; - try { - result = repoSystem.deploy(session, request); - } catch (DeploymentException e) { - throw new ArtifactDeploymentException(e.getMessage(), e); - } - - for (Object metadata : result.getMetadata()) { - if (metadata.getClass().getName().endsWith(".internal.VersionsMetadata")) { - relatedMetadata.put(versionKey, (MergeableMetadata) metadata); - } - if (snapshotKey != null && metadata.getClass().getName().endsWith(".internal.RemoteSnapshotMetadata")) { - relatedMetadata.put(snapshotKey, (MergeableMetadata) metadata); - } - } - - artifact.setResolvedVersion(result.getArtifacts().iterator().next().getVersion()); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java deleted file mode 100644 index 830a90bd11de..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.installer; - -/** - */ -@Deprecated -public class ArtifactInstallationException extends Exception { - public ArtifactInstallationException(String message) { - super(message); - } - - public ArtifactInstallationException(Throwable cause) { - super(cause); - } - - public ArtifactInstallationException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java deleted file mode 100644 index f9f4c12c771f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.installer; - -import java.io.File; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - */ -@Deprecated -public interface ArtifactInstaller { - String ROLE = ArtifactInstaller.class.getName(); - - /** - * Install an artifact from a particular directory. The artifact handler is used to determine - * the filename of the source file. - * - * @param basedir the directory where the artifact is stored - * @param finalName the name of the artifact sans extension - * @param artifact the artifact definition - * @param localRepository the local repository to install into - * @throws ArtifactInstallationException if an error occurred installing the artifact - * @deprecated to be removed before 2.0 after the install/deploy plugins use the alternate - * method - */ - @Deprecated - void install(String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException; - - /** - * Install an artifact from a particular file. - * - * @param source the file to install - * @param artifact the artifact definition - * @param localRepository the local repository to install into - * @throws ArtifactInstallationException if an error occurred installing the artifact - */ - void install(File source, Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java deleted file mode 100644 index 4adf578ddf04..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.installer; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.MetadataBridge; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.artifact.ProjectArtifactMetadata; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.RequestTrace; -import org.eclipse.aether.installation.InstallRequest; -import org.eclipse.aether.installation.InstallationException; -import org.eclipse.aether.util.artifact.SubArtifact; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactInstaller extends AbstractLogEnabled implements ArtifactInstaller { - - @Inject - private RepositorySystem repoSystem; - - @Inject - private LegacySupport legacySupport; - - /** @deprecated we want to use the artifact method only, and ensure artifact.file is set correctly. */ - @Deprecated - public void install(String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException { - String extension = artifact.getArtifactHandler().getExtension(); - File source = new File(basedir, finalName + "." + extension); - - install(source, artifact, localRepository); - } - - public void install(File source, Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException { - RepositorySystemSession session = - LegacyLocalRepositoryManager.overlay(localRepository, legacySupport.getRepositorySession(), repoSystem); - - InstallRequest request = new InstallRequest(); - - request.setTrace(RequestTrace.newChild(null, legacySupport.getSession().getCurrentProject())); - - org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact(artifact); - mainArtifact = mainArtifact.setFile(source); - request.addArtifact(mainArtifact); - - for (ArtifactMetadata metadata : artifact.getMetadataList()) { - if (metadata instanceof ProjectArtifactMetadata) { - org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact(mainArtifact, "", "pom"); - pomArtifact = pomArtifact.setFile(((ProjectArtifactMetadata) metadata).getFile()); - request.addArtifact(pomArtifact); - } else if (metadata instanceof SnapshotArtifactRepositoryMetadata - || metadata instanceof ArtifactRepositoryMetadata) { - // eaten, handled by repo system - } else { - request.addMetadata(new MetadataBridge(metadata)); - } - } - - try { - repoSystem.install(session, request); - } catch (InstallationException e) { - throw new ArtifactInstallationException(e.getMessage(), e); - } - - /* - * NOTE: Not used by Maven core, only here to provide backward-compat with plugins like the Install Plugin. - */ - - if (artifact.isSnapshot()) { - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy(true); - artifact.addMetadata(new SnapshotArtifactRepositoryMetadata(artifact, snapshot)); - } - - Versioning versioning = new Versioning(); - // TODO Should this be changed for MNG-6754 too? - versioning.updateTimestamp(); - versioning.addVersion(artifact.getBaseVersion()); - if (artifact.isRelease()) { - versioning.setRelease(artifact.getBaseVersion()); - } - artifact.addMetadata(new ArtifactRepositoryMetadata(artifact, versioning)); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java deleted file mode 100644 index ee2ff7240c7f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.manager; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.MirrorSelector; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecrypter; -import org.apache.maven.settings.crypto.SettingsDecryptionResult; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.codehaus.plexus.logging.Logger; - -/** - * Manages Wagon related operations in Maven. - */ -@Named -@Singleton -@Deprecated -public class DefaultWagonManager extends org.apache.maven.repository.legacy.DefaultWagonManager - implements WagonManager { - - // NOTE: This must use a different field name than in the super class or IoC has no chance to inject the loggers - @Inject - private Logger log; - - @Inject - private LegacySupport legacySupport; - - @Inject - private SettingsDecrypter settingsDecrypter; - - @Inject - private MirrorSelector mirrorSelector; - - @Inject - private ArtifactRepositoryFactory artifactRepositoryFactory; - - public AuthenticationInfo getAuthenticationInfo(String id) { - MavenSession session = legacySupport.getSession(); - - if (session != null && id != null) { - MavenExecutionRequest request = session.getRequest(); - - if (request != null) { - List servers = request.getServers(); - - if (servers != null) { - for (Server server : servers) { - if (id.equalsIgnoreCase(server.getId())) { - SettingsDecryptionResult result = - settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(server)); - server = result.getServer(); - - AuthenticationInfo authInfo = new AuthenticationInfo(); - authInfo.setUserName(server.getUsername()); - authInfo.setPassword(server.getPassword()); - authInfo.setPrivateKey(server.getPrivateKey()); - authInfo.setPassphrase(server.getPassphrase()); - - return authInfo; - } - } - } - } - } - - // empty one to prevent NPE - return new AuthenticationInfo(); - } - - public ProxyInfo getProxy(String protocol) { - MavenSession session = legacySupport.getSession(); - - if (session != null && protocol != null) { - MavenExecutionRequest request = session.getRequest(); - - if (request != null) { - List proxies = request.getProxies(); - - if (proxies != null) { - for (Proxy proxy : proxies) { - if (proxy.isActive() && protocol.equalsIgnoreCase(proxy.getProtocol())) { - SettingsDecryptionResult result = - settingsDecrypter.decrypt(new DefaultSettingsDecryptionRequest(proxy)); - proxy = result.getProxy(); - - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setHost(proxy.getHost()); - proxyInfo.setType(proxy.getProtocol()); - proxyInfo.setPort(proxy.getPort()); - proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); - proxyInfo.setUserName(proxy.getUsername()); - proxyInfo.setPassword(proxy.getPassword()); - - return proxyInfo; - } - } - } - } - } - - return null; - } - - public void getArtifact(Artifact artifact, ArtifactRepository repository) - throws TransferFailedException, ResourceDoesNotExistException { - getArtifact(artifact, repository, null, false); - } - - public void getArtifact(Artifact artifact, List remoteRepositories) - throws TransferFailedException, ResourceDoesNotExistException { - getArtifact(artifact, remoteRepositories, null, false); - } - - @Deprecated - public ArtifactRepository getMirrorRepository(ArtifactRepository repository) { - - Mirror mirror = mirrorSelector.getMirror( - repository, legacySupport.getSession().getSettings().getMirrors()); - - if (mirror != null) { - String id = mirror.getId(); - if (id == null) { - // TODO this should be illegal in settings.xml - id = repository.getId(); - } - - log.debug("Using mirror: " + mirror.getUrl() + " (id: " + id + ")"); - - repository = artifactRepositoryFactory.createArtifactRepository( - id, mirror.getUrl(), repository.getLayout(), repository.getSnapshots(), repository.getReleases()); - } - return repository; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java deleted file mode 100644 index 923ab3c68944..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.manager; - -/** - */ -@Deprecated -public class WagonConfigurationException extends org.apache.maven.repository.legacy.WagonConfigurationException { - public WagonConfigurationException(String repositoryId, String message, Throwable cause) { - super(repositoryId, message, cause); - } - - public WagonConfigurationException(String repositoryId, String message) { - super(repositoryId, message); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java deleted file mode 100644 index 8ae5e50dc864..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.manager; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.proxy.ProxyInfo; - -/** - * Manages Wagon related operations in Maven. - * - */ -@Deprecated -public interface WagonManager extends org.apache.maven.repository.legacy.WagonManager { - /** - * this method is only here for backward compat (project-info-reports:dependencies) - * the default implementation will return an empty AuthenticationInfo - * - * @param id an id - * @return corresponding authentication info - */ - AuthenticationInfo getAuthenticationInfo(String id); - - ProxyInfo getProxy(String protocol); - - void getArtifact(Artifact artifact, ArtifactRepository repository) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifact(Artifact artifact, List remoteRepositories) - throws TransferFailedException, ResourceDoesNotExistException; - - ArtifactRepository getMirrorRepository(ArtifactRepository repository); -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java deleted file mode 100644 index 1562d19c1ba3..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/AbstractArtifactMetadata.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import org.apache.maven.artifact.Artifact; - -/** - * AbstractArtifactMetadata - */ -@Deprecated -public abstract class AbstractArtifactMetadata - extends org.apache.maven.repository.legacy.metadata.AbstractArtifactMetadata - implements org.apache.maven.artifact.metadata.ArtifactMetadata { - protected AbstractArtifactMetadata(Artifact artifact) { - super(artifact); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java deleted file mode 100644 index 5330f7e3fc6b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataRetrievalException.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import org.apache.maven.artifact.Artifact; - -/** - * Error while retrieving repository metadata from the repository - deprecated - */ -@Deprecated -public class ArtifactMetadataRetrievalException - extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException { - - /** - * @param message a message - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(String message) { - super(message, null, null); - } - - /** - * @param cause a cause - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(Throwable cause) { - super(null, cause, null); - } - - /** - * @param message a message - * @param cause a cause - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(String message, Throwable cause) { - super(message, cause, null); - } - - public ArtifactMetadataRetrievalException(String message, Throwable cause, Artifact artifact) { - super(message, cause, artifact); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java deleted file mode 100644 index 771e4962bd50..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; - -/** - * Provides some metadata operations, like querying the remote repository for a list of versions available for an - * artifact - deprecated - */ -@Deprecated -public interface ArtifactMetadataSource extends org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource { - - ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException; - - ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException; - - List retrieveAvailableVersions(MetadataResolutionRequest request) - throws ArtifactMetadataRetrievalException; - - List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException; - - List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java b/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java deleted file mode 100644 index 25b5b657e463..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/metadata/ResolutionGroup.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * ResolutionGroup - */ -@Deprecated -public class ResolutionGroup extends org.apache.maven.repository.legacy.metadata.ResolutionGroup { - - public ResolutionGroup( - Artifact pomArtifact, Set artifacts, List resolutionRepositories) { - super(pomArtifact, artifacts, resolutionRepositories); - } - - public ResolutionGroup( - Artifact pomArtifact, - Artifact relocatedArtifact, - Set artifacts, - Map managedVersions, - List resolutionRepositories) { - super(pomArtifact, relocatedArtifact, artifacts, managedVersions, resolutionRepositories); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java deleted file mode 100644 index 85a2f24c9182..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; - -/** - */ -@Deprecated -public interface ArtifactRepositoryFactory { - String ROLE = ArtifactRepositoryFactory.class.getName(); - - String DEFAULT_LAYOUT_ID = "default"; - - String LOCAL_REPOSITORY_ID = "local"; - - @Deprecated - ArtifactRepositoryLayout getLayout(String layoutId) throws UnknownRepositoryLayoutException; - - @Deprecated - ArtifactRepository createDeploymentArtifactRepository(String id, String url, String layoutId, boolean uniqueVersion) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createDeploymentArtifactRepository( - String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion); - - ArtifactRepository createArtifactRepository( - String id, - String url, - String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases); - - void setGlobalUpdatePolicy(String snapshotPolicy); - - void setGlobalChecksumPolicy(String checksumPolicy); -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java deleted file mode 100644 index 15668909e6d6..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository; - -import java.io.File; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.repository.Proxy; -import org.apache.maven.wagon.repository.Repository; - -/** - * This class is an abstraction of the location from/to resources can be - * transferred. - * - */ -@Deprecated -public class DefaultArtifactRepository extends Repository implements ArtifactRepository { - private ArtifactRepositoryLayout layout; - - private ArtifactRepositoryPolicy snapshots; - - private ArtifactRepositoryPolicy releases; - - private boolean blacklisted; - - private Authentication authentication; - - private Proxy proxy; - - private List mirroredRepositories = Collections.emptyList(); - - private boolean blocked; - - /** - * Create a local repository or a test repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - */ - public DefaultArtifactRepository(String id, String url, ArtifactRepositoryLayout layout) { - this(id, url, layout, null, null); - } - - /** - * Create a remote deployment repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - * @param uniqueVersion whether to assign each snapshot a unique version - */ - public DefaultArtifactRepository(String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion) { - super(id, url); - this.layout = layout; - } - - /** - * Create a remote download repository. - * - * @param id the unique identifier of the repository - * @param url the URL of the repository - * @param layout the layout of the repository - * @param snapshots the policies to use for snapshots - * @param releases the policies to use for releases - */ - public DefaultArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout layout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) { - super(id, url); - - this.layout = layout; - - if (snapshots == null) { - snapshots = new ArtifactRepositoryPolicy( - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE); - } - - this.snapshots = snapshots; - - if (releases == null) { - releases = new ArtifactRepositoryPolicy( - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE); - } - - this.releases = releases; - } - - public String pathOf(Artifact artifact) { - return layout.pathOf(artifact); - } - - public String pathOfRemoteRepositoryMetadata(ArtifactMetadata artifactMetadata) { - return layout.pathOfRemoteRepositoryMetadata(artifactMetadata); - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return layout.pathOfLocalRepositoryMetadata(metadata, repository); - } - - public void setLayout(ArtifactRepositoryLayout layout) { - this.layout = layout; - } - - public ArtifactRepositoryLayout getLayout() { - return layout; - } - - public void setSnapshotUpdatePolicy(ArtifactRepositoryPolicy snapshots) { - this.snapshots = snapshots; - } - - public ArtifactRepositoryPolicy getSnapshots() { - return snapshots; - } - - public void setReleaseUpdatePolicy(ArtifactRepositoryPolicy releases) { - this.releases = releases; - } - - public ArtifactRepositoryPolicy getReleases() { - return releases; - } - - public String getKey() { - return getId(); - } - - public boolean isBlacklisted() { - return blacklisted; - } - - public void setBlacklisted(boolean blacklisted) { - this.blacklisted = blacklisted; - } - - public String toString() { - StringBuilder sb = new StringBuilder(256); - - sb.append(" id: ").append(getId()).append('\n'); - sb.append(" url: ").append(getUrl()).append('\n'); - sb.append(" layout: ").append(layout != null ? layout : "none").append('\n'); - - if (snapshots != null) { - sb.append("snapshots: [enabled => ").append(snapshots.isEnabled()); - sb.append(", update => ").append(snapshots.getUpdatePolicy()).append("]\n"); - } - - if (releases != null) { - sb.append(" releases: [enabled => ").append(releases.isEnabled()); - sb.append(", update => ").append(releases.getUpdatePolicy()).append("]\n"); - } - - return sb.toString(); - } - - public Artifact find(Artifact artifact) { - File artifactFile = new File(getBasedir(), pathOf(artifact)); - - // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal - // with multiple local repository implementations yet. - artifact.setFile(artifactFile); - - if (artifactFile.exists()) { - artifact.setResolved(true); - } - - return artifact; - } - - public List findVersions(Artifact artifact) { - return Collections.emptyList(); - } - - public boolean isProjectAware() { - return false; - } - - public Authentication getAuthentication() { - return authentication; - } - - public void setAuthentication(Authentication authentication) { - this.authentication = authentication; - } - - public Proxy getProxy() { - return proxy; - } - - public void setProxy(Proxy proxy) { - this.proxy = proxy; - } - - public boolean isUniqueVersion() { - return true; - } - - public List getMirroredRepositories() { - return mirroredRepositories; - } - - public void setMirroredRepositories(List mirroredRepositories) { - if (mirroredRepositories != null) { - this.mirroredRepositories = Collections.unmodifiableList(mirroredRepositories); - } else { - this.mirroredRepositories = Collections.emptyList(); - } - } - - public boolean isBlocked() { - return blocked; - } - - public void setBlocked(boolean blocked) { - this.blocked = blocked; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java deleted file mode 100644 index 8ddb073dfe2a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.eclipse.aether.RepositorySystemSession; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactRepositoryFactory implements ArtifactRepositoryFactory { - - @Inject - private org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory factory; - - @Inject - private LegacySupport legacySupport; - - @Inject - private PlexusContainer container; - - public ArtifactRepositoryLayout getLayout(String layoutId) throws UnknownRepositoryLayoutException { - return factory.getLayout(layoutId); - } - - public ArtifactRepository createDeploymentArtifactRepository( - String id, String url, String layoutId, boolean uniqueVersion) throws UnknownRepositoryLayoutException { - return injectSession(factory.createDeploymentArtifactRepository(id, url, layoutId, uniqueVersion), false); - } - - public ArtifactRepository createDeploymentArtifactRepository( - String id, String url, ArtifactRepositoryLayout repositoryLayout, boolean uniqueVersion) { - return injectSession( - factory.createDeploymentArtifactRepository(id, url, repositoryLayout, uniqueVersion), false); - } - - public ArtifactRepository createArtifactRepository( - String id, - String url, - String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) - throws UnknownRepositoryLayoutException { - return injectSession(factory.createArtifactRepository(id, url, layoutId, snapshots, releases), true); - } - - public ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) { - return injectSession(factory.createArtifactRepository(id, url, repositoryLayout, snapshots, releases), true); - } - - public void setGlobalUpdatePolicy(String updatePolicy) { - factory.setGlobalUpdatePolicy(updatePolicy); - } - - public void setGlobalChecksumPolicy(String checksumPolicy) { - factory.setGlobalChecksumPolicy(checksumPolicy); - } - - private ArtifactRepository injectSession(ArtifactRepository repository, boolean mirrors) { - RepositorySystemSession session = legacySupport.getRepositorySession(); - - if (session != null && repository != null && !isLocalRepository(repository)) { - List repositories = Arrays.asList(repository); - - RepositorySystem repositorySystem; - try { - repositorySystem = container.lookup(RepositorySystem.class); - } catch (ComponentLookupException e) { - throw new IllegalStateException("Unable to lookup " + RepositorySystem.class.getName()); - } - - if (mirrors) { - repositorySystem.injectMirror(session, repositories); - } - - repositorySystem.injectProxy(session, repositories); - - repositorySystem.injectAuthentication(session, repositories); - } - - return repository; - } - - private boolean isLocalRepository(ArtifactRepository repository) { - // unfortunately, the API doesn't allow to tell a remote repo and the local repo apart... - return "local".equals(repository.getId()); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java deleted file mode 100644 index 5386d44c1055..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/LegacyLocalRepositoryManager.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException; -import org.apache.maven.repository.Proxy; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.metadata.Metadata; -import org.eclipse.aether.repository.LocalArtifactRegistration; -import org.eclipse.aether.repository.LocalArtifactRequest; -import org.eclipse.aether.repository.LocalArtifactResult; -import org.eclipse.aether.repository.LocalMetadataRegistration; -import org.eclipse.aether.repository.LocalMetadataRequest; -import org.eclipse.aether.repository.LocalMetadataResult; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; - -/** - * Warning: This is an internal utility class that is only public for technical reasons, it is not part - * of the public API. In particular, this class can be changed or deleted without prior notice. - * - */ -@Deprecated -public class LegacyLocalRepositoryManager implements LocalRepositoryManager { - - private final ArtifactRepository delegate; - - private final LocalRepository repo; - - private final boolean realLocalRepo; - - public static RepositorySystemSession overlay( - ArtifactRepository repository, RepositorySystemSession session, RepositorySystem system) { - return overlay(repository, session); - } - - public static RepositorySystemSession overlay(ArtifactRepository repository, RepositorySystemSession session) { - if (repository == null || repository.getBasedir() == null) { - return session; - } - - if (session != null) { - LocalRepositoryManager lrm = session.getLocalRepositoryManager(); - if (lrm != null && lrm.getRepository().getBasedir().equals(new File(repository.getBasedir()))) { - return session; - } - } else { - session = new DefaultRepositorySystemSession(); - } - - final LocalRepositoryManager llrm = new LegacyLocalRepositoryManager(repository); - - return new DefaultRepositorySystemSession(session).setLocalRepositoryManager(llrm); - } - - private LegacyLocalRepositoryManager(ArtifactRepository delegate) { - this.delegate = Objects.requireNonNull(delegate, "delegate cannot be null"); - - ArtifactRepositoryLayout layout = delegate.getLayout(); - repo = new LocalRepository( - new File(delegate.getBasedir()), - (layout != null) ? layout.getClass().getSimpleName() : "legacy"); - - /* - * NOTE: "invoker:install" vs "appassembler:assemble": Both mojos use the artifact installer to put an artifact - * into a repository. In the first case, the result needs to be a proper local repository that one can use for - * local artifact resolution. In the second case, the result needs to precisely obey the path information of the - * repository's layout to allow pointing at artifacts within the repository. Unfortunately, - * DefaultRepositoryLayout does not correctly describe the layout of a local repository which unlike a remote - * repository never uses timestamps in the filename of a snapshot artifact. The discrepancy gets notable when a - * remotely resolved snapshot artifact gets passed into pathOf(). So producing a proper local artifact path - * using DefaultRepositoryLayout requires us to enforce usage of the artifact's base version. This - * transformation however contradicts the other use case of precisely obeying the repository's layout. The below - * flag tries to detect which use case applies to make both plugins happy. - */ - realLocalRepo = (layout instanceof DefaultRepositoryLayout) && "local".equals(delegate.getId()); - } - - public LocalRepository getRepository() { - return repo; - } - - public String getPathForLocalArtifact(Artifact artifact) { - if (realLocalRepo) { - return delegate.pathOf(RepositoryUtils.toArtifact(artifact.setVersion(artifact.getBaseVersion()))); - } - return delegate.pathOf(RepositoryUtils.toArtifact(artifact)); - } - - public String getPathForRemoteArtifact(Artifact artifact, RemoteRepository repository, String context) { - return delegate.pathOf(RepositoryUtils.toArtifact(artifact)); - } - - public String getPathForLocalMetadata(Metadata metadata) { - return delegate.pathOfLocalRepositoryMetadata(new ArtifactMetadataAdapter(metadata), delegate); - } - - public String getPathForRemoteMetadata(Metadata metadata, RemoteRepository repository, String context) { - return delegate.pathOfLocalRepositoryMetadata( - new ArtifactMetadataAdapter(metadata), new ArtifactRepositoryAdapter(repository)); - } - - public LocalArtifactResult find(RepositorySystemSession session, LocalArtifactRequest request) { - String path = getPathForLocalArtifact(request.getArtifact()); - File file = new File(getRepository().getBasedir(), path); - - LocalArtifactResult result = new LocalArtifactResult(request); - if (file.isFile()) { - result.setFile(file); - result.setAvailable(true); - } - - return result; - } - - public LocalMetadataResult find(RepositorySystemSession session, LocalMetadataRequest request) { - Metadata metadata = request.getMetadata(); - - String path; - if (request.getRepository() == null) { - path = getPathForLocalMetadata(metadata); - } else { - path = getPathForRemoteMetadata(metadata, request.getRepository(), request.getContext()); - } - - File file = new File(getRepository().getBasedir(), path); - - LocalMetadataResult result = new LocalMetadataResult(request); - if (file.isFile()) { - result.setFile(file); - } - - return result; - } - - public void add(RepositorySystemSession session, LocalArtifactRegistration request) { - // noop - } - - public void add(RepositorySystemSession session, LocalMetadataRegistration request) { - // noop - } - - static class ArtifactMetadataAdapter implements ArtifactMetadata { - - private final Metadata metadata; - - ArtifactMetadataAdapter(Metadata metadata) { - this.metadata = metadata; - } - - public boolean storedInArtifactVersionDirectory() { - return !metadata.getVersion().isEmpty(); - } - - public boolean storedInGroupDirectory() { - return metadata.getArtifactId().isEmpty(); - } - - public String getGroupId() { - return nullify(metadata.getGroupId()); - } - - public String getArtifactId() { - return nullify(metadata.getArtifactId()); - } - - public String getBaseVersion() { - return nullify(metadata.getVersion()); - } - - private String nullify(String str) { - return (str == null || str.isEmpty()) ? null : str; - } - - public Object getKey() { - return metadata.toString(); - } - - public String getRemoteFilename() { - return metadata.getType(); - } - - public String getLocalFilename(ArtifactRepository repository) { - return insertRepositoryKey(getRemoteFilename(), repository.getKey()); - } - - private String insertRepositoryKey(String filename, String repositoryKey) { - String result; - int idx = filename.indexOf('.'); - if (idx < 0) { - result = filename + '-' + repositoryKey; - } else { - result = filename.substring(0, idx) + '-' + repositoryKey + filename.substring(idx); - } - return result; - } - - public void merge(org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata) { - // not used - } - - public void merge(ArtifactMetadata metadata) { - // not used - } - - public void storeInLocalRepository(ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataStoreException { - // not used - } - - public String extendedToString() { - return metadata.toString(); - } - } - - static class ArtifactRepositoryAdapter implements ArtifactRepository { - - private final RemoteRepository repository; - - ArtifactRepositoryAdapter(RemoteRepository repository) { - this.repository = repository; - } - - public String pathOf(org.apache.maven.artifact.Artifact artifact) { - return null; - } - - public String pathOfRemoteRepositoryMetadata(ArtifactMetadata artifactMetadata) { - return null; - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return null; - } - - public String getUrl() { - return repository.getUrl(); - } - - public void setUrl(String url) {} - - public String getBasedir() { - return null; - } - - public String getProtocol() { - return repository.getProtocol(); - } - - public String getId() { - return repository.getId(); - } - - public void setId(String id) {} - - public ArtifactRepositoryPolicy getSnapshots() { - return null; - } - - public void setSnapshotUpdatePolicy(ArtifactRepositoryPolicy policy) {} - - public ArtifactRepositoryPolicy getReleases() { - return null; - } - - public void setReleaseUpdatePolicy(ArtifactRepositoryPolicy policy) {} - - public ArtifactRepositoryLayout getLayout() { - return null; - } - - public void setLayout(ArtifactRepositoryLayout layout) {} - - public String getKey() { - return getId(); - } - - public boolean isUniqueVersion() { - return true; - } - - public boolean isBlacklisted() { - return false; - } - - public void setBlacklisted(boolean blackListed) {} - - public org.apache.maven.artifact.Artifact find(org.apache.maven.artifact.Artifact artifact) { - return null; - } - - public List findVersions(org.apache.maven.artifact.Artifact artifact) { - return Collections.emptyList(); - } - - public boolean isProjectAware() { - return false; - } - - public void setAuthentication(Authentication authentication) {} - - public Authentication getAuthentication() { - return null; - } - - public void setProxy(Proxy proxy) {} - - public Proxy getProxy() { - return null; - } - - public List getMirroredRepositories() { - return Collections.emptyList(); - } - - public void setMirroredRepositories(List mirroredRepositories) {} - - public boolean isBlocked() { - return false; - } - - public void setBlocked(boolean blocked) {} - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java deleted file mode 100644 index 509624b4fe33..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.layout; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * FlatRepositoryLayout - */ -@Named("flat") -@Singleton -@Deprecated -public class FlatRepositoryLayout implements ArtifactRepositoryLayout { - - private static final char ARTIFACT_SEPARATOR = '-'; - - private static final char GROUP_SEPARATOR = '.'; - - public String getId() { - return "flat"; - } - - public String pathOf(Artifact artifact) { - ArtifactHandler artifactHandler = artifact.getArtifactHandler(); - - StringBuilder path = new StringBuilder(128); - - path.append(artifact.getArtifactId()).append(ARTIFACT_SEPARATOR).append(artifact.getVersion()); - - if (artifact.hasClassifier()) { - path.append(ARTIFACT_SEPARATOR).append(artifact.getClassifier()); - } - - if (artifactHandler.getExtension() != null - && !artifactHandler.getExtension().isEmpty()) { - path.append(GROUP_SEPARATOR).append(artifactHandler.getExtension()); - } - - return path.toString(); - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return pathOfRepositoryMetadata(metadata.getLocalFilename(repository)); - } - - private String pathOfRepositoryMetadata(String filename) { - StringBuilder path = new StringBuilder(128); - - path.append(filename); - - return path.toString(); - } - - public String pathOfRemoteRepositoryMetadata(ArtifactMetadata metadata) { - return pathOfRepositoryMetadata(metadata.getRemoteFilename()); - } - - @Override - public String toString() { - return getId(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java deleted file mode 100644 index 0d278f7cb46d..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import javax.xml.stream.XMLStreamException; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.metadata.v4.MetadataStaxReader; -import org.apache.maven.metadata.v4.MetadataStaxWriter; - -/** - * Shared methods of the repository metadata handling. - * - */ -@Deprecated -public abstract class AbstractRepositoryMetadata implements RepositoryMetadata { - private static final String LS = System.lineSeparator(); - - private Metadata metadata; - - protected AbstractRepositoryMetadata(Metadata metadata) { - this.metadata = metadata; - } - - public String getRemoteFilename() { - return "maven-metadata.xml"; - } - - public String getLocalFilename(ArtifactRepository repository) { - return "maven-metadata-" + repository.getKey() + ".xml"; - } - - public void storeInLocalRepository(ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataStoreException { - try { - updateRepositoryMetadata(localRepository, remoteRepository); - } catch (IOException | XMLStreamException e) { - throw new RepositoryMetadataStoreException("Error updating group repository metadata", e); - } - } - - protected void updateRepositoryMetadata(ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws IOException, XMLStreamException { - Metadata metadata = null; - - File metadataFile = new File( - localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata(this, remoteRepository)); - - if (metadataFile.length() == 0) { - if (!metadataFile.delete()) { - // sleep for 10ms just in case this is windows holding a file lock - try { - Thread.sleep(10); - } catch (InterruptedException e) { - // ignore - } - metadataFile.delete(); // if this fails, forget about it, we'll try to overwrite it anyway so no need - // to delete on exit - } - } else if (metadataFile.exists()) { - try (InputStream input = Files.newInputStream(metadataFile.toPath())) { - metadata = new Metadata(new MetadataStaxReader().read(input, false)); - } - } - - boolean changed; - - // If file could not be found or was not valid, start from scratch - if (metadata == null) { - metadata = this.metadata; - - changed = true; - } else { - changed = metadata.merge(this.metadata); - } - - // beware meta-versions! - String version = metadata.getVersion(); - if (Artifact.LATEST_VERSION.equals(version) || Artifact.RELEASE_VERSION.equals(version)) { - // meta-versions are not valid values...don't write them. - metadata.setVersion(null); - } - - if (changed || !metadataFile.exists()) { - metadataFile.getParentFile().mkdirs(); - try (OutputStream output = Files.newOutputStream(metadataFile.toPath())) { - MetadataStaxWriter mappingWriter = new MetadataStaxWriter(); - mappingWriter.write(output, metadata.getDelegate()); - } - } else { - metadataFile.setLastModified(System.currentTimeMillis()); - } - } - - public String toString() { - return "repository metadata for: '" + getKey() + "'"; - } - - protected static Metadata createMetadata(Artifact artifact, Versioning versioning) { - Metadata metadata = new Metadata(); - metadata.setGroupId(artifact.getGroupId()); - metadata.setArtifactId(artifact.getArtifactId()); - metadata.setVersion(artifact.getVersion()); - metadata.setVersioning(versioning); - return metadata; - } - - protected static Versioning createVersioning(Snapshot snapshot) { - Versioning versioning = new Versioning(); - versioning.setSnapshot(snapshot); - return versioning; - } - - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - public Metadata getMetadata() { - return metadata; - } - - public void merge(org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata) { - // TODO not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact - // replaces? - AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata; - this.metadata.merge(repoMetadata.getMetadata()); - } - - public void merge(ArtifactMetadata metadata) { - // TODO not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact - // replaces? - AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata; - this.metadata.merge(repoMetadata.getMetadata()); - } - - public String extendedToString() { - StringBuilder buffer = new StringBuilder(256); - - buffer.append(LS).append("Repository Metadata").append(LS).append("--------------------------"); - buffer.append(LS).append("GroupId: ").append(getGroupId()); - buffer.append(LS).append("ArtifactId: ").append(getArtifactId()); - buffer.append(LS).append("Metadata Type: ").append(getClass().getName()); - - return buffer.toString(); - } - - public int getNature() { - return RELEASE; - } - - public ArtifactRepositoryPolicy getPolicy(ArtifactRepository repository) { - int nature = getNature(); - if ((nature & RepositoryMetadata.RELEASE_OR_SNAPSHOT) == RepositoryMetadata.RELEASE_OR_SNAPSHOT) { - ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy(repository.getReleases()); - policy.merge(repository.getSnapshots()); - return policy; - } else if ((nature & RepositoryMetadata.SNAPSHOT) != 0) { - return repository.getSnapshots(); - } else { - return repository.getReleases(); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java deleted file mode 100644 index 3038cc1eb629..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/ArtifactRepositoryMetadata.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.Restriction; -import org.apache.maven.artifact.versioning.VersionRange; - -/** - * Metadata for the artifact directory of the repository. - * - */ -@Deprecated -public class ArtifactRepositoryMetadata extends AbstractRepositoryMetadata { - private Artifact artifact; - - public ArtifactRepositoryMetadata(Artifact artifact) { - this(artifact, null); - } - - public ArtifactRepositoryMetadata(Artifact artifact, Versioning versioning) { - super(createMetadata(artifact, versioning)); - this.artifact = artifact; - } - - public boolean storedInGroupDirectory() { - return false; - } - - public boolean storedInArtifactVersionDirectory() { - return false; - } - - public String getGroupId() { - return artifact.getGroupId(); - } - - public String getArtifactId() { - return artifact.getArtifactId(); - } - - public String getBaseVersion() { - // Don't want the artifact's version in here, as this is stored in the directory above that - return null; - } - - public Object getKey() { - return "artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId(); - } - - public boolean isSnapshot() { - // Don't consider the artifact's version in here, as this is stored in the directory above that - return false; - } - - public int getNature() { - if (artifact.getVersion() != null) { - return artifact.isSnapshot() ? SNAPSHOT : RELEASE; - } - - VersionRange range = artifact.getVersionRange(); - if (range != null) { - for (Restriction restriction : range.getRestrictions()) { - if (isSnapshot(restriction.getLowerBound()) || isSnapshot(restriction.getUpperBound())) { - return RELEASE_OR_SNAPSHOT; - } - } - } - - return RELEASE; - } - - private boolean isSnapshot(ArtifactVersion version) { - return version != null && ArtifactUtils.isSnapshot(version.getQualifier()); - } - - public ArtifactRepository getRepository() { - return null; - } - - public void setRepository(ArtifactRepository remoteRepository) { - /* - * NOTE: Metadata at the g:a level contains a collection of available versions. After merging, we can't tell - * which repository provides which version so the metadata manager must not restrict the artifact resolution to - * the repository with the most recent updates. - */ - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java deleted file mode 100644 index 21bee42ff939..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; -import javax.xml.stream.XMLStreamException; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.DefaultRepositoryRequest; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.metadata.v4.MetadataStaxReader; -import org.apache.maven.metadata.v4.MetadataStaxWriter; -import org.apache.maven.repository.legacy.UpdateCheckManager; -import org.apache.maven.repository.legacy.WagonManager; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.codehaus.plexus.logging.AbstractLogEnabled; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultRepositoryMetadataManager extends AbstractLogEnabled implements RepositoryMetadataManager { - @Inject - private WagonManager wagonManager; - - @Inject - private UpdateCheckManager updateCheckManager; - - public void resolve( - RepositoryMetadata metadata, - List remoteRepositories, - ArtifactRepository localRepository) - throws RepositoryMetadataResolutionException { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - resolve(metadata, request); - } - - public void resolve(RepositoryMetadata metadata, RepositoryRequest request) - throws RepositoryMetadataResolutionException { - ArtifactRepository localRepo = request.getLocalRepository(); - List remoteRepositories = request.getRemoteRepositories(); - - if (!request.isOffline()) { - Date localCopyLastModified = null; - if (metadata.getBaseVersion() != null) { - localCopyLastModified = getLocalCopyLastModified(localRepo, metadata); - } - - for (ArtifactRepository repository : remoteRepositories) { - ArtifactRepositoryPolicy policy = metadata.getPolicy(repository); - - File file = - new File(localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata(metadata, repository)); - boolean update; - - if (!policy.isEnabled()) { - update = false; - - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Skipping update check for " + metadata.getKey() + " (" + file - + ") from disabled repository " + repository.getId() + " (" - + repository.getUrl() + ")"); - } - } else if (request.isForceUpdate()) { - update = true; - } else if (localCopyLastModified != null && !policy.checkOutOfDate(localCopyLastModified)) { - update = false; - - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Skipping update check for " + metadata.getKey() + " (" + file - + ") from repository " + repository.getId() + " (" + repository.getUrl() - + ") in favor of local copy"); - } - } else { - update = updateCheckManager.isUpdateRequired(metadata, repository, file); - } - - if (update) { - getLogger().info(metadata.getKey() + ": checking for updates from " + repository.getId()); - try { - wagonManager.getArtifactMetadata(metadata, repository, file, policy.getChecksumPolicy()); - } catch (ResourceDoesNotExistException e) { - getLogger().debug(metadata + " could not be found on repository: " + repository.getId()); - - // delete the local copy so the old details aren't used. - if (file.exists()) { - if (!file.delete()) { - // sleep for 10ms just in case this is windows holding a file lock - try { - Thread.sleep(10); - } catch (InterruptedException ie) { - // ignore - } - file.delete(); // if this fails, forget about it - } - } - } catch (TransferFailedException e) { - getLogger() - .warn(metadata + " could not be retrieved from repository: " + repository.getId() - + " due to an error: " + e.getMessage()); - getLogger().debug("Exception", e); - } finally { - updateCheckManager.touch(metadata, repository, file); - } - } - - // TODO should this be inside the above check? - // touch file so that this is not checked again until interval has passed - if (file.exists()) { - file.setLastModified(System.currentTimeMillis()); - } - } - } - - try { - mergeMetadata(metadata, remoteRepositories, localRepo); - } catch (RepositoryMetadataStoreException e) { - throw new RepositoryMetadataResolutionException( - "Unable to store local copy of metadata: " + e.getMessage(), e); - } - } - - private Date getLocalCopyLastModified(ArtifactRepository localRepository, RepositoryMetadata metadata) { - String metadataPath = localRepository.pathOfLocalRepositoryMetadata(metadata, localRepository); - File metadataFile = new File(localRepository.getBasedir(), metadataPath); - return metadataFile.isFile() ? new Date(metadataFile.lastModified()) : null; - } - - private void mergeMetadata( - RepositoryMetadata metadata, - List remoteRepositories, - ArtifactRepository localRepository) - throws RepositoryMetadataStoreException { - // TODO currently this is first wins, but really we should take the latest by comparing either the - // snapshot timestamp, or some other timestamp later encoded into the metadata. - // TODO this needs to be repeated here so the merging doesn't interfere with the written metadata - // - we'd be much better having a pristine input, and an ongoing metadata for merging instead - - Map previousMetadata = new HashMap<>(); - ArtifactRepository selected = null; - for (ArtifactRepository repository : remoteRepositories) { - ArtifactRepositoryPolicy policy = metadata.getPolicy(repository); - - if (policy.isEnabled() && loadMetadata(metadata, repository, localRepository, previousMetadata)) { - metadata.setRepository(repository); - selected = repository; - } - } - if (loadMetadata(metadata, localRepository, localRepository, previousMetadata)) { - metadata.setRepository(null); - selected = localRepository; - } - - updateSnapshotMetadata(metadata, previousMetadata, selected, localRepository); - } - - private void updateSnapshotMetadata( - RepositoryMetadata metadata, - Map previousMetadata, - ArtifactRepository selected, - ArtifactRepository localRepository) - throws RepositoryMetadataStoreException { - // TODO this could be a lot nicer... should really be in the snapshot transformation? - if (metadata.isSnapshot()) { - Metadata prevMetadata = metadata.getMetadata(); - - for (ArtifactRepository repository : previousMetadata.keySet()) { - Metadata m = previousMetadata.get(repository); - if (repository.equals(selected)) { - if (m.getVersioning() == null) { - m.setVersioning(new Versioning()); - } - - if (m.getVersioning().getSnapshot() == null) { - m.getVersioning().setSnapshot(new Snapshot()); - } - } else { - if ((m.getVersioning() != null) - && (m.getVersioning().getSnapshot() != null) - && m.getVersioning().getSnapshot().isLocalCopy()) { - m.getVersioning().getSnapshot().setLocalCopy(false); - metadata.setMetadata(m); - metadata.storeInLocalRepository(localRepository, repository); - } - } - } - - metadata.setMetadata(prevMetadata); - } - } - - private boolean loadMetadata( - RepositoryMetadata repoMetadata, - ArtifactRepository remoteRepository, - ArtifactRepository localRepository, - Map previousMetadata) { - boolean setRepository = false; - - File metadataFile = new File( - localRepository.getBasedir(), - localRepository.pathOfLocalRepositoryMetadata(repoMetadata, remoteRepository)); - - if (metadataFile.exists()) { - Metadata metadata; - - try { - metadata = readMetadata(metadataFile); - } catch (RepositoryMetadataReadException e) { - if (getLogger().isDebugEnabled()) { - getLogger().warn(e.getMessage(), e); - } else { - getLogger().warn(e.getMessage()); - } - return setRepository; - } - - if (repoMetadata.isSnapshot() && (previousMetadata != null)) { - previousMetadata.put(remoteRepository, metadata); - } - - if (repoMetadata.getMetadata() != null) { - setRepository = repoMetadata.getMetadata().merge(metadata); - } else { - repoMetadata.setMetadata(metadata); - setRepository = true; - } - } - return setRepository; - } - - /* - * TODO share with DefaultPluginMappingManager. - */ - protected Metadata readMetadata(File mappingFile) throws RepositoryMetadataReadException { - - try (InputStream in = Files.newInputStream(mappingFile.toPath())) { - return new Metadata(new MetadataStaxReader().read(in, false)); - } catch (FileNotFoundException e) { - throw new RepositoryMetadataReadException("Cannot read metadata from '" + mappingFile + "'", e); - } catch (IOException | XMLStreamException e) { - throw new RepositoryMetadataReadException( - "Cannot read metadata from '" + mappingFile + "': " + e.getMessage(), e); - } - } - - /** - * Ensures the last updated timestamp of the specified metadata does not refer to the future and fixes the local - * metadata if necessary to allow proper merging/updating of metadata during deployment. - */ - private void fixTimestamp(File metadataFile, Metadata metadata, Metadata reference) { - boolean changed = false; - - if (metadata != null && reference != null) { - Versioning versioning = metadata.getVersioning(); - Versioning versioningRef = reference.getVersioning(); - if (versioning != null && versioningRef != null) { - String lastUpdated = versioning.getLastUpdated(); - String now = versioningRef.getLastUpdated(); - if (lastUpdated != null && now != null && now.compareTo(lastUpdated) < 0) { - getLogger() - .warn("The last updated timestamp in " + metadataFile + " refers to the future (now = " - + now - + ", lastUpdated = " + lastUpdated + "). Please verify that the clocks of all" - + " deploying machines are reasonably synchronized."); - versioning.setLastUpdated(now); - changed = true; - } - } - } - - if (changed) { - getLogger().debug("Repairing metadata in " + metadataFile); - - try (OutputStream out = Files.newOutputStream(metadataFile.toPath())) { - new MetadataStaxWriter().write(out, metadata.getDelegate()); - } catch (IOException | XMLStreamException e) { - String msg = "Could not write fixed metadata to " + metadataFile + ": " + e.getMessage(); - if (getLogger().isDebugEnabled()) { - getLogger().warn(msg, e); - } else { - getLogger().warn(msg); - } - } - } - } - - public void resolveAlways( - RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataResolutionException { - File file; - try { - file = getArtifactMetadataFromDeploymentRepository(metadata, localRepository, remoteRepository); - } catch (TransferFailedException e) { - throw new RepositoryMetadataResolutionException( - metadata + " could not be retrieved from repository: " + remoteRepository.getId() - + " due to an error: " + e.getMessage(), - e); - } - - try { - if (file.exists()) { - Metadata prevMetadata = readMetadata(file); - metadata.setMetadata(prevMetadata); - } - } catch (RepositoryMetadataReadException e) { - throw new RepositoryMetadataResolutionException(e.getMessage(), e); - } - } - - private File getArtifactMetadataFromDeploymentRepository( - ArtifactMetadata metadata, ArtifactRepository localRepo, ArtifactRepository remoteRepository) - throws TransferFailedException { - File file = - new File(localRepo.getBasedir(), localRepo.pathOfLocalRepositoryMetadata(metadata, remoteRepository)); - - try { - wagonManager.getArtifactMetadataFromDeploymentRepository( - metadata, remoteRepository, file, ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN); - } catch (ResourceDoesNotExistException e) { - getLogger() - .info(metadata + " could not be found on repository: " + remoteRepository.getId() - + ", so will be created"); - - // delete the local copy so the old details aren't used. - if (file.exists()) { - if (!file.delete()) { - // sleep for 10ms just in case this is windows holding a file lock - try { - Thread.sleep(10); - } catch (InterruptedException ie) { - // ignore - } - file.delete(); // if this fails, forget about it - } - } - } finally { - if (metadata instanceof RepositoryMetadata) { - updateCheckManager.touch((RepositoryMetadata) metadata, remoteRepository, file); - } - } - return file; - } - - public void deploy( - ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository) - throws RepositoryMetadataDeploymentException { - File file; - if (metadata instanceof RepositoryMetadata) { - getLogger().info("Retrieving previous metadata from " + deploymentRepository.getId()); - try { - file = getArtifactMetadataFromDeploymentRepository(metadata, localRepository, deploymentRepository); - } catch (TransferFailedException e) { - throw new RepositoryMetadataDeploymentException( - metadata + " could not be retrieved from repository: " + deploymentRepository.getId() - + " due to an error: " + e.getMessage(), - e); - } - - if (file.isFile()) { - try { - fixTimestamp(file, readMetadata(file), ((RepositoryMetadata) metadata).getMetadata()); - } catch (RepositoryMetadataReadException e) { - // will be reported via storeInlocalRepository - } - } - } else { - // It's a POM - we don't need to retrieve it first - file = new File( - localRepository.getBasedir(), - localRepository.pathOfLocalRepositoryMetadata(metadata, deploymentRepository)); - } - - try { - metadata.storeInLocalRepository(localRepository, deploymentRepository); - } catch (RepositoryMetadataStoreException e) { - throw new RepositoryMetadataDeploymentException("Error installing metadata: " + e.getMessage(), e); - } - - try { - wagonManager.putArtifactMetadata(file, metadata, deploymentRepository); - } catch (TransferFailedException e) { - throw new RepositoryMetadataDeploymentException("Error while deploying metadata: " + e.getMessage(), e); - } - } - - public void install(ArtifactMetadata metadata, ArtifactRepository localRepository) - throws RepositoryMetadataInstallationException { - try { - metadata.storeInLocalRepository(localRepository, localRepository); - } catch (RepositoryMetadataStoreException e) { - throw new RepositoryMetadataInstallationException("Error installing metadata: " + e.getMessage(), e); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java deleted file mode 100644 index a7c4515c6b99..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import java.util.Iterator; -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * Metadata for the group directory of the repository. - * - */ -@Deprecated -public class GroupRepositoryMetadata extends AbstractRepositoryMetadata { - private final String groupId; - - public GroupRepositoryMetadata(String groupId) { - super(new Metadata()); - this.groupId = groupId; - } - - public boolean storedInGroupDirectory() { - return true; - } - - public boolean storedInArtifactVersionDirectory() { - return false; - } - - public String getGroupId() { - return groupId; - } - - public String getArtifactId() { - return null; - } - - public String getBaseVersion() { - return null; - } - - public void addPluginMapping(String goalPrefix, String artifactId) { - addPluginMapping(goalPrefix, artifactId, artifactId); - } - - public void addPluginMapping(String goalPrefix, String artifactId, String name) { - List plugins = getMetadata().getPlugins(); - boolean found = false; - for (Iterator i = plugins.iterator(); i.hasNext() && !found; ) { - Plugin plugin = i.next(); - if (plugin.getPrefix().equals(goalPrefix)) { - found = true; - } - } - if (!found) { - Plugin plugin = new Plugin(); - plugin.setPrefix(goalPrefix); - plugin.setArtifactId(artifactId); - plugin.setName(name); - - getMetadata().addPlugin(plugin); - } - } - - public Object getKey() { - return groupId; - } - - public boolean isSnapshot() { - return false; - } - - public ArtifactRepository getRepository() { - return null; - } - - public void setRepository(ArtifactRepository remoteRepository) { - // intentionally blank - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java deleted file mode 100644 index 5199cc205188..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; -import java.util.Map; - -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.eclipse.aether.RepositoryException; -import org.eclipse.aether.metadata.AbstractMetadata; -import org.eclipse.aether.metadata.MergeableMetadata; -import org.eclipse.aether.metadata.Metadata; - -/** - * Warning: This is an internal utility class that is only public for technical reasons, it is not part - * of the public API. In particular, this class can be changed or deleted without prior notice. - * - */ -@Deprecated -public final class MetadataBridge extends AbstractMetadata implements MergeableMetadata { - - private ArtifactMetadata metadata; - - private boolean merged; - - public MetadataBridge(ArtifactMetadata metadata) { - this.metadata = metadata; - } - - public void merge(File current, File result) throws RepositoryException { - try { - if (current.exists()) { - Files.createDirectories(result.toPath().getParent()); - Files.copy(current.toPath(), result.toPath()); - } - ArtifactRepository localRepo = new MetadataRepository(result); - metadata.storeInLocalRepository(localRepo, localRepo); - merged = true; - } catch (Exception e) { - throw new RepositoryException(e.getMessage(), e); - } - } - - public boolean isMerged() { - return merged; - } - - public String getGroupId() { - return emptify(metadata.getGroupId()); - } - - public String getArtifactId() { - return metadata.storedInGroupDirectory() ? "" : emptify(metadata.getArtifactId()); - } - - public String getVersion() { - return metadata.storedInArtifactVersionDirectory() ? emptify(metadata.getBaseVersion()) : ""; - } - - public String getType() { - return metadata.getRemoteFilename(); - } - - private String emptify(String string) { - return (string != null) ? string : ""; - } - - public File getFile() { - return null; - } - - public MetadataBridge setFile(File file) { - return this; - } - - @Override - public Path getPath() { - return null; - } - - public Nature getNature() { - if (metadata instanceof RepositoryMetadata) { - switch (((RepositoryMetadata) metadata).getNature()) { - case RepositoryMetadata.RELEASE_OR_SNAPSHOT: - return Nature.RELEASE_OR_SNAPSHOT; - case RepositoryMetadata.SNAPSHOT: - return Nature.SNAPSHOT; - default: - return Nature.RELEASE; - } - } else { - return Nature.RELEASE; - } - } - - public Map getProperties() { - return Collections.emptyMap(); - } - - @Override - public Metadata setProperties(Map properties) { - return this; - } - - @SuppressWarnings("deprecation") - static class MetadataRepository extends DefaultArtifactRepository { - - private File metadataFile; - - MetadataRepository(File metadataFile) { - super("local", "", null); - this.metadataFile = metadataFile; - } - - @Override - public String getBasedir() { - return metadataFile.getParent(); - } - - @Override - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return metadataFile.getName(); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java deleted file mode 100644 index 1ef6090012cc..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -/** - * Assists in handling repository metadata. - * - */ -@Deprecated -class MetadataUtils { - - public static Metadata cloneMetadata(Metadata src) { - if (src == null) { - return null; - } - return src.clone(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java deleted file mode 100644 index 078ce1175a78..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadata.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; - -/** - * Describes repository directory metadata. - * - * TODO not happy about the store method - they use "this" - */ -@Deprecated -public interface RepositoryMetadata extends org.apache.maven.artifact.metadata.ArtifactMetadata { - - int RELEASE = 1; - - int SNAPSHOT = 2; - - int RELEASE_OR_SNAPSHOT = RELEASE | SNAPSHOT; - - /** - * Get the repository the metadata was located in. - * - * @return the repository - */ - ArtifactRepository getRepository(); - - /** - * Set the repository the metadata was located in. - * - * @param remoteRepository the repository - */ - void setRepository(ArtifactRepository remoteRepository); - - /** - * Get the repository metadata associated with this marker. - * - * @return the metadata, or null if none loaded - */ - Metadata getMetadata(); - - /** - * Set the metadata contents. - * - * @param metadata the metadata - */ - void setMetadata(Metadata metadata); - - /** - * Whether this represents a snapshot. - * - * @return if it is a snapshot - */ - boolean isSnapshot(); - - /** - * Gets the artifact quality this metadata refers to. One of {@link #RELEASE}, {@link #SNAPSHOT} or - * {@link #RELEASE_OR_SNAPSHOT}. - * - * @return The artifact quality this metadata refers to. - */ - int getNature(); - - /** - * Gets the policy that applies to this metadata regarding the specified repository. - * - * @param repository The repository for which to determine the policy, must not be {@code null}. - * @return The policy, never {@code null}. - */ - ArtifactRepositoryPolicy getPolicy(ArtifactRepository repository); -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java deleted file mode 100644 index 8e374e9a6411..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataDeploymentException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -/** - * Error while deploying repository metadata. - * - */ -@Deprecated -public class RepositoryMetadataDeploymentException extends Throwable { - public RepositoryMetadataDeploymentException(String message) { - super(message); - } - - public RepositoryMetadataDeploymentException(String message, Exception e) { - super(message, e); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java deleted file mode 100644 index 314b89ba1caf..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataInstallationException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -/** - * Error while installing repository metadata. - * - */ -@Deprecated -public class RepositoryMetadataInstallationException extends Throwable { - public RepositoryMetadataInstallationException(String message) { - super(message); - } - - public RepositoryMetadataInstallationException(String message, Exception e) { - super(message, e); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java deleted file mode 100644 index b92eddcd561a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataManager.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import java.util.List; - -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; - -/** - * RepositoryMetadataManager - */ -@Deprecated -public interface RepositoryMetadataManager { - - void resolve(RepositoryMetadata repositoryMetadata, RepositoryRequest repositoryRequest) - throws RepositoryMetadataResolutionException; - - void resolve( - RepositoryMetadata repositoryMetadata, - List repositories, - ArtifactRepository localRepository) - throws RepositoryMetadataResolutionException; - - void resolveAlways( - RepositoryMetadata metadata, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataResolutionException; - - /** - * Deploy metadata to the remote repository. - * - * @param metadata the metadata to deploy - * @param localRepository the local repository to install to first - * @param deploymentRepository the remote repository to deploy to - * @throws RepositoryMetadataDeploymentException in case of metadata deployment issue - */ - void deploy(ArtifactMetadata metadata, ArtifactRepository localRepository, ArtifactRepository deploymentRepository) - throws RepositoryMetadataDeploymentException; - - /** - * Install the metadata in the local repository. - * - * @param metadata the metadata - * @param localRepository the local repository - * @throws RepositoryMetadataInstallationException in case of metadata installation issue - */ - void install(ArtifactMetadata metadata, ArtifactRepository localRepository) - throws RepositoryMetadataInstallationException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java deleted file mode 100644 index 8b588fb5d5e5..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -/** - * Problem storing the repository metadata in the local repository. - * - */ -@Deprecated -public class RepositoryMetadataReadException extends Exception { - public RepositoryMetadataReadException(String message) { - super(message); - } - - public RepositoryMetadataReadException(String message, Exception e) { - super(message, e); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java deleted file mode 100644 index 50782b33170e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataResolutionException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -/** - * Error while retrieving repository metadata from the repository. - * - */ -@Deprecated -public class RepositoryMetadataResolutionException extends Exception { - public RepositoryMetadataResolutionException(String message) { - super(message); - } - - public RepositoryMetadataResolutionException(String message, Exception e) { - super(message, e); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java b/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java deleted file mode 100644 index ca1c1696f149..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository.metadata; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * Metadata for the artifact version directory of the repository. - * - * TODO split instantiation (versioning, plugin mappings) from definition - */ -@Deprecated -public class SnapshotArtifactRepositoryMetadata extends AbstractRepositoryMetadata { - private Artifact artifact; - - public SnapshotArtifactRepositoryMetadata(Artifact artifact) { - super(createMetadata(artifact, null)); - this.artifact = artifact; - } - - public SnapshotArtifactRepositoryMetadata(Artifact artifact, Snapshot snapshot) { - super(createMetadata(artifact, createVersioning(snapshot))); - this.artifact = artifact; - } - - public boolean storedInGroupDirectory() { - return false; - } - - public boolean storedInArtifactVersionDirectory() { - return true; - } - - public String getGroupId() { - return artifact.getGroupId(); - } - - public String getArtifactId() { - return artifact.getArtifactId(); - } - - public String getBaseVersion() { - return artifact.getBaseVersion(); - } - - public Object getKey() { - return "snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion(); - } - - public boolean isSnapshot() { - return artifact.isSnapshot(); - } - - public int getNature() { - return isSnapshot() ? SNAPSHOT : RELEASE; - } - - public ArtifactRepository getRepository() { - return artifact.getRepository(); - } - - public void setRepository(ArtifactRepository remoteRepository) { - artifact.setRepository(remoteRepository); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java deleted file mode 100644 index 7ce05c5e1c79..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; - -/** - * Artifact collector - takes a set of original artifacts and resolves all of the best versions to use - * along with their metadata. No artifacts are downloaded. - */ -@Deprecated -public interface ArtifactCollector extends org.apache.maven.repository.legacy.resolver.LegacyArtifactCollector { - - @Deprecated - ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners) - throws ArtifactResolutionException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java deleted file mode 100644 index 6bd018e7a526..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionRequest.java +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryCache; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; - -/** - * A resolution request allows you to either use an existing MavenProject, or a coordinate (gid:aid:version) - * to process a POMs dependencies. - * - */ -@Deprecated -public class ArtifactResolutionRequest implements RepositoryRequest { - private static final String LS = System.lineSeparator(); - - private Artifact artifact; - - // Needs to go away - // These are really overrides now, projects defining dependencies for a plugin that override what is - // specified in the plugin itself. - private Set artifactDependencies; - - private ArtifactRepository localRepository; - - private List remoteRepositories; - - private ArtifactFilter collectionFilter; - - private ArtifactFilter resolutionFilter; - - // Needs to go away - private List listeners = new ArrayList<>(); - - // This is like a filter but overrides all transitive versions - private Map managedVersionMap; - - private boolean resolveRoot = true; - - private boolean resolveTransitively = false; - - private boolean offline; - - private boolean forceUpdate; - - private List servers; - - private List mirrors; - - private List proxies; - - public ArtifactResolutionRequest() { - // nothing here - } - - public ArtifactResolutionRequest(RepositoryRequest request) { - setLocalRepository(request.getLocalRepository()); - setRemoteRepositories(request.getRemoteRepositories()); - setOffline(request.isOffline()); - setForceUpdate(request.isForceUpdate()); - } - - public Artifact getArtifact() { - return artifact; - } - - public ArtifactResolutionRequest setArtifact(Artifact artifact) { - this.artifact = artifact; - - return this; - } - - public ArtifactResolutionRequest setArtifactDependencies(Set artifactDependencies) { - this.artifactDependencies = artifactDependencies; - - return this; - } - - public Set getArtifactDependencies() { - return artifactDependencies; - } - - public ArtifactRepository getLocalRepository() { - return localRepository; - } - - public ArtifactResolutionRequest setLocalRepository(ArtifactRepository localRepository) { - this.localRepository = localRepository; - - return this; - } - - public List getRemoteRepositories() { - return remoteRepositories; - } - - public ArtifactResolutionRequest setRemoteRepositories(List remoteRepositories) { - this.remoteRepositories = remoteRepositories; - - return this; - } - - /** - * Gets the artifact filter that controls traversal of the dependency graph. - * - * @return The filter used to determine which of the artifacts in the dependency graph should be traversed or - * {@code null} to collect all transitive dependencies. - */ - public ArtifactFilter getCollectionFilter() { - return collectionFilter; - } - - public ArtifactResolutionRequest setCollectionFilter(ArtifactFilter filter) { - this.collectionFilter = filter; - - return this; - } - - /** - * Gets the artifact filter that controls downloading of artifact files. This filter operates on those artifacts - * that have been included by the {@link #getCollectionFilter()}. - * - * @return The filter used to determine which of the artifacts should have their files resolved or {@code null} to - * resolve the files for all collected artifacts. - */ - public ArtifactFilter getResolutionFilter() { - return resolutionFilter; - } - - public ArtifactResolutionRequest setResolutionFilter(ArtifactFilter filter) { - this.resolutionFilter = filter; - - return this; - } - - public List getListeners() { - return listeners; - } - - public ArtifactResolutionRequest setListeners(List listeners) { - this.listeners = listeners; - - return this; - } - - public ArtifactResolutionRequest addListener(ResolutionListener listener) { - listeners.add(listener); - - return this; - } - - public Map getManagedVersionMap() { - return managedVersionMap; - } - - public ArtifactResolutionRequest setManagedVersionMap(Map managedVersionMap) { - this.managedVersionMap = managedVersionMap; - - return this; - } - - public ArtifactResolutionRequest setResolveRoot(boolean resolveRoot) { - this.resolveRoot = resolveRoot; - - return this; - } - - public boolean isResolveRoot() { - return resolveRoot; - } - - public ArtifactResolutionRequest setResolveTransitively(boolean resolveDependencies) { - this.resolveTransitively = resolveDependencies; - - return this; - } - - public boolean isResolveTransitively() { - return resolveTransitively; - } - - public String toString() { - StringBuilder sb = new StringBuilder() - .append("REQUEST: ") - .append(LS) - .append("artifact: ") - .append(artifact) - .append(LS) - .append(artifactDependencies) - .append(LS) - .append("localRepository: ") - .append(localRepository) - .append(LS) - .append("remoteRepositories: ") - .append(remoteRepositories); - - return sb.toString(); - } - - public boolean isOffline() { - return offline; - } - - public ArtifactResolutionRequest setOffline(boolean offline) { - this.offline = offline; - - return this; - } - - public boolean isForceUpdate() { - return forceUpdate; - } - - public ArtifactResolutionRequest setForceUpdate(boolean forceUpdate) { - this.forceUpdate = forceUpdate; - - return this; - } - - public ArtifactResolutionRequest setServers(List servers) { - this.servers = servers; - - return this; - } - - public List getServers() { - if (servers == null) { - servers = new ArrayList<>(); - } - - return servers; - } - - public ArtifactResolutionRequest setMirrors(List mirrors) { - this.mirrors = mirrors; - - return this; - } - - public List getMirrors() { - if (mirrors == null) { - mirrors = new ArrayList<>(); - } - - return mirrors; - } - - public ArtifactResolutionRequest setProxies(List proxies) { - this.proxies = proxies; - - return this; - } - - public List getProxies() { - if (proxies == null) { - proxies = new ArrayList<>(); - } - - return proxies; - } - - // - // Used by Tycho and will break users and force them to upgrade to Maven 3.1 so we should really leave - // this here, possibly indefinitely. - // - public ArtifactResolutionRequest setCache(RepositoryCache cache) { - return this; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java deleted file mode 100644 index c530287001c3..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolutionResult.java +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * Specific problems during resolution that we want to account for: - *
    - *
  • missing metadata
  • - *
  • version range violations
  • - *
  • version circular dependencies
  • - *
  • missing artifacts
  • - *
  • network/transfer errors
  • - *
  • file system errors: permissions
  • - *
- * - * TODO carlos: all these possible has*Exceptions and get*Exceptions methods make the clients too - * complex requiring a long list of checks, need to create a parent/interface/encapsulation - * for the types of exceptions - */ -@Deprecated -public class ArtifactResolutionResult { - private static final String LS = System.lineSeparator(); - - private Artifact originatingArtifact; - - private List missingArtifacts; - - // Exceptions - - private List exceptions; - - private List versionRangeViolations; - - private List metadataResolutionExceptions; - - private List circularDependencyExceptions; - - private List errorArtifactExceptions; - - // file system errors - - private List repositories; - - private Set artifacts; - - private Set resolutionNodes; - - public Artifact getOriginatingArtifact() { - return originatingArtifact; - } - - public ArtifactResolutionResult setOriginatingArtifact(final Artifact originatingArtifact) { - this.originatingArtifact = originatingArtifact; - - return this; - } - - public void addArtifact(Artifact artifact) { - if (artifacts == null) { - artifacts = new LinkedHashSet<>(); - } - - artifacts.add(artifact); - } - - public Set getArtifacts() { - if (artifacts == null) { - artifacts = new LinkedHashSet<>(); - } - - return artifacts; - } - - public void setArtifacts(Set artifacts) { - this.artifacts = artifacts; - } - - public Set getArtifactResolutionNodes() { - if (resolutionNodes == null) { - resolutionNodes = new LinkedHashSet<>(); - } - - return resolutionNodes; - } - - public void setArtifactResolutionNodes(Set resolutionNodes) { - this.resolutionNodes = resolutionNodes; - } - - public boolean hasMissingArtifacts() { - return missingArtifacts != null && !missingArtifacts.isEmpty(); - } - - public List getMissingArtifacts() { - return missingArtifacts == null ? Collections.emptyList() : Collections.unmodifiableList(missingArtifacts); - } - - public ArtifactResolutionResult addMissingArtifact(Artifact artifact) { - missingArtifacts = initList(missingArtifacts); - - missingArtifacts.add(artifact); - - return this; - } - - public ArtifactResolutionResult setUnresolvedArtifacts(final List unresolvedArtifacts) { - this.missingArtifacts = unresolvedArtifacts; - - return this; - } - - public boolean isSuccess() { - return !(hasMissingArtifacts() || hasExceptions()); - } - - // ------------------------------------------------------------------------ - // Exceptions - // ------------------------------------------------------------------------ - - public boolean hasExceptions() { - return exceptions != null && !exceptions.isEmpty(); - } - - public List getExceptions() { - return exceptions == null ? Collections.emptyList() : Collections.unmodifiableList(exceptions); - } - - // ------------------------------------------------------------------------ - // Version Range Violations - // ------------------------------------------------------------------------ - - public boolean hasVersionRangeViolations() { - return versionRangeViolations != null; - } - - /** - * TODO this needs to accept a {@link OverConstrainedVersionException} as returned by - * {@link #getVersionRangeViolation(int)} but it's not used like that in - * DefaultLegacyArtifactCollector - * - * @param e an exception - * @return {@code this} - */ - public ArtifactResolutionResult addVersionRangeViolation(Exception e) { - versionRangeViolations = initList(versionRangeViolations); - - versionRangeViolations.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public OverConstrainedVersionException getVersionRangeViolation(int i) { - return (OverConstrainedVersionException) versionRangeViolations.get(i); - } - - public List getVersionRangeViolations() { - return versionRangeViolations == null - ? Collections.emptyList() - : Collections.unmodifiableList(versionRangeViolations); - } - - // ------------------------------------------------------------------------ - // Metadata Resolution Exceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasMetadataResolutionExceptions() { - return metadataResolutionExceptions != null; - } - - public ArtifactResolutionResult addMetadataResolutionException(ArtifactResolutionException e) { - metadataResolutionExceptions = initList(metadataResolutionExceptions); - - metadataResolutionExceptions.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public ArtifactResolutionException getMetadataResolutionException(int i) { - return metadataResolutionExceptions.get(i); - } - - public List getMetadataResolutionExceptions() { - return metadataResolutionExceptions == null - ? Collections.emptyList() - : Collections.unmodifiableList(metadataResolutionExceptions); - } - - // ------------------------------------------------------------------------ - // ErrorArtifactExceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasErrorArtifactExceptions() { - return errorArtifactExceptions != null; - } - - public ArtifactResolutionResult addErrorArtifactException(ArtifactResolutionException e) { - errorArtifactExceptions = initList(errorArtifactExceptions); - - errorArtifactExceptions.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public List getErrorArtifactExceptions() { - if (errorArtifactExceptions == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(errorArtifactExceptions); - } - - // ------------------------------------------------------------------------ - // Circular Dependency Exceptions - // ------------------------------------------------------------------------ - - public boolean hasCircularDependencyExceptions() { - return circularDependencyExceptions != null; - } - - public ArtifactResolutionResult addCircularDependencyException(CyclicDependencyException e) { - circularDependencyExceptions = initList(circularDependencyExceptions); - - circularDependencyExceptions.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public CyclicDependencyException getCircularDependencyException(int i) { - return circularDependencyExceptions.get(i); - } - - public List getCircularDependencyExceptions() { - if (circularDependencyExceptions == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(circularDependencyExceptions); - } - - // ------------------------------------------------------------------------ - // Repositories - // ------------------------------------------------------------------------ - - public List getRepositories() { - if (repositories == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(repositories); - } - - public ArtifactResolutionResult setRepositories(final List repositories) { - this.repositories = repositories; - - return this; - } - - // - // Internal - // - - private List initList(final List l) { - if (l == null) { - return new ArrayList<>(); - } - return l; - } - - public String toString() { - StringBuilder sb = new StringBuilder(); - - if (artifacts != null) { - int i = 1; - sb.append("---------").append(LS); - sb.append(artifacts.size()).append(LS); - for (Artifact a : artifacts) { - sb.append(i).append(' ').append(a).append(LS); - i++; - } - sb.append("---------"); - } - - return sb.toString(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java deleted file mode 100644 index ccdd808d123c..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.wagon.events.TransferListener; - -/** - */ -// Just hide the one method we want behind the RepositorySystem interface. -@Deprecated -public interface ArtifactResolver { - - ArtifactResolutionResult resolve(ArtifactResolutionRequest request); - - // The rest is deprecated - // USED BY MAVEN ASSEMBLY PLUGIN 2.2-beta-2 - @Deprecated - String ROLE = ArtifactResolver.class.getName(); - - // USED BY SUREFIRE, DEPENDENCY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY INVOKER PLUGIN - @Deprecated - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source) - throws ArtifactResolutionException, ArtifactNotFoundException; - - @Deprecated - @SuppressWarnings("checkstyle:parameternumber") - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners) - throws ArtifactResolutionException, ArtifactNotFoundException; - - @Deprecated - ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source, - List listeners) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY REMOTE RESOURCES PLUGIN, DEPENDENCY PLUGIN, SHADE PLUGIN - @Deprecated - void resolve(Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY REMOTE RESOURCES PLUGIN - @Deprecated - void resolve( - Artifact artifact, - List remoteRepositories, - ArtifactRepository localRepository, - TransferListener downloadMonitor) - throws ArtifactResolutionException, ArtifactNotFoundException; - - // USED BY DEPENDENCY PLUGIN, ARCHETYPE DOWNLOADER - @Deprecated - void resolveAlways( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java deleted file mode 100644 index 70191b2cb6a1..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.plexus.logging.Logger; - -/** - * Send resolution events to the debug log. - * - */ -@Deprecated -public class DebugResolutionListener implements ResolutionListener, ResolutionListenerForDepMgmt { - private Logger logger; - - private String indent = ""; - - private static Set ignoredArtifacts = new HashSet<>(); - - public DebugResolutionListener(Logger logger) { - this.logger = logger; - } - - public void testArtifact(Artifact node) {} - - public void startProcessChildren(Artifact artifact) { - indent += " "; - } - - public void endProcessChildren(Artifact artifact) { - indent = indent.substring(2); - } - - public void includeArtifact(Artifact artifact) { - logger.debug(indent + artifact + " (selected for " + artifact.getScope() + ")"); - } - - public void omitForNearer(Artifact omitted, Artifact kept) { - String omittedVersion = omitted.getVersion(); - String keptVersion = kept.getVersion(); - - if (!Objects.equals(omittedVersion, keptVersion)) { - logger.debug(indent + omitted + " (removed - nearer found: " + keptVersion + ")"); - } - } - - public void omitForCycle(Artifact omitted) { - logger.debug(indent + omitted + " (removed - causes a cycle in the graph)"); - } - - public void updateScopeCurrentPom(Artifact artifact, String ignoredScope) { - logger.debug(indent + artifact + " (not setting artifactScope to: " + ignoredScope + "; local artifactScope " - + artifact.getScope() + " wins)"); - - // TODO better way than static? this might hide messages in a reactor - if (!ignoredArtifacts.contains(artifact)) { - logger.warn("\n\tArtifact " + artifact + " retains local artifactScope '" + artifact.getScope() - + "' overriding broader artifactScope '" + ignoredScope + "'\n" - + "\tgiven by a dependency. If this is not intended, modify or remove the local artifactScope.\n"); - ignoredArtifacts.add(artifact); - } - } - - public void updateScope(Artifact artifact, String scope) { - logger.debug(indent + artifact + " (setting artifactScope to: " + scope + ")"); - } - - public void selectVersionFromRange(Artifact artifact) { - logger.debug(indent + artifact + " (setting version to: " + artifact.getVersion() + " from range: " - + artifact.getVersionRange() + ")"); - } - - public void restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange) { - logger.debug(indent + artifact + " (range restricted from: " + artifact.getVersionRange() + " and: " - + replacement.getVersionRange() + " to: " + newRange + " )"); - } - - /** - * The logic used here used to be a copy of the logic used in the DefaultArtifactCollector, and this method was - * called right before the actual version/artifactScope changes were done. However, a different set of conditionals - * (and more information) is needed to be able to determine when and if the version and/or artifactScope changes. - * See the two added methods, manageArtifactVersion and manageArtifactScope. - */ - public void manageArtifact(Artifact artifact, Artifact replacement) { - String msg = indent + artifact; - msg += " ("; - if (replacement.getVersion() != null) { - msg += "applying version: " + replacement.getVersion() + ";"; - } - if (replacement.getScope() != null) { - msg += "applying artifactScope: " + replacement.getScope(); - } - msg += ")"; - logger.debug(msg); - } - - public void manageArtifactVersion(Artifact artifact, Artifact replacement) { - // only show msg if a change is actually taking place - if (!replacement.getVersion().equals(artifact.getVersion())) { - String msg = indent + artifact + " (applying version: " + replacement.getVersion() + ")"; - logger.debug(msg); - } - } - - public void manageArtifactScope(Artifact artifact, Artifact replacement) { - // only show msg if a change is actually taking place - if (!replacement.getScope().equals(artifact.getScope())) { - String msg = indent + artifact + " (applying artifactScope: " + replacement.getScope() + ")"; - logger.debug(msg); - } - } - - public void manageArtifactSystemPath(Artifact artifact, Artifact replacement) { - // only show msg if a change is actually taking place - if (!replacement.getScope().equals(artifact.getScope())) { - String msg = indent + artifact + " (applying system path: " + replacement.getFile() + ")"; - logger.debug(msg); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java deleted file mode 100644 index 0c0a235a9ade..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import javax.inject.Named; -import javax.inject.Singleton; - -/** - * Artifact collector - takes a set of original artifacts and resolves all of the best versions to use - * along with their metadata. No artifacts are downloaded. - */ -@Deprecated -@Named -@Singleton -public class DefaultArtifactCollector extends org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector - implements ArtifactCollector {} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java deleted file mode 100644 index 5bb0c7d7edab..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java +++ /dev/null @@ -1,612 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Executor; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.regex.Matcher; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.LegacyLocalRepositoryManager; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; -import org.apache.maven.wagon.events.TransferListener; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResult; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactResolver implements ArtifactResolver, Disposable { - @Inject - private Logger logger; - - @Inject - protected ArtifactFactory artifactFactory; - - @Inject - private ArtifactCollector artifactCollector; - - @Inject - private ResolutionErrorHandler resolutionErrorHandler; - - @Inject - private ArtifactMetadataSource source; - - @Inject - private PlexusContainer container; - - @Inject - private LegacySupport legacySupport; - - private final Executor executor; - - public DefaultArtifactResolver() { - int threads = Integer.getInteger("maven.artifact.threads", 5); - if (threads <= 1) { - executor = Runnable::run; - } else { - executor = new ThreadPoolExecutor( - threads, threads, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new DaemonThreadCreator()); - } - } - - private RepositorySystemSession getSession(ArtifactRepository localRepository) { - return LegacyLocalRepositoryManager.overlay(localRepository, legacySupport.getRepositorySession(), null); - } - - private void injectSession1(RepositoryRequest request, MavenSession session) { - if (session != null) { - request.setOffline(session.isOffline()); - request.setForceUpdate(session.getRequest().isUpdateSnapshots()); - } - } - - private void injectSession2(ArtifactResolutionRequest request, MavenSession session) { - injectSession1(request, session); - - if (session != null) { - request.setServers(session.getRequest().getServers()); - request.setMirrors(session.getRequest().getMirrors()); - request.setProxies(session.getRequest().getProxies()); - } - } - - public void resolve( - Artifact artifact, - List remoteRepositories, - ArtifactRepository localRepository, - TransferListener resolutionListener) - throws ArtifactResolutionException, ArtifactNotFoundException { - resolve(artifact, remoteRepositories, getSession(localRepository)); - } - - public void resolveAlways( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException { - resolve(artifact, remoteRepositories, getSession(localRepository)); - } - - private void resolve( - Artifact artifact, List remoteRepositories, RepositorySystemSession session) - throws ArtifactResolutionException, ArtifactNotFoundException { - if (artifact == null) { - return; - } - - if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) { - File systemFile = artifact.getFile(); - - if (systemFile == null) { - throw new ArtifactNotFoundException("System artifact: " + artifact + " has no file attached", artifact); - } - - if (!systemFile.exists()) { - throw new ArtifactNotFoundException( - "System artifact: " + artifact + " not found in path: " + systemFile, artifact); - } - - if (!systemFile.isFile()) { - throw new ArtifactNotFoundException( - "System artifact: " + artifact + " is not a file: " + systemFile, artifact); - } - - artifact.setResolved(true); - - return; - } - - if (!artifact.isResolved()) { - ArtifactResult result; - - try { - ArtifactRequest artifactRequest = new ArtifactRequest(); - artifactRequest.setArtifact(RepositoryUtils.toArtifact(artifact)); - artifactRequest.setRepositories(RepositoryUtils.toRepos(remoteRepositories)); - - // Maven 2.x quirk: an artifact always points at the local repo, regardless whether resolved or not - LocalRepositoryManager lrm = session.getLocalRepositoryManager(); - String path = lrm.getPathForLocalArtifact(artifactRequest.getArtifact()); - artifact.setFile(new File(lrm.getRepository().getBasedir(), path)); - - RepositorySystem repoSystem = container.lookup(RepositorySystem.class); - result = repoSystem.resolveArtifact(session, artifactRequest); - } catch (ComponentLookupException e) { - throw new IllegalStateException("Unable to lookup " + RepositorySystem.class.getName()); - } catch (org.eclipse.aether.resolution.ArtifactResolutionException e) { - if (e.getCause() instanceof org.eclipse.aether.transfer.ArtifactNotFoundException) { - throw new ArtifactNotFoundException(e.getMessage(), artifact, remoteRepositories, e); - } else { - throw new ArtifactResolutionException(e.getMessage(), artifact, remoteRepositories, e); - } - } - - artifact.selectVersion(result.getArtifact().getVersion()); - artifact.setFile(result.getArtifact().getFile()); - artifact.setResolved(true); - - if (artifact.isSnapshot()) { - Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher(artifact.getVersion()); - if (matcher.matches()) { - Snapshot snapshot = new Snapshot(); - snapshot.setTimestamp(matcher.group(2)); - try { - snapshot.setBuildNumber(Integer.parseInt(matcher.group(3))); - artifact.addMetadata(new SnapshotArtifactRepositoryMetadata(artifact, snapshot)); - } catch (NumberFormatException e) { - logger.warn("Invalid artifact version " + artifact.getVersion() + ": " + e.getMessage()); - } - } - } - } - } - - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( - artifacts, - originatingArtifact, - Collections.emptyMap(), - localRepository, - remoteRepositories, - source, - filter); - } - - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( - artifacts, originatingArtifact, managedVersions, localRepository, remoteRepositories, source, null); - } - - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( - artifacts, - originatingArtifact, - managedVersions, - localRepository, - remoteRepositories, - source, - filter, - null); - } - - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively(artifacts, originatingArtifact, localRepository, remoteRepositories, source, null); - } - - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - List remoteRepositories, - ArtifactRepository localRepository, - ArtifactMetadataSource source, - List listeners) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( - artifacts, - originatingArtifact, - Collections.emptyMap(), - localRepository, - remoteRepositories, - source, - null, - listeners); - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners) - throws ArtifactResolutionException, ArtifactNotFoundException { - return resolveTransitively( - artifacts, - originatingArtifact, - managedVersions, - localRepository, - remoteRepositories, - source, - filter, - listeners, - null); - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactResolutionResult resolveTransitively( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers) - throws ArtifactResolutionException, ArtifactNotFoundException { - ArtifactResolutionRequest request = new ArtifactResolutionRequest() - .setArtifact(originatingArtifact) - .setResolveRoot(false) - . - // This is required by the surefire plugin - setArtifactDependencies(artifacts) - .setManagedVersionMap(managedVersions) - .setLocalRepository(localRepository) - .setRemoteRepositories(remoteRepositories) - .setCollectionFilter(filter) - .setListeners(listeners); - - injectSession2(request, legacySupport.getSession()); - - return resolveWithExceptions(request); - } - - public ArtifactResolutionResult resolveWithExceptions(ArtifactResolutionRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException { - ArtifactResolutionResult result = resolve(request); - - // We have collected all the problems so let's mimic the way the old code worked and just blow up right here. - // That's right lets just let it rip right here and send a big incomprehensible blob of text at unsuspecting - // users. Bad dog! - - resolutionErrorHandler.throwErrors(request, result); - - return result; - } - - // ------------------------------------------------------------------------ - // - // ------------------------------------------------------------------------ - - @SuppressWarnings("checkstyle:methodlength") - public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) { - Artifact rootArtifact = request.getArtifact(); - Set artifacts = request.getArtifactDependencies(); - Map managedVersions = request.getManagedVersionMap(); - List listeners = request.getListeners(); - ArtifactFilter collectionFilter = request.getCollectionFilter(); - ArtifactFilter resolutionFilter = request.getResolutionFilter(); - RepositorySystemSession session = getSession(request.getLocalRepository()); - - // TODO: hack because metadata isn't generated in m2e correctly and i want to run the maven i have in the - // workspace - if (source == null) { - try { - source = container.lookup(ArtifactMetadataSource.class); - } catch (ComponentLookupException e) { - // won't happen - } - } - - if (listeners == null) { - listeners = new ArrayList<>(); - - if (logger.isDebugEnabled()) { - listeners.add(new DebugResolutionListener(logger)); - } - - listeners.add(new WarningResolutionListener(logger)); - } - - ArtifactResolutionResult result = new ArtifactResolutionResult(); - - // The root artifact may, or may not be resolved so we need to check before we attempt to resolve. - // This is often an artifact like a POM that is taken from disk and we already have hold of the - // file reference. But this may be a Maven Plugin that we need to resolve from a remote repository - // as well as its dependencies. - - if (request.isResolveRoot() /* && rootArtifact.getFile() == null */) { - try { - resolve(rootArtifact, request.getRemoteRepositories(), session); - } catch (ArtifactResolutionException e) { - result.addErrorArtifactException(e); - return result; - } catch (ArtifactNotFoundException e) { - result.addMissingArtifact(request.getArtifact()); - return result; - } - } - - ArtifactResolutionRequest collectionRequest = request; - - if (request.isResolveTransitively()) { - MetadataResolutionRequest metadataRequest = new DefaultMetadataResolutionRequest(request); - - metadataRequest.setArtifact(rootArtifact); - metadataRequest.setResolveManagedVersions(managedVersions == null); - - try { - ResolutionGroup resolutionGroup = source.retrieve(metadataRequest); - - if (managedVersions == null) { - managedVersions = resolutionGroup.getManagedVersions(); - } - - Set directArtifacts = resolutionGroup.getArtifacts(); - - if (artifacts == null || artifacts.isEmpty()) { - artifacts = directArtifacts; - } else { - List allArtifacts = new ArrayList<>(); - allArtifacts.addAll(artifacts); - allArtifacts.addAll(directArtifacts); - - Map mergedArtifacts = new LinkedHashMap<>(); - for (Artifact artifact : allArtifacts) { - String conflictId = artifact.getDependencyConflictId(); - if (!mergedArtifacts.containsKey(conflictId)) { - mergedArtifacts.put(conflictId, artifact); - } - } - - artifacts = new LinkedHashSet<>(mergedArtifacts.values()); - } - - collectionRequest = new ArtifactResolutionRequest(request); - collectionRequest.setServers(request.getServers()); - collectionRequest.setMirrors(request.getMirrors()); - collectionRequest.setProxies(request.getProxies()); - collectionRequest.setRemoteRepositories(resolutionGroup.getResolutionRepositories()); - } catch (ArtifactMetadataRetrievalException e) { - ArtifactResolutionException are = new ArtifactResolutionException( - "Unable to get dependency information for " + rootArtifact.getId() + ": " + e.getMessage(), - rootArtifact, - metadataRequest.getRemoteRepositories(), - e); - result.addMetadataResolutionException(are); - return result; - } - } - - if (artifacts == null || artifacts.isEmpty()) { - if (request.isResolveRoot()) { - result.addArtifact(rootArtifact); - } - return result; - } - - // After the collection we will have the artifact object in the result but they will not be resolved yet. - result = artifactCollector.collect( - artifacts, rootArtifact, managedVersions, collectionRequest, source, collectionFilter, listeners, null); - - // We have metadata retrieval problems, or there are cycles that have been detected - // so we give this back to the calling code and let them deal with this information - // appropriately. - - if (result.hasMetadataResolutionExceptions() - || result.hasVersionRangeViolations() - || result.hasCircularDependencyExceptions()) { - return result; - } - - if (result.getArtifactResolutionNodes() != null) { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - - CountDownLatch latch = - new CountDownLatch(result.getArtifactResolutionNodes().size()); - - for (ResolutionNode node : result.getArtifactResolutionNodes()) { - Artifact artifact = node.getArtifact(); - - if (resolutionFilter == null || resolutionFilter.include(artifact)) { - executor.execute(new ResolveTask( - classLoader, latch, artifact, session, node.getRemoteRepositories(), result)); - } else { - latch.countDown(); - } - } - try { - latch.await(); - } catch (InterruptedException e) { - result.addErrorArtifactException( - new ArtifactResolutionException("Resolution interrupted", rootArtifact, e)); - } - } - - // We want to send the root artifact back in the result but we need to do this after the other dependencies - // have been resolved. - if (request.isResolveRoot()) { - // Add the root artifact (as the first artifact to retain logical order of class path!) - Set allArtifacts = new LinkedHashSet<>(); - allArtifacts.add(rootArtifact); - allArtifacts.addAll(result.getArtifacts()); - result.setArtifacts(allArtifacts); - } - - return result; - } - - public void resolve( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException { - resolve(artifact, remoteRepositories, localRepository, null); - } - - /** - * ThreadCreator for creating daemon threads with fixed ThreadGroup-name. - */ - @Deprecated - static final class DaemonThreadCreator implements ThreadFactory { - static final String THREADGROUP_NAME = "org.apache.maven.artifact.resolver.DefaultArtifactResolver"; - - static final ThreadGroup GROUP = new ThreadGroup(THREADGROUP_NAME); - - static final AtomicInteger THREAD_NUMBER = new AtomicInteger(1); - - public Thread newThread(Runnable r) { - Thread newThread = new Thread(GROUP, r, "resolver-" + THREAD_NUMBER.getAndIncrement()); - newThread.setDaemon(true); - newThread.setContextClassLoader(null); - return newThread; - } - } - - private class ResolveTask implements Runnable { - - private final ClassLoader classLoader; - - private final CountDownLatch latch; - - private final Artifact artifact; - - private final RepositorySystemSession session; - - private final List remoteRepositories; - - private final ArtifactResolutionResult result; - - ResolveTask( - ClassLoader classLoader, - CountDownLatch latch, - Artifact artifact, - RepositorySystemSession session, - List remoteRepositories, - ArtifactResolutionResult result) { - this.classLoader = classLoader; - this.latch = latch; - this.artifact = artifact; - this.session = session; - this.remoteRepositories = remoteRepositories; - this.result = result; - } - - public void run() { - ClassLoader old = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(classLoader); - resolve(artifact, remoteRepositories, session); - } catch (ArtifactNotFoundException anfe) { - // These are cases where the artifact just isn't present in any of the remote repositories - // because it wasn't deployed, or it was deployed in the wrong place. - - synchronized (result) { - result.addMissingArtifact(artifact); - } - } catch (ArtifactResolutionException e) { - // This is really a wagon TransferFailedException so something went wrong after we successfully - // retrieved the metadata. - - synchronized (result) { - result.addErrorArtifactException(e); - } - } finally { - latch.countDown(); - Thread.currentThread().setContextClassLoader(old); - } - } - } - - @Override - public void dispose() { - if (executor instanceof ExecutorService) { - ((ExecutorService) executor).shutdownNow(); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java deleted file mode 100644 index d2311e737f86..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultResolutionErrorHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultResolutionErrorHandler implements ResolutionErrorHandler { - - public void throwErrors(ArtifactResolutionRequest request, ArtifactResolutionResult result) - throws ArtifactResolutionException { - // Metadata cannot be found - - if (result.hasMetadataResolutionExceptions()) { - throw result.getMetadataResolutionException(0); - } - - // Metadata cannot be retrieved - - // Cyclic Dependency Error - - if (result.hasCircularDependencyExceptions()) { - throw result.getCircularDependencyException(0); - } - - // Version Range Violation - - if (result.hasVersionRangeViolations()) { - throw result.getVersionRangeViolation(0); - } - - // Transfer Error - - if (result.hasErrorArtifactExceptions()) { - throw result.getErrorArtifactExceptions().get(0); - } - - if (result.hasMissingArtifacts()) { - throw new MultipleArtifactsNotFoundException( - request.getArtifact(), - toList(result.getArtifacts()), - result.getMissingArtifacts(), - request.getRemoteRepositories()); - } - - // this should never happen since we checked all possible error sources before but better be sure - if (result.hasExceptions()) { - throw new ArtifactResolutionException( - "Unknown error during artifact resolution, " + request + ", " + result.getExceptions(), - request.getArtifact(), - request.getRemoteRepositories()); - } - } - - private static List toList(Collection items) { - return (items != null) ? new ArrayList<>(items) : null; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java deleted file mode 100644 index ccd8688ec566..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionErrorHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -/** - */ -@Deprecated -public interface ResolutionErrorHandler { - - void throwErrors(ArtifactResolutionRequest request, ArtifactResolutionResult result) - throws ArtifactResolutionException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java deleted file mode 100644 index 5015ff2807b5..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListener.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; - -/** - * Listens to the resolution process and handles events. - * - */ -@Deprecated -public interface ResolutionListener { - String ROLE = ResolutionListener.class.getName(); - - int TEST_ARTIFACT = 1; - - int PROCESS_CHILDREN = 2; - - int FINISH_PROCESSING_CHILDREN = 3; - - int INCLUDE_ARTIFACT = 4; - - int OMIT_FOR_NEARER = 5; - - int UPDATE_SCOPE = 6; - - @Deprecated - int MANAGE_ARTIFACT = 7; - - int OMIT_FOR_CYCLE = 8; - - /** - * this event means that the artifactScope has NOT been updated to a farther node artifactScope because current - * node is in the first level pom - */ - int UPDATE_SCOPE_CURRENT_POM = 9; - - int SELECT_VERSION_FROM_RANGE = 10; - - int RESTRICT_RANGE = 11; - - int MANAGE_ARTIFACT_VERSION = 12; - - int MANAGE_ARTIFACT_SCOPE = 13; - - int MANAGE_ARTIFACT_SYSTEM_PATH = 14; - - void testArtifact(Artifact node); - - void startProcessChildren(Artifact artifact); - - void endProcessChildren(Artifact artifact); - - void includeArtifact(Artifact artifact); - - void omitForNearer(Artifact omitted, Artifact kept); - - void updateScope(Artifact artifact, String scope); - - @Deprecated - void manageArtifact(Artifact artifact, Artifact replacement); - - // TODO Use the following two instead of manageArtifact - // TODO Remove ResolutionListenerDM interface - - // void manageArtifactVersion( Artifact artifact, Artifact replacement ); - - // void manageArtifactScope( Artifact artifact, Artifact replacement ); - - void omitForCycle(Artifact artifact); - - /** - * This event means that the artifactScope has NOT been updated to a farther node artifactScope because current - * node is in the first level pom - * - * @param artifact current node artifact, the one in the first level pom - * @param ignoredScope artifactScope that was ignored because artifact was in first level pom - */ - void updateScopeCurrentPom(Artifact artifact, String ignoredScope); - - void selectVersionFromRange(Artifact artifact); - - void restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange); -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java deleted file mode 100644 index 288af42c2cf4..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import org.apache.maven.artifact.Artifact; - -/** - * Do not use! - *

- * Should only be implemented by DebugResolutionListener. Remove this - * when the ResolutionListener interface deprecation of the manageArtifact - * method (and the [yet to be done] addition of these methods to that - * interface) has had a chance to propagate to all interested plugins. - */ -@Deprecated -public interface ResolutionListenerForDepMgmt { - void manageArtifactVersion(Artifact artifact, Artifact replacement); - - void manageArtifactScope(Artifact artifact, Artifact replacement); - - void manageArtifactSystemPath(Artifact artifact, Artifact replacement); -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java deleted file mode 100644 index 16e621719726..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionNode.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * ResolutionNode - */ -@Deprecated -public class ResolutionNode { - private Artifact artifact; - - private List children; - - private final List parents; - - private final int depth; - - private final ResolutionNode parent; - - private final List remoteRepositories; - - private boolean active = true; - - private List trail; - - public ResolutionNode(Artifact artifact, List remoteRepositories) { - this.artifact = artifact; - this.remoteRepositories = remoteRepositories; - depth = 0; - parents = Collections.emptyList(); - parent = null; - } - - public ResolutionNode(Artifact artifact, List remoteRepositories, ResolutionNode parent) { - this.artifact = artifact; - this.remoteRepositories = remoteRepositories; - depth = parent.depth + 1; - parents = new ArrayList<>(); - parents.addAll(parent.parents); - parents.add(parent.getKey()); - this.parent = parent; - } - - public Artifact getArtifact() { - return artifact; - } - - public Object getKey() { - return artifact.getDependencyConflictId(); - } - - public void addDependencies( - Set artifacts, List remoteRepositories, ArtifactFilter filter) - throws CyclicDependencyException, OverConstrainedVersionException { - if (artifacts != null && !artifacts.isEmpty()) { - children = new ArrayList<>(artifacts.size()); - - for (Artifact a : artifacts) { - if (parents.contains(a.getDependencyConflictId())) { - a.setDependencyTrail(getDependencyTrail()); - - throw new CyclicDependencyException("A dependency has introduced a cycle", a); - } - - children.add(new ResolutionNode(a, remoteRepositories, this)); - } - children = Collections.unmodifiableList(children); - } else { - children = Collections.emptyList(); - } - trail = null; - } - - /** - * @return {@link List} < {@link String} > with artifact ids - * @throws OverConstrainedVersionException if version specification is over constrained - */ - public List getDependencyTrail() throws OverConstrainedVersionException { - List trial = getTrail(); - - List ret = new ArrayList<>(trial.size()); - - for (Artifact artifact : trial) { - ret.add(artifact.getId()); - } - - return ret; - } - - private List getTrail() throws OverConstrainedVersionException { - if (trail == null) { - List ids = new LinkedList<>(); - ResolutionNode node = this; - while (node != null) { - Artifact artifact = node.getArtifact(); - if (artifact.getVersion() == null) { - // set the recommended version - ArtifactVersion selected = artifact.getSelectedVersion(); - // MNG-2123: null is a valid response to getSelectedVersion, don't - // assume it won't ever be. - if (selected != null) { - artifact.selectVersion(selected.toString()); - } else { - throw new OverConstrainedVersionException( - "Unable to get a selected Version for " + artifact.getArtifactId(), artifact); - } - } - - ids.add(0, artifact); - node = node.parent; - } - trail = ids; - } - return trail; - } - - public boolean isResolved() { - return children != null; - } - - /** - * Test whether the node is direct or transitive dependency. - * - * @return whether the node is direct or transitive dependency - */ - public boolean isChildOfRootNode() { - return parent != null && parent.parent == null; - } - - public Iterator getChildrenIterator() { - return children.iterator(); - } - - public int getDepth() { - return depth; - } - - public List getRemoteRepositories() { - return remoteRepositories; - } - - public boolean isActive() { - return active; - } - - public void enable() { - active = true; - - // TODO if it was null, we really need to go find them now... or is this taken care of by the ordering? - if (children != null) { - for (ResolutionNode node : children) { - node.enable(); - } - } - } - - public void disable() { - active = false; - if (children != null) { - for (ResolutionNode node : children) { - node.disable(); - } - } - } - - public boolean filterTrail(ArtifactFilter filter) throws OverConstrainedVersionException { - boolean success = true; - if (filter != null) { - for (Artifact artifact : getTrail()) { - if (!filter.include(artifact)) { - success = false; - } - } - } - return success; - } - - @Override - public String toString() { - return artifact.toString() + " (" + depth + "; " + (active ? "enabled" : "disabled") + ")"; - } - - public void setArtifact(Artifact artifact) { - this.artifact = artifact; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java deleted file mode 100644 index 4e6016c6eff3..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * A simple recording of the Artifacts that could not be resolved for a given resolution request, along with - * the remote repositories where attempts were made to resolve the artifacts. - * - */ -@Deprecated -public class UnresolvedArtifacts { - private Artifact originatingArtifact; - - private List artifacts; - - private List remoteRepositories; - - public UnresolvedArtifacts( - Artifact originatingArtifact, List artifacts, List remoteRepositories) { - this.originatingArtifact = originatingArtifact; - - this.artifacts = artifacts; - - this.remoteRepositories = remoteRepositories; - } - - public Artifact getOriginatingArtifact() { - return originatingArtifact; - } - - public List getArtifacts() { - return artifacts; - } - - public List getRemoteRepositories() { - return remoteRepositories; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java deleted file mode 100644 index ddfd5686a6fe..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.plexus.logging.Logger; - -/** - * Send resolution warning events to the warning log. - * - */ -@Deprecated -public class WarningResolutionListener implements ResolutionListener { - private Logger logger; - - public WarningResolutionListener(Logger logger) { - this.logger = logger; - } - - public void testArtifact(Artifact node) {} - - public void startProcessChildren(Artifact artifact) {} - - public void endProcessChildren(Artifact artifact) {} - - public void includeArtifact(Artifact artifact) {} - - public void omitForNearer(Artifact omitted, Artifact kept) {} - - public void omitForCycle(Artifact omitted) {} - - public void updateScopeCurrentPom(Artifact artifact, String scope) {} - - public void updateScope(Artifact artifact, String scope) {} - - public void manageArtifact(Artifact artifact, Artifact replacement) {} - - public void selectVersionFromRange(Artifact artifact) {} - - public void restrictRange(Artifact artifact, Artifact replacement, VersionRange newRange) {} -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java deleted file mode 100644 index 30f4e1641856..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import org.apache.maven.artifact.Artifact; - -/** - * InversionArtifactFilter - */ -@Deprecated -public class InversionArtifactFilter implements ArtifactFilter { - private final ArtifactFilter toInvert; - - public InversionArtifactFilter(ArtifactFilter toInvert) { - this.toInvert = toInvert; - } - - public boolean include(Artifact artifact) { - return !toInvert.include(artifact); - } - - @Override - public int hashCode() { - int hash = 17; - hash = hash * 31 + toInvert.hashCode(); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (!(obj instanceof InversionArtifactFilter)) { - return false; - } - - InversionArtifactFilter other = (InversionArtifactFilter) obj; - - return toInvert.equals(other.toInvert); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java deleted file mode 100644 index 274add48ac26..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; - -/** - * Apply multiple filters, accepting an artifact if at least one of the filters accepts it. - * - */ -@Deprecated -public class OrArtifactFilter implements ArtifactFilter { - - private Set filters; - - public OrArtifactFilter() { - this.filters = new LinkedHashSet<>(); - } - - public OrArtifactFilter(Collection filters) { - this.filters = new LinkedHashSet<>(filters); - } - - public boolean include(Artifact artifact) { - for (ArtifactFilter filter : filters) { - if (filter.include(artifact)) { - return true; - } - } - - return false; - } - - public void add(ArtifactFilter artifactFilter) { - filters.add(artifactFilter); - } - - @Override - public int hashCode() { - int hash = 17; - hash = hash * 31 + filters.hashCode(); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (!(obj instanceof OrArtifactFilter)) { - return false; - } - - OrArtifactFilter other = (OrArtifactFilter) obj; - - return filters.equals(other.filters); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java b/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java deleted file mode 100644 index 16ee7bef6b81..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import org.apache.maven.artifact.Artifact; - -/** Artifact Filter which filters on artifact type */ -@Deprecated -public class TypeArtifactFilter implements ArtifactFilter { - private String type = "jar"; - - public TypeArtifactFilter(String type) { - this.type = type; - } - - public boolean include(Artifact artifact) { - return type.equals(artifact.getType()); - } - - @Override - public int hashCode() { - int hash = 17; - hash = hash * 31 + type.hashCode(); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (!(obj instanceof TypeArtifactFilter)) { - return false; - } - - TypeArtifactFilter other = (TypeArtifactFilter) obj; - - return type.equals(other.type); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java b/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java deleted file mode 100644 index 9e6b78eebd58..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.versioning; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.apache.maven.artifact.Artifact; - -/** - * ManagedVersionMap - */ -@Deprecated -public class ManagedVersionMap extends HashMap { - public ManagedVersionMap(Map map) { - super(); - if (map != null) { - putAll(map); - } - } - - public String toString() { - StringBuilder buffer = new StringBuilder("ManagedVersionMap (" + size() + " entries)\n"); - Iterator iter = keySet().iterator(); - while (iter.hasNext()) { - String key = iter.next(); - buffer.append(key).append('=').append(get(key)); - if (iter.hasNext()) { - buffer.append('\n'); - } - } - return buffer.toString(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java deleted file mode 100644 index 40e3942e3f20..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.execution; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; - -/** - * Describes runtime information about the application. - * - */ -@Deprecated -@Named -@Singleton -public class DefaultRuntimeInformation implements RuntimeInformation, Initializable { - - @Inject - private org.apache.maven.rtinfo.RuntimeInformation rtInfo; - - private ArtifactVersion applicationVersion; - - public ArtifactVersion getApplicationVersion() { - return applicationVersion; - } - - public void initialize() throws InitializationException { - String mavenVersion = rtInfo.getMavenVersion(); - - if (mavenVersion == null || mavenVersion.isEmpty()) { - throw new InitializationException("Unable to read Maven version from maven-core"); - } - - applicationVersion = new DefaultArtifactVersion(mavenVersion); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java b/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java deleted file mode 100644 index e16946516128..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.execution; - -import org.apache.maven.artifact.versioning.ArtifactVersion; - -/** - * Describes runtime information about the application. - * - * @deprecated Use {@link org.apache.maven.rtinfo.RuntimeInformation} instead. - */ -@Deprecated -public interface RuntimeInformation { - ArtifactVersion getApplicationVersion(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/plugin/PluginManager.java b/maven-compat/src/main/java/org/apache/maven/plugin/PluginManager.java deleted file mode 100644 index 2b7e44e0f742..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/plugin/PluginManager.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.plugin; - -import java.util.Map; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugin.version.PluginVersionNotFoundException; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.apache.maven.settings.Settings; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - */ -@Deprecated -public interface PluginManager { - String ROLE = PluginManager.class.getName(); - - void executeMojo(MavenProject project, MojoExecution execution, MavenSession session) - throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException, - InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException; - - PluginDescriptor getPluginDescriptorForPrefix(String prefix); - - Plugin getPluginDefinitionForPrefix(String prefix, MavenSession session, MavenProject project); - - PluginDescriptor verifyPlugin( - Plugin plugin, MavenProject project, Settings settings, ArtifactRepository localRepository) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException; - - Object getPluginComponent(Plugin plugin, String role, String roleHint) - throws PluginManagerException, ComponentLookupException; - - Map getPluginComponents(Plugin plugin, String role) - throws ComponentLookupException, PluginManagerException; - - /** - * @since 2.2.1 - */ - PluginDescriptor loadPluginDescriptor(Plugin plugin, MavenProject project, MavenSession session) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException; - - /** - * @since 2.2.1 - */ - PluginDescriptor loadPluginFully(Plugin plugin, MavenProject project, MavenSession session) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java b/maven-compat/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java deleted file mode 100644 index 7a60717df68e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/plugin/internal/DefaultPluginManager.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.plugin.internal; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Map; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.InvalidPluginDescriptorException; -import org.apache.maven.plugin.InvalidPluginException; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.plugin.MavenPluginManager; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.PluginConfigurationException; -import org.apache.maven.plugin.PluginDescriptorParsingException; -import org.apache.maven.plugin.PluginManager; -import org.apache.maven.plugin.PluginManagerException; -import org.apache.maven.plugin.PluginNotFoundException; -import org.apache.maven.plugin.PluginResolutionException; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugin.prefix.DefaultPluginPrefixRequest; -import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException; -import org.apache.maven.plugin.prefix.PluginPrefixRequest; -import org.apache.maven.plugin.prefix.PluginPrefixResolver; -import org.apache.maven.plugin.prefix.PluginPrefixResult; -import org.apache.maven.plugin.version.DefaultPluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionNotFoundException; -import org.apache.maven.plugin.version.PluginVersionRequest; -import org.apache.maven.plugin.version.PluginVersionResolutionException; -import org.apache.maven.plugin.version.PluginVersionResolver; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.apache.maven.settings.Settings; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultPluginManager implements PluginManager { - - private final PlexusContainer container; - private final MavenPluginManager pluginManager; - private final PluginVersionResolver pluginVersionResolver; - private final PluginPrefixResolver pluginPrefixResolver; - private final LegacySupport legacySupport; - - @Inject - public DefaultPluginManager( - PlexusContainer container, - MavenPluginManager pluginManager, - PluginVersionResolver pluginVersionResolver, - PluginPrefixResolver pluginPrefixResolver, - LegacySupport legacySupport) { - this.container = container; - this.pluginManager = pluginManager; - this.pluginVersionResolver = pluginVersionResolver; - this.pluginPrefixResolver = pluginPrefixResolver; - this.legacySupport = legacySupport; - } - - public void executeMojo(MavenProject project, MojoExecution execution, MavenSession session) - throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException, - InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException { - throw new UnsupportedOperationException(); - } - - public Object getPluginComponent(Plugin plugin, String role, String roleHint) - throws PluginManagerException, ComponentLookupException { - MavenSession session = legacySupport.getSession(); - - PluginDescriptor pluginDescriptor; - try { - pluginDescriptor = pluginManager.getPluginDescriptor( - plugin, session.getCurrentProject().getRemotePluginRepositories(), session.getRepositorySession()); - - pluginManager.setupPluginRealm(pluginDescriptor, session, null, null, null); - } catch (Exception e) { - throw new PluginManagerException(plugin, e.getMessage(), e); - } - - ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(pluginDescriptor.getClassRealm()); - - return container.lookup(role, roleHint); - } finally { - Thread.currentThread().setContextClassLoader(oldClassLoader); - } - } - - public Map getPluginComponents(Plugin plugin, String role) - throws ComponentLookupException, PluginManagerException { - MavenSession session = legacySupport.getSession(); - - PluginDescriptor pluginDescriptor; - try { - pluginDescriptor = pluginManager.getPluginDescriptor( - plugin, session.getCurrentProject().getRemotePluginRepositories(), session.getRepositorySession()); - - pluginManager.setupPluginRealm(pluginDescriptor, session, null, null, null); - } catch (Exception e) { - throw new PluginManagerException(plugin, e.getMessage(), e); - } - - ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(pluginDescriptor.getClassRealm()); - - return container.lookupMap(role); - } finally { - Thread.currentThread().setContextClassLoader(oldClassLoader); - } - } - - public Plugin getPluginDefinitionForPrefix(String prefix, MavenSession session, MavenProject project) { - PluginPrefixRequest request = new DefaultPluginPrefixRequest(prefix, session); - request.setPom(project.getModel()); - - try { - PluginPrefixResult result = pluginPrefixResolver.resolve(request); - - Plugin plugin = new Plugin(); - plugin.setGroupId(result.getGroupId()); - plugin.setArtifactId(result.getArtifactId()); - - return plugin; - } catch (NoPluginFoundForPrefixException e) { - return null; - } - } - - public PluginDescriptor getPluginDescriptorForPrefix(String prefix) { - MavenSession session = legacySupport.getSession(); - - PluginPrefixRequest request = new DefaultPluginPrefixRequest(prefix, session); - - try { - PluginPrefixResult result = pluginPrefixResolver.resolve(request); - - Plugin plugin = new Plugin(); - plugin.setGroupId(result.getGroupId()); - plugin.setArtifactId(result.getArtifactId()); - - return loadPluginDescriptor(plugin, session.getCurrentProject(), session); - } catch (Exception e) { - return null; - } - } - - public PluginDescriptor loadPluginDescriptor(Plugin plugin, MavenProject project, MavenSession session) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException { - return verifyPlugin(plugin, project, session.getSettings(), session.getLocalRepository()); - } - - public PluginDescriptor loadPluginFully(Plugin plugin, MavenProject project, MavenSession session) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException { - PluginDescriptor pluginDescriptor = loadPluginDescriptor(plugin, project, session); - - try { - pluginManager.setupPluginRealm(pluginDescriptor, session, null, null, null); - } catch (PluginResolutionException e) { - throw new PluginManagerException(plugin, e.getMessage(), e); - } - - return pluginDescriptor; - } - - public PluginDescriptor verifyPlugin( - Plugin plugin, MavenProject project, Settings settings, ArtifactRepository localRepository) - throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException, - InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, - PluginNotFoundException, PluginVersionNotFoundException { - MavenSession session = legacySupport.getSession(); - - if (plugin.getVersion() == null) { - PluginVersionRequest versionRequest = new DefaultPluginVersionRequest( - plugin, session.getRepositorySession(), project.getRemotePluginRepositories()); - plugin.setVersion(pluginVersionResolver.resolve(versionRequest).getVersion()); - } - - try { - return pluginManager.getPluginDescriptor( - plugin, project.getRemotePluginRepositories(), session.getRepositorySession()); - } catch (PluginResolutionException e) { - throw new PluginNotFoundException(plugin, project.getPluginArtifactRepositories()); - } catch (PluginDescriptorParsingException | InvalidPluginDescriptorException e) { - throw new PluginManagerException(plugin, e.getMessage(), e); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java deleted file mode 100644 index 6727261059aa..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles; - -import javax.inject.Inject; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.Profile; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.profile.DefaultProfileActivationContext; -import org.apache.maven.model.profile.ProfileSelector; -import org.apache.maven.profiles.activation.ProfileActivationException; -import org.codehaus.plexus.MutablePlexusContainer; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; - -/** - * DefaultProfileManager - */ -@Deprecated -public class DefaultProfileManager implements ProfileManager { - - @Inject - private Logger logger; - - @Inject - private ProfileSelector profileSelector; - - private List activatedIds = new ArrayList<>(); - - private List deactivatedIds = new ArrayList<>(); - - private List defaultIds = new ArrayList<>(); - - private Map profilesById = new LinkedHashMap<>(); - - private Properties requestProperties; - - /** - * @deprecated without passing in the system properties, the SystemPropertiesProfileActivator will not work - * correctly in embedded environments. - */ - @Deprecated - public DefaultProfileManager(PlexusContainer container) { - this(container, null); - } - - /** - * the properties passed to the profile manager are the props that - * are passed to maven, possibly containing profile activator properties - * - */ - public DefaultProfileManager(PlexusContainer container, Properties props) { - try { - this.profileSelector = container.lookup(ProfileSelector.class); - this.logger = ((MutablePlexusContainer) container).getLogger(); - } catch (ComponentLookupException e) { - throw new IllegalStateException(e); - } - this.requestProperties = props; - } - - public Properties getRequestProperties() { - return requestProperties; - } - - public Map getProfilesById() { - return profilesById; - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#addProfile(org.apache.maven.model.Profile) - */ - public void addProfile(Profile profile) { - String profileId = profile.getId(); - - Profile existing = profilesById.get(profileId); - if (existing != null) { - logger.warn("Overriding profile: '" + profileId + "' (source: " + existing.getSource() - + ") with new instance from source: " + profile.getSource()); - } - - profilesById.put(profile.getId(), profile); - - Activation activation = profile.getActivation(); - - if (activation != null && activation.isActiveByDefault()) { - activateAsDefault(profileId); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyActivate(java.lang.String) - */ - public void explicitlyActivate(String profileId) { - if (!activatedIds.contains(profileId)) { - logger.debug("Profile with id: '" + profileId + "' has been explicitly activated."); - - activatedIds.add(profileId); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyActivate(java.util.List) - */ - public void explicitlyActivate(List profileIds) { - for (String profileId1 : profileIds) { - explicitlyActivate(profileId1); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyDeactivate(java.lang.String) - */ - public void explicitlyDeactivate(String profileId) { - if (!deactivatedIds.contains(profileId)) { - logger.debug("Profile with id: '" + profileId + "' has been explicitly deactivated."); - - deactivatedIds.add(profileId); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#explicitlyDeactivate(java.util.List) - */ - public void explicitlyDeactivate(List profileIds) { - for (String profileId1 : profileIds) { - explicitlyDeactivate(profileId1); - } - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#getActiveProfiles() - */ - public List getActiveProfiles() throws ProfileActivationException { - DefaultProfileActivationContext context = new DefaultProfileActivationContext(); - context.setActiveProfileIds(activatedIds); - context.setInactiveProfileIds(deactivatedIds); - context.setSystemProperties(System.getProperties()); - context.setUserProperties(requestProperties); - - final List errors = new ArrayList<>(); - - List profiles = profileSelector.getActiveProfiles(profilesById.values(), context, req -> { - if (!ModelProblem.Severity.WARNING.equals(req.getSeverity())) { - errors.add(new ProfileActivationException(req.getMessage(), req.getException())); - } - }); - - if (!errors.isEmpty()) { - throw errors.get(0); - } - - return profiles; - } - - /* (non-Javadoc) - * @see org.apache.maven.profiles.ProfileManager#addProfiles(java.util.List) - */ - public void addProfiles(List profiles) { - for (Profile profile1 : profiles) { - addProfile(profile1); - } - } - - public void activateAsDefault(String profileId) { - if (!defaultIds.contains(profileId)) { - defaultIds.add(profileId); - } - } - - public List getExplicitlyActivatedIds() { - return activatedIds; - } - - public List getExplicitlyDeactivatedIds() { - return deactivatedIds; - } - - public List getIdsActivatedByDefault() { - return defaultIds; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java b/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java deleted file mode 100644 index 3781be1c69fb..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles; - -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.maven.model.Profile; -import org.apache.maven.profiles.activation.ProfileActivationException; - -/** - * ProfileManager - */ -@Deprecated -public interface ProfileManager { - - void addProfile(Profile profile); - - void explicitlyActivate(String profileId); - - void explicitlyActivate(List profileIds); - - void explicitlyDeactivate(String profileId); - - void explicitlyDeactivate(List profileIds); - - List getActiveProfiles() throws ProfileActivationException; - - void addProfiles(List profiles); - - Map getProfilesById(); - - List getExplicitlyActivatedIds(); - - List getExplicitlyDeactivatedIds(); - - List getIdsActivatedByDefault(); - - Properties getRequestProperties(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java b/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java deleted file mode 100644 index e0e77d2800cc..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles; - -import java.util.List; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationFile; -import org.apache.maven.model.ActivationProperty; -import org.apache.maven.model.Profile; -import org.apache.maven.model.Repository; - -/** - * ProfilesConversionUtils - */ -@Deprecated -public class ProfilesConversionUtils { - private ProfilesConversionUtils() {} - - public static Profile convertFromProfileXmlProfile(org.apache.maven.profiles.Profile profileXmlProfile) { - Profile profile = new Profile(); - - profile.setId(profileXmlProfile.getId()); - - profile.setSource("profiles.xml"); - - org.apache.maven.profiles.Activation profileActivation = profileXmlProfile.getActivation(); - - if (profileActivation != null) { - Activation activation = new Activation(); - - activation.setActiveByDefault(profileActivation.isActiveByDefault()); - - activation.setJdk(profileActivation.getJdk()); - - org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty(); - - if (profileProp != null) { - ActivationProperty prop = new ActivationProperty(); - - prop.setName(profileProp.getName()); - prop.setValue(profileProp.getValue()); - - activation.setProperty(prop); - } - - ActivationOS profileOs = profileActivation.getOs(); - - if (profileOs != null) { - org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS(); - - os.setArch(profileOs.getArch()); - os.setFamily(profileOs.getFamily()); - os.setName(profileOs.getName()); - os.setVersion(profileOs.getVersion()); - - activation.setOs(os); - } - - org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile(); - - if (profileFile != null) { - ActivationFile file = new ActivationFile(); - - file.setExists(profileFile.getExists()); - file.setMissing(profileFile.getMissing()); - - activation.setFile(file); - } - - profile.setActivation(activation); - } - - profile.setProperties(profileXmlProfile.getProperties()); - - List repos = profileXmlProfile.getRepositories(); - if (repos != null) { - for (Object repo : repos) { - profile.addRepository(convertFromProfileXmlRepository((org.apache.maven.profiles.Repository) repo)); - } - } - - List pluginRepos = profileXmlProfile.getPluginRepositories(); - if (pluginRepos != null) { - for (Object pluginRepo : pluginRepos) { - profile.addPluginRepository( - convertFromProfileXmlRepository((org.apache.maven.profiles.Repository) pluginRepo)); - } - } - - return profile; - } - - private static Repository convertFromProfileXmlRepository(org.apache.maven.profiles.Repository profileXmlRepo) { - Repository repo = new Repository(); - - repo.setId(profileXmlRepo.getId()); - repo.setLayout(profileXmlRepo.getLayout()); - repo.setName(profileXmlRepo.getName()); - repo.setUrl(profileXmlRepo.getUrl()); - - if (profileXmlRepo.getSnapshots() != null) { - repo.setSnapshots(convertRepositoryPolicy(profileXmlRepo.getSnapshots())); - } - if (profileXmlRepo.getReleases() != null) { - repo.setReleases(convertRepositoryPolicy(profileXmlRepo.getReleases())); - } - - return repo; - } - - private static org.apache.maven.model.RepositoryPolicy convertRepositoryPolicy(RepositoryPolicy profileXmlRepo) { - org.apache.maven.model.RepositoryPolicy policy = new org.apache.maven.model.RepositoryPolicy(); - policy.setEnabled(profileXmlRepo.isEnabled()); - policy.setUpdatePolicy(profileXmlRepo.getUpdatePolicy()); - policy.setChecksumPolicy(profileXmlRepo.getChecksumPolicy()); - return policy; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java deleted file mode 100644 index ee023ff77c04..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import org.apache.maven.model.Profile; - -/** - * DetectedProfileActivator - */ -@Deprecated -public abstract class DetectedProfileActivator implements ProfileActivator { - public boolean canDetermineActivation(Profile profile) { - return canDetectActivation(profile); - } - - protected abstract boolean canDetectActivation(Profile profile); -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java deleted file mode 100644 index 081ff5fdfb81..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationFile; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.interpolation.EnvarBasedValueSource; -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.MapBasedValueSource; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; -import org.codehaus.plexus.logging.LogEnabled; -import org.codehaus.plexus.logging.Logger; - -/** - * FileProfileActivator - */ -@Deprecated -public class FileProfileActivator extends DetectedProfileActivator implements LogEnabled { - private Logger logger; - - protected boolean canDetectActivation(Profile profile) { - return profile.getActivation() != null && profile.getActivation().getFile() != null; - } - - public boolean isActive(Profile profile) { - Activation activation = profile.getActivation(); - - ActivationFile actFile = activation.getFile(); - - if (actFile != null) { - // check if the file exists, if it does then the profile will be active - String fileString = actFile.getExists(); - - RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); - try { - interpolator.addValueSource(new EnvarBasedValueSource()); - } catch (IOException e) { - // ignored - } - interpolator.addValueSource(new MapBasedValueSource(System.getProperties())); - - try { - if (fileString != null && !fileString.isEmpty()) { - fileString = interpolator.interpolate(fileString, "").replace("\\", "/"); - File file = new File(fileString); - return file.exists(); - } - - // check if the file is missing, if it is then the profile will be active - fileString = actFile.getMissing(); - - if (fileString != null && !fileString.isEmpty()) { - fileString = interpolator.interpolate(fileString, "").replace("\\", "/"); - File file = new File(fileString); - return !file.exists(); - } - } catch (InterpolationException e) { - if (logger.isDebugEnabled()) { - logger.debug("Failed to interpolate missing file location for profile activator: " + fileString, e); - } else { - logger.warn("Failed to interpolate missing file location for profile activator: " + fileString - + ", enable verbose output (-X) for more details"); - } - } - } - - return false; - } - - public void enableLogging(Logger logger) { - this.logger = logger; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java deleted file mode 100644 index 4e18159c7587..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.model.Activation; -import org.apache.maven.model.Profile; - -/** - * JdkPrefixProfileActivator - */ -@Deprecated -public class JdkPrefixProfileActivator extends DetectedProfileActivator { - private static final String JDK_VERSION = System.getProperty("java.version"); - - public boolean isActive(Profile profile) throws ProfileActivationException { - Activation activation = profile.getActivation(); - - String jdk = activation.getJdk(); - - // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here. - if (jdk.startsWith("[") || jdk.startsWith("(")) { - try { - return matchJdkVersionRange(jdk); - } catch (InvalidVersionSpecificationException e) { - throw new ProfileActivationException( - "Invalid JDK version in profile '" + profile.getId() + "': " + e.getMessage()); - } - } - - boolean reverse = false; - - if (jdk.startsWith("!")) { - reverse = true; - jdk = jdk.substring(1); - } - - if (getJdkVersion().startsWith(jdk)) { - return !reverse; - } else { - return reverse; - } - } - - private boolean matchJdkVersionRange(String jdk) throws InvalidVersionSpecificationException { - VersionRange jdkVersionRange = VersionRange.createFromVersionSpec(convertJdkToMavenVersion(jdk)); - DefaultArtifactVersion jdkVersion = new DefaultArtifactVersion(convertJdkToMavenVersion(getJdkVersion())); - return jdkVersionRange.containsVersion(jdkVersion); - } - - private String convertJdkToMavenVersion(String jdk) { - return jdk.replace("_", "-"); - } - - protected String getJdkVersion() { - return JDK_VERSION; - } - - protected boolean canDetectActivation(Profile profile) { - return profile.getActivation() != null - && profile.getActivation().getJdk() != null - && !profile.getActivation().getJdk().isEmpty(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java deleted file mode 100644 index 0a33cdc2f8a9..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationOS; -import org.apache.maven.model.Profile; -import org.apache.maven.utils.Os; - -/** - * OperatingSystemProfileActivator - */ -@Deprecated -public class OperatingSystemProfileActivator implements ProfileActivator { - - public boolean canDetermineActivation(Profile profile) { - Activation activation = profile.getActivation(); - return activation != null && activation.getOs() != null; - } - - public boolean isActive(Profile profile) { - Activation activation = profile.getActivation(); - ActivationOS os = activation.getOs(); - - boolean result = ensureAtLeastOneNonNull(os); - - if (result && os.getFamily() != null) { - result = determineFamilyMatch(os.getFamily()); - } - if (result && os.getName() != null) { - result = determineNameMatch(os.getName()); - } - if (result && os.getArch() != null) { - result = determineArchMatch(os.getArch()); - } - if (result && os.getVersion() != null) { - result = determineVersionMatch(os.getVersion()); - } - return result; - } - - private boolean ensureAtLeastOneNonNull(ActivationOS os) { - return os.getArch() != null || os.getFamily() != null || os.getName() != null || os.getVersion() != null; - } - - private boolean determineVersionMatch(String version) { - String test = version; - boolean reverse = false; - - if (test.startsWith("!")) { - reverse = true; - test = test.substring(1); - } - - boolean result = Os.OS_VERSION.equals(test); - - if (reverse) { - return !result; - } else { - return result; - } - } - - private boolean determineArchMatch(String arch) { - String test = arch; - boolean reverse = false; - - if (test.startsWith("!")) { - reverse = true; - test = test.substring(1); - } - - boolean result = Os.OS_ARCH.equals(test); - - if (reverse) { - return !result; - } else { - return result; - } - } - - private boolean determineNameMatch(String name) { - String test = name; - boolean reverse = false; - - if (test.startsWith("!")) { - reverse = true; - test = test.substring(1); - } - - boolean result = Os.OS_NAME.equals(test); - - if (reverse) { - return !result; - } else { - return result; - } - } - - private boolean determineFamilyMatch(String family) { - String test = family; - boolean reverse = false; - - if (test.startsWith("!")) { - reverse = true; - test = test.substring(1); - } - - boolean result = Os.isFamily(test); - - if (reverse) { - return !result; - } else { - return result; - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java deleted file mode 100644 index 5215d9e19178..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -/** - * ProfileActivationException - */ -@Deprecated -public class ProfileActivationException extends Exception { - - private static final long serialVersionUID = -90820222109103638L; - - public ProfileActivationException(String message, Throwable cause) { - super(message, cause); - } - - public ProfileActivationException(String message) { - super(message); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java deleted file mode 100644 index fc8a6e7f00f5..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import org.apache.maven.model.Profile; - -/** - * ProfileActivator - */ -@Deprecated -public interface ProfileActivator { - - String ROLE = ProfileActivator.class.getName(); - - boolean canDetermineActivation(Profile profile); - - boolean isActive(Profile profile) throws ProfileActivationException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java b/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java deleted file mode 100644 index 59d65d395a2f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.activation; - -import java.util.Properties; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationProperty; -import org.apache.maven.model.Profile; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; - -/** - * SystemPropertyProfileActivator - */ -@Deprecated -public class SystemPropertyProfileActivator extends DetectedProfileActivator implements Contextualizable { - private Properties properties; - - public void contextualize(Context context) throws ContextException { - properties = (Properties) context.get("SystemProperties"); - } - - protected boolean canDetectActivation(Profile profile) { - return profile.getActivation() != null && profile.getActivation().getProperty() != null; - } - - public boolean isActive(Profile profile) throws ProfileActivationException { - Activation activation = profile.getActivation(); - - ActivationProperty property = activation.getProperty(); - - if (property != null) { - String name = property.getName(); - boolean reverseName = false; - - if (name == null) { - throw new ProfileActivationException( - "The property name is required to activate the profile '" + profile.getId() + "'"); - } - - if (name.startsWith("!")) { - reverseName = true; - name = name.substring(1); - } - - String sysValue = properties.getProperty(name); - - String propValue = property.getValue(); - if (propValue != null && !propValue.isEmpty()) { - boolean reverseValue = false; - if (propValue.startsWith("!")) { - reverseValue = true; - propValue = propValue.substring(1); - } - - // we have a value, so it has to match the system value... - boolean result = propValue.equals(sysValue); - - if (reverseValue) { - return !result; - } else { - return result; - } - } else { - boolean result = sysValue != null && !sysValue.isEmpty(); - - if (reverseName) { - return !result; - } else { - return result; - } - } - } - - return false; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java deleted file mode 100644 index e2d6928edb80..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Repository; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelSource; -import org.apache.maven.model.building.UrlModelSource; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.profiles.ProfileManager; -import org.apache.maven.properties.internal.EnvironmentUtils; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.wagon.events.TransferListener; - -/** - */ -@Deprecated -@Named -@Singleton -public class DefaultMavenProjectBuilder implements MavenProjectBuilder { - - @Inject - private ProjectBuilder projectBuilder; - - @Inject - private RepositorySystem repositorySystem; - - @Inject - private LegacySupport legacySupport; - - // ---------------------------------------------------------------------- - // MavenProjectBuilder Implementation - // ---------------------------------------------------------------------- - - private ProjectBuildingRequest toRequest(ProjectBuilderConfiguration configuration) { - DefaultProjectBuildingRequest request = new DefaultProjectBuildingRequest(); - - request.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0); - request.setResolveDependencies(false); - - request.setLocalRepository(configuration.getLocalRepository()); - request.setBuildStartTime(configuration.getBuildStartTime()); - request.setUserProperties(configuration.getUserProperties()); - request.setSystemProperties(configuration.getExecutionProperties()); - - ProfileManager profileManager = configuration.getGlobalProfileManager(); - if (profileManager != null) { - request.setActiveProfileIds(profileManager.getExplicitlyActivatedIds()); - request.setInactiveProfileIds(profileManager.getExplicitlyDeactivatedIds()); - } else { - /* - * MNG-4900: Hack to workaround deficiency of legacy API which makes it impossible for plugins to access the - * global profile manager which is required to build a POM like a CLI invocation does. Failure to consider - * the activated profiles can cause repo declarations to be lost which in turn will result in artifact - * resolution failures, in particular when using the enhanced local repo which guards access to local files - * based on the configured remote repos. - */ - MavenSession session = legacySupport.getSession(); - if (session != null) { - MavenExecutionRequest req = session.getRequest(); - if (req != null) { - request.setActiveProfileIds(req.getActiveProfiles()); - request.setInactiveProfileIds(req.getInactiveProfiles()); - } - } - } - - return request; - } - - private ProjectBuildingRequest injectSession(ProjectBuildingRequest request) { - MavenSession session = legacySupport.getSession(); - if (session != null) { - request.setRepositorySession(session.getRepositorySession()); - request.setSystemProperties(session.getSystemProperties()); - if (request.getUserProperties().isEmpty()) { - request.setUserProperties(session.getUserProperties()); - } - - MavenExecutionRequest req = session.getRequest(); - if (req != null) { - request.setRemoteRepositories(req.getRemoteRepositories()); - } - } else { - Properties props = new Properties(); - EnvironmentUtils.addEnvVars(props); - props.putAll(System.getProperties()); - request.setSystemProperties(props); - } - - return request; - } - - @SuppressWarnings("unchecked") - private List normalizeToArtifactRepositories( - List repositories, ProjectBuildingRequest request) throws ProjectBuildingException { - /* - * This provides backward-compat with 2.x that allowed plugins like the maven-remote-resources-plugin:1.0 to - * populate the builder configuration with model repositories instead of artifact repositories. - */ - - if (repositories != null) { - boolean normalized = false; - - List repos = new ArrayList<>(repositories.size()); - - for (Object repository : repositories) { - if (repository instanceof Repository) { - try { - ArtifactRepository repo = repositorySystem.buildArtifactRepository((Repository) repository); - repositorySystem.injectMirror(request.getRepositorySession(), Arrays.asList(repo)); - repositorySystem.injectProxy(request.getRepositorySession(), Arrays.asList(repo)); - repositorySystem.injectAuthentication(request.getRepositorySession(), Arrays.asList(repo)); - repos.add(repo); - } catch (InvalidRepositoryException e) { - throw new ProjectBuildingException("", "Invalid remote repository " + repository, e); - } - normalized = true; - } else { - repos.add((ArtifactRepository) repository); - } - } - - if (normalized) { - return repos; - } - } - - return (List) repositories; - } - - private ProjectBuildingException transformError(ProjectBuildingException e) { - if (e.getCause() instanceof ModelBuildingException) { - return new InvalidProjectModelException(e.getProjectId(), e.getMessage(), e.getPomFile()); - } - - return e; - } - - public MavenProject build(File pom, ProjectBuilderConfiguration configuration) throws ProjectBuildingException { - ProjectBuildingRequest request = injectSession(toRequest(configuration)); - - try { - return projectBuilder.build(pom, request).getProject(); - } catch (ProjectBuildingException e) { - throw transformError(e); - } - } - - // This is used by the SITE plugin. - public MavenProject build(File pom, ArtifactRepository localRepository, ProfileManager profileManager) - throws ProjectBuildingException { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository(localRepository); - configuration.setGlobalProfileManager(profileManager); - - return build(pom, configuration); - } - - public MavenProject buildFromRepository( - Artifact artifact, - List remoteRepositories, - ProjectBuilderConfiguration configuration, - boolean allowStubModel) - throws ProjectBuildingException { - ProjectBuildingRequest request = injectSession(toRequest(configuration)); - request.setRemoteRepositories(normalizeToArtifactRepositories(remoteRepositories, request)); - request.setProcessPlugins(false); - request.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); - - try { - return projectBuilder.build(artifact, allowStubModel, request).getProject(); - } catch (ProjectBuildingException e) { - throw transformError(e); - } - } - - public MavenProject buildFromRepository( - Artifact artifact, - List remoteRepositories, - ArtifactRepository localRepository, - boolean allowStubModel) - throws ProjectBuildingException { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository(localRepository); - - return buildFromRepository(artifact, remoteRepositories, configuration, allowStubModel); - } - - public MavenProject buildFromRepository( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ProjectBuildingException { - return buildFromRepository(artifact, remoteRepositories, localRepository, true); - } - - /** - * This is used for pom-less execution like running archetype:generate. I am taking out the profile handling and the - * interpolation of the base directory until we spec this out properly. - */ - public MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration configuration) - throws ProjectBuildingException { - ProjectBuildingRequest request = injectSession(toRequest(configuration)); - request.setProcessPlugins(false); - request.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); - - ModelSource modelSource = new UrlModelSource(getClass().getResource("standalone.xml")); - - MavenProject project = projectBuilder.build(modelSource, request).getProject(); - project.setExecutionRoot(true); - return project; - } - - public MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository) - throws ProjectBuildingException { - return buildStandaloneSuperProject(localRepository, null); - } - - public MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository, ProfileManager profileManager) - throws ProjectBuildingException { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository(localRepository); - configuration.setGlobalProfileManager(profileManager); - - return buildStandaloneSuperProject(configuration); - } - - public MavenProject buildWithDependencies( - File pom, - ArtifactRepository localRepository, - ProfileManager profileManager, - TransferListener transferListener) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException { - ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration(); - configuration.setLocalRepository(localRepository); - configuration.setGlobalProfileManager(profileManager); - - ProjectBuildingRequest request = injectSession(toRequest(configuration)); - - request.setResolveDependencies(true); - - try { - return projectBuilder.build(pom, request).getProject(); - } catch (ProjectBuildingException e) { - throw transformError(e); - } - } - - public MavenProject buildWithDependencies( - File pom, ArtifactRepository localRepository, ProfileManager profileManager) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException { - return buildWithDependencies(pom, localRepository, profileManager, null); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java b/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java deleted file mode 100644 index e19fdec547a0..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.Date; -import java.util.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.profiles.ProfileManager; - -/** - * DefaultProjectBuilderConfiguration - */ -@Deprecated -public class DefaultProjectBuilderConfiguration implements ProjectBuilderConfiguration { - - private ProfileManager globalProfileManager; - - private ArtifactRepository localRepository; - - private Properties userProperties; - - private Properties executionProperties = System.getProperties(); - - private Date buildStartTime; - - public DefaultProjectBuilderConfiguration() {} - - public ProjectBuilderConfiguration setGlobalProfileManager(ProfileManager globalProfileManager) { - this.globalProfileManager = globalProfileManager; - return this; - } - - public ProfileManager getGlobalProfileManager() { - return globalProfileManager; - } - - public ProjectBuilderConfiguration setLocalRepository(ArtifactRepository localRepository) { - this.localRepository = localRepository; - return this; - } - - public ArtifactRepository getLocalRepository() { - return localRepository; - } - - public ProjectBuilderConfiguration setUserProperties(Properties userProperties) { - this.userProperties = userProperties; - return this; - } - - public Properties getUserProperties() { - if (userProperties == null) { - userProperties = new Properties(); - } - - return userProperties; - } - - public Properties getExecutionProperties() { - return executionProperties; - } - - public ProjectBuilderConfiguration setExecutionProperties(Properties executionProperties) { - this.executionProperties = executionProperties; - return this; - } - - public Date getBuildStartTime() { - return buildStartTime; - } - - public ProjectBuilderConfiguration setBuildStartTime(Date buildStartTime) { - this.buildStartTime = buildStartTime; - return this; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java b/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java deleted file mode 100644 index 1b9e98fb3acf..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.io.File; - -import org.apache.maven.project.validation.ModelValidationResult; - -/** - * InvalidProjectModelException - */ -@Deprecated -public class InvalidProjectModelException extends ProjectBuildingException { - private ModelValidationResult validationResult; - - public InvalidProjectModelException(String projectId, String message, File pomLocation) { - super(projectId, message, pomLocation); - } - - /** - * @param projectId - * @param pomLocation absolute path of the pom file - * @param message - * @param validationResult - * @deprecated use {@link File} constructor for pomLocation - */ - @Deprecated - public InvalidProjectModelException( - String projectId, String pomLocation, String message, ModelValidationResult validationResult) { - this(projectId, message, new File(pomLocation), validationResult); - } - - public InvalidProjectModelException( - String projectId, String message, File pomFile, ModelValidationResult validationResult) { - super(projectId, message, pomFile); - - this.validationResult = validationResult; - } - - /** - * @param projectId - * @param pomLocation absolute path of the pom file - * @param message - * @deprecated use {@link File} constructor for pomLocation - */ - @Deprecated - public InvalidProjectModelException(String projectId, String pomLocation, String message) { - this(projectId, message, new File(pomLocation)); - } - - public final ModelValidationResult getValidationResult() { - return validationResult; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java b/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java deleted file mode 100644 index c471a5c95bc1..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.io.File; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.profiles.ProfileManager; -import org.apache.maven.wagon.events.TransferListener; - -/** - * @deprecated use {@link ProjectBuilder} instead - */ -@Deprecated -public interface MavenProjectBuilder { - - MavenProject build(File pom, ProjectBuilderConfiguration configuration) throws ProjectBuildingException; - - // TODO maven-site-plugin -- not used by the plugin directly, but used by Doxia Integration Tool & MPIR - // see DOXIASITETOOLS-167 & MPIR-349 - MavenProject build(File pom, ArtifactRepository localRepository, ProfileManager profileManager) - throws ProjectBuildingException; - - // TODO remote-resources-plugin - MavenProject buildFromRepository( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ProjectBuildingException; - - // TODO remote-resources-plugin - MavenProject buildFromRepository( - Artifact artifact, - List remoteRepositories, - ArtifactRepository localRepository, - boolean allowStubModel) - throws ProjectBuildingException; - - // TODO this is only to provide a project for plugins that don't need a project to execute but need some - // of the values from a MavenProject. Ideally this should be something internal and nothing outside Maven - // would ever need this so it should not be exposed in a public API - MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration configuration) throws ProjectBuildingException; - - MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository) throws ProjectBuildingException; - - MavenProject buildStandaloneSuperProject(ArtifactRepository localRepository, ProfileManager profileManager) - throws ProjectBuildingException; - - MavenProject buildWithDependencies( - File pom, - ArtifactRepository localRepository, - ProfileManager globalProfileManager, - TransferListener transferListener) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException; - - MavenProject buildWithDependencies( - File pom, ArtifactRepository localRepository, ProfileManager globalProfileManager) - throws ProjectBuildingException, ArtifactResolutionException, ArtifactNotFoundException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java b/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java deleted file mode 100644 index d3a1246ecef0..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import org.apache.maven.artifact.InvalidRepositoryException; - -/** - * Error constructing an artifact repository. - */ -@Deprecated -public class MissingRepositoryElementException extends InvalidRepositoryException { - - public MissingRepositoryElementException(String message, String repositoryId) { - super(message, repositoryId); - } - - public MissingRepositoryElementException(String message) { - super(message, "-unknown-"); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java b/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java deleted file mode 100644 index baf054a48a2a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.List; - -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginContainer; - -/** @deprecated */ -@Deprecated -public final class ModelUtils { - - /** - * This should be the resulting ordering of plugins after merging: - *

- * Given: - *

-     * parent: X -> A -> B -> D -> E
-     * child: Y -> A -> C -> D -> F
-     * 
- * Result: - *
-     * X -> Y -> A -> B -> C -> D -> E -> F
-     * 
- */ - public static void mergePluginLists( - PluginContainer childContainer, PluginContainer parentContainer, boolean handleAsInheritance) { - throw new UnsupportedOperationException(); - } - - public static List orderAfterMerge( - List merged, List highPrioritySource, List lowPrioritySource) { - throw new UnsupportedOperationException(); - } - - public static void mergePluginDefinitions(Plugin child, Plugin parent, boolean handleAsInheritance) { - throw new UnsupportedOperationException(); - } - - public static void mergeFilterLists(List childFilters, List parentFilters) { - throw new UnsupportedOperationException(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java b/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java deleted file mode 100644 index e4b98e12194e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.Date; -import java.util.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.profiles.ProfileManager; - -/** - * @deprecated use {@link ProjectBuildingRequest} instead - */ -@Deprecated -public interface ProjectBuilderConfiguration { - - ArtifactRepository getLocalRepository(); - - ProfileManager getGlobalProfileManager(); - - Properties getUserProperties(); - - Properties getExecutionProperties(); - - ProjectBuilderConfiguration setGlobalProfileManager(ProfileManager globalProfileManager); - - ProjectBuilderConfiguration setLocalRepository(ArtifactRepository localRepository); - - ProjectBuilderConfiguration setUserProperties(Properties userProperties); - - ProjectBuilderConfiguration setExecutionProperties(Properties executionProperties); - - Date getBuildStartTime(); - - ProjectBuilderConfiguration setBuildStartTime(Date buildStartTime); -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java b/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java deleted file mode 100644 index 15c2158856d2..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.model.DeploymentRepository; -import org.apache.maven.model.Repository; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.eclipse.aether.RepositorySystemSession; - -// This class needs to stick around because it was exposed the remote resources plugin started using it instead of -// getting the repositories from the project. - -/** - * ProjectUtils - */ -@Deprecated -public final class ProjectUtils { - - private ProjectUtils() {} - - public static List buildArtifactRepositories( - List repositories, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c) - throws InvalidRepositoryException { - - List remoteRepositories = new ArrayList<>(); - - for (Repository r : repositories) { - remoteRepositories.add(buildArtifactRepository(r, artifactRepositoryFactory, c)); - } - - return remoteRepositories; - } - - public static ArtifactRepository buildDeploymentArtifactRepository( - DeploymentRepository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c) - throws InvalidRepositoryException { - return buildArtifactRepository(repo, artifactRepositoryFactory, c); - } - - public static ArtifactRepository buildArtifactRepository( - Repository repo, ArtifactRepositoryFactory artifactRepositoryFactory, PlexusContainer c) - throws InvalidRepositoryException { - RepositorySystem repositorySystem = rs(c); - RepositorySystemSession session = rss(c); - - ArtifactRepository repository = repositorySystem.buildArtifactRepository(repo); - - if (session != null) { - repositorySystem.injectMirror(session, Arrays.asList(repository)); - repositorySystem.injectProxy(session, Arrays.asList(repository)); - repositorySystem.injectAuthentication(session, Arrays.asList(repository)); - } - - return repository; - } - - private static RepositorySystem rs(PlexusContainer c) { - try { - return c.lookup(RepositorySystem.class); - } catch (ComponentLookupException e) { - throw new IllegalStateException(e); - } - } - - private static RepositorySystemSession rss(PlexusContainer c) { - try { - LegacySupport legacySupport = c.lookup(LegacySupport.class); - - return legacySupport.getRepositorySession(); - } catch (ComponentLookupException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java deleted file mode 100644 index 8e7bfd16465b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/ActiveProjectArtifact.java +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import java.io.File; -import java.util.Collection; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.project.MavenProject; - -/** - * Wraps an active project instance to be able to receive updates from its artifact without affecting the original - * attributes of this artifact. - * - * TODO I think this exposes a design flaw in that the immutable and mutable parts of an artifact are in one class and - * should be split. ie scope, file, etc depend on the context of use, whereas everything else is immutable. - */ -@Deprecated -public class ActiveProjectArtifact implements Artifact { - private final Artifact artifact; - - private final MavenProject project; - - public ActiveProjectArtifact(MavenProject project, Artifact artifact) { - this.artifact = artifact; - this.project = project; - - artifact.setFile(project.getArtifact().getFile()); - artifact.setResolved(true); - } - - /** {@inheritDoc} */ - public File getFile() { - // we need to get the latest file for the project, not the artifact that was created at one point in time - return project.getArtifact().getFile(); - } - - /** {@inheritDoc} */ - public String getGroupId() { - return artifact.getGroupId(); - } - - /** {@inheritDoc} */ - public String getArtifactId() { - return artifact.getArtifactId(); - } - - /** {@inheritDoc} */ - public String getVersion() { - return artifact.getVersion(); - } - - /** {@inheritDoc} */ - public void setVersion(String version) { - artifact.setVersion(version); - } - - /** {@inheritDoc} */ - public String getScope() { - return artifact.getScope(); - } - - /** {@inheritDoc} */ - public String getType() { - return artifact.getType(); - } - - /** {@inheritDoc} */ - public String getClassifier() { - return artifact.getClassifier(); - } - - /** {@inheritDoc} */ - public boolean hasClassifier() { - return artifact.hasClassifier(); - } - - /** {@inheritDoc} */ - public void setFile(File destination) { - artifact.setFile(destination); - project.getArtifact().setFile(destination); - } - - /** {@inheritDoc} */ - public String getBaseVersion() { - return artifact.getBaseVersion(); - } - - /** {@inheritDoc} */ - public void setBaseVersion(String baseVersion) { - artifact.setBaseVersion(baseVersion); - } - - /** {@inheritDoc} */ - public String getId() { - return artifact.getId(); - } - - /** {@inheritDoc} */ - public String getDependencyConflictId() { - return artifact.getDependencyConflictId(); - } - - /** {@inheritDoc} */ - public void addMetadata(ArtifactMetadata metadata) { - artifact.addMetadata(metadata); - } - - /** {@inheritDoc} */ - public Collection getMetadataList() { - return artifact.getMetadataList(); - } - - /** {@inheritDoc} */ - public void setRepository(ArtifactRepository remoteRepository) { - artifact.setRepository(remoteRepository); - } - - /** {@inheritDoc} */ - public ArtifactRepository getRepository() { - return artifact.getRepository(); - } - - /** {@inheritDoc} */ - public void updateVersion(String version, ArtifactRepository localRepository) { - artifact.updateVersion(version, localRepository); - } - - /** {@inheritDoc} */ - public String getDownloadUrl() { - return artifact.getDownloadUrl(); - } - - /** {@inheritDoc} */ - public void setDownloadUrl(String downloadUrl) { - artifact.setDownloadUrl(downloadUrl); - } - - /** {@inheritDoc} */ - public ArtifactFilter getDependencyFilter() { - return artifact.getDependencyFilter(); - } - - /** {@inheritDoc} */ - public void setDependencyFilter(ArtifactFilter artifactFilter) { - artifact.setDependencyFilter(artifactFilter); - } - - /** {@inheritDoc} */ - public ArtifactHandler getArtifactHandler() { - return artifact.getArtifactHandler(); - } - - /** {@inheritDoc} */ - public List getDependencyTrail() { - return artifact.getDependencyTrail(); - } - - /** {@inheritDoc} */ - public void setDependencyTrail(List dependencyTrail) { - artifact.setDependencyTrail(dependencyTrail); - } - - /** {@inheritDoc} */ - public void setScope(String scope) { - artifact.setScope(scope); - } - - /** {@inheritDoc} */ - public VersionRange getVersionRange() { - return artifact.getVersionRange(); - } - - /** {@inheritDoc} */ - public void setVersionRange(VersionRange newRange) { - artifact.setVersionRange(newRange); - } - - /** {@inheritDoc} */ - public void selectVersion(String version) { - artifact.selectVersion(version); - } - - /** {@inheritDoc} */ - public void setGroupId(String groupId) { - artifact.setGroupId(groupId); - } - - /** {@inheritDoc} */ - public void setArtifactId(String artifactId) { - artifact.setArtifactId(artifactId); - } - - /** {@inheritDoc} */ - public boolean isSnapshot() { - return artifact.isSnapshot(); - } - - /** {@inheritDoc} */ - public int compareTo(Artifact a) { - return artifact.compareTo(a); - } - - /** {@inheritDoc} */ - public void setResolved(boolean resolved) { - artifact.setResolved(resolved); - } - - /** {@inheritDoc} */ - public boolean isResolved() { - return artifact.isResolved(); - } - - /** {@inheritDoc} */ - public void setResolvedVersion(String version) { - artifact.setResolvedVersion(version); - } - - /** {@inheritDoc} */ - public void setArtifactHandler(ArtifactHandler handler) { - artifact.setArtifactHandler(handler); - } - - /** {@inheritDoc} */ - public String toString() { - return "active project artifact[artifact: " + artifact + ", project: " + project + "]"; - } - - /** {@inheritDoc} */ - public boolean isRelease() { - return artifact.isRelease(); - } - - /** {@inheritDoc} */ - public void setRelease(boolean release) { - artifact.setRelease(release); - } - - /** {@inheritDoc} */ - public List getAvailableVersions() { - return artifact.getAvailableVersions(); - } - - /** {@inheritDoc} */ - public void setAvailableVersions(List versions) { - artifact.setAvailableVersions(versions); - } - - /** {@inheritDoc} */ - public boolean isOptional() { - return artifact.isOptional(); - } - - /** {@inheritDoc} */ - public ArtifactVersion getSelectedVersion() throws OverConstrainedVersionException { - return artifact.getSelectedVersion(); - } - - /** {@inheritDoc} */ - public boolean isSelectedVersionKnown() throws OverConstrainedVersionException { - return artifact.isSelectedVersionKnown(); - } - - /** {@inheritDoc} */ - public void setOptional(boolean optional) { - artifact.setOptional(optional); - } - - /** {@inheritDoc} */ - public int hashCode() { - int result = 17; - - result = 37 * result + getGroupId().hashCode(); - result = 37 * result + getArtifactId().hashCode(); - result = 37 * result + getType().hashCode(); - if (getVersion() != null) { - result = 37 * result + getVersion().hashCode(); - } - result = 37 * result + (getClassifier() != null ? getClassifier().hashCode() : 0); - - return result; - } - - /** {@inheritDoc} */ - public boolean equals(Object o) { - if (o == this) { - return true; - } - - if (!(o instanceof Artifact)) { - return false; - } - - Artifact a = (Artifact) o; - - if (!a.getGroupId().equals(getGroupId())) { - return false; - } else if (!a.getArtifactId().equals(getArtifactId())) { - return false; - } else if (!a.getVersion().equals(getVersion())) { - return false; - } else if (!a.getType().equals(getType())) { - return false; - } else { - return a.getClassifier() == null - ? getClassifier() == null - : a.getClassifier().equals(getClassifier()); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java deleted file mode 100644 index 48c889cd9899..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; - -/** - * DefaultMavenMetadataCache - */ -@Named -@Singleton -@Deprecated -public class DefaultMavenMetadataCache implements MavenMetadataCache { - - protected final Map cache = new ConcurrentHashMap<>(); - - /** - * CacheKey - */ - public static class CacheKey { - private final Artifact artifact; - private final long pomHash; - private final boolean resolveManagedVersions; - private final List repositories = new ArrayList<>(); - private final int hashCode; - - public CacheKey( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories) { - File file = artifact.getFile(); - this.artifact = ArtifactUtils.copyArtifact(artifact); - if ("pom".equals(artifact.getType()) && file != null) { - pomHash = file.getPath().hashCode() + file.lastModified(); - } else { - pomHash = 0; - } - this.resolveManagedVersions = resolveManagedVersions; - this.repositories.add(localRepository); - this.repositories.addAll(remoteRepositories); - - int hash = 17; - hash = hash * 31 + artifactHashCode(artifact); - hash = hash * 31 + (resolveManagedVersions ? 1 : 2); - hash = hash * 31 + repositoriesHashCode(repositories); - this.hashCode = hash; - } - - @Override - public int hashCode() { - return hashCode; - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - - if (!(o instanceof CacheKey)) { - return false; - } - - CacheKey other = (CacheKey) o; - - return pomHash == other.pomHash - && artifactEquals(artifact, other.artifact) - && resolveManagedVersions == other.resolveManagedVersions - && repositoriesEquals(repositories, other.repositories); - } - } - - private static int artifactHashCode(Artifact a) { - int result = 17; - result = 31 * result + a.getGroupId().hashCode(); - result = 31 * result + a.getArtifactId().hashCode(); - result = 31 * result + a.getType().hashCode(); - if (a.getVersion() != null) { - result = 31 * result + a.getVersion().hashCode(); - } - result = 31 * result + (a.getClassifier() != null ? a.getClassifier().hashCode() : 0); - result = 31 * result + (a.getScope() != null ? a.getScope().hashCode() : 0); - result = 31 * result - + (a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0); - result = 31 * result + (a.isOptional() ? 1 : 0); - return result; - } - - private static boolean artifactEquals(Artifact a1, Artifact a2) { - if (a1 == a2) { - return true; - } - - return Objects.equals(a1.getGroupId(), a2.getGroupId()) - && Objects.equals(a1.getArtifactId(), a2.getArtifactId()) - && Objects.equals(a1.getType(), a2.getType()) - && Objects.equals(a1.getVersion(), a2.getVersion()) - && Objects.equals(a1.getClassifier(), a2.getClassifier()) - && Objects.equals(a1.getScope(), a2.getScope()) - && Objects.equals(a1.getDependencyFilter(), a2.getDependencyFilter()) - && a1.isOptional() == a2.isOptional(); - } - - private static int repositoryHashCode(ArtifactRepository repository) { - int result = 17; - result = 31 * result + (repository.getId() != null ? repository.getId().hashCode() : 0); - return result; - } - - private static int repositoriesHashCode(List repositories) { - int result = 17; - for (ArtifactRepository repository : repositories) { - result = 31 * result + repositoryHashCode(repository); - } - return result; - } - - private static boolean repositoryEquals(ArtifactRepository r1, ArtifactRepository r2) { - if (r1 == r2) { - return true; - } - - return Objects.equals(r1.getId(), r2.getId()) - && Objects.equals(r1.getUrl(), r2.getUrl()) - && repositoryPolicyEquals(r1.getReleases(), r2.getReleases()) - && repositoryPolicyEquals(r1.getSnapshots(), r2.getSnapshots()); - } - - private static boolean repositoryPolicyEquals(ArtifactRepositoryPolicy p1, ArtifactRepositoryPolicy p2) { - if (p1 == p2) { - return true; - } - - return p1.isEnabled() == p2.isEnabled() && Objects.equals(p1.getUpdatePolicy(), p2.getUpdatePolicy()); - } - - private static boolean repositoriesEquals(List r1, List r2) { - if (r1.size() != r2.size()) { - return false; - } - - for (Iterator it1 = r1.iterator(), it2 = r2.iterator(); it1.hasNext(); ) { - if (!repositoryEquals(it1.next(), it2.next())) { - return false; - } - } - - return true; - } - - /** - * CacheRecord - */ - public class CacheRecord { - private Artifact pomArtifact; - private Artifact relocatedArtifact; - private List artifacts; - private Map managedVersions; - private List remoteRepositories; - - private long length; - private long timestamp; - - CacheRecord( - Artifact pomArtifact, - Artifact relocatedArtifact, - Set artifacts, - Map managedVersions, - List remoteRepositories) { - this.pomArtifact = ArtifactUtils.copyArtifact(pomArtifact); - this.relocatedArtifact = ArtifactUtils.copyArtifactSafe(relocatedArtifact); - this.artifacts = ArtifactUtils.copyArtifacts(artifacts, new ArrayList<>()); - this.remoteRepositories = new ArrayList<>(remoteRepositories); - - this.managedVersions = managedVersions; - if (managedVersions != null) { - this.managedVersions = ArtifactUtils.copyArtifacts(managedVersions, new LinkedHashMap<>()); - } - - File pomFile = pomArtifact.getFile(); - if (pomFile != null && pomFile.canRead()) { - this.length = pomFile.length(); - this.timestamp = pomFile.lastModified(); - } else { - this.length = -1; - this.timestamp = -1; - } - } - - public Artifact getArtifact() { - return pomArtifact; - } - - public Artifact getRelocatedArtifact() { - return relocatedArtifact; - } - - public List getArtifacts() { - return artifacts; - } - - public Map getManagedVersions() { - return managedVersions; - } - - public List getRemoteRepositories() { - return remoteRepositories; - } - - public boolean isStale() { - File pomFile = pomArtifact.getFile(); - if (pomFile != null) { - if (pomFile.canRead()) { - return length != pomFile.length() || timestamp != pomFile.lastModified(); - } else { - // if the POM didn't exist, retry if any repo is configured to always update - boolean snapshot = pomArtifact.isSnapshot(); - for (ArtifactRepository repository : remoteRepositories) { - ArtifactRepositoryPolicy policy = - snapshot ? repository.getSnapshots() : repository.getReleases(); - if (ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS.equals(policy.getUpdatePolicy())) { - return true; - } - } - } - } - - return length != -1 || timestamp != -1; - } - } - - public ResolutionGroup get( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories) { - CacheKey cacheKey = newCacheKey(artifact, resolveManagedVersions, localRepository, remoteRepositories); - - CacheRecord cacheRecord = cache.get(cacheKey); - - if (cacheRecord != null && !cacheRecord.isStale()) { - Artifact pomArtifact = ArtifactUtils.copyArtifact(cacheRecord.getArtifact()); - Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe(cacheRecord.getRelocatedArtifact()); - Set artifacts = ArtifactUtils.copyArtifacts(cacheRecord.getArtifacts(), new LinkedHashSet<>()); - Map managedVersions = cacheRecord.getManagedVersions(); - if (managedVersions != null) { - managedVersions = ArtifactUtils.copyArtifacts(managedVersions, new LinkedHashMap<>()); - } - return new ResolutionGroup( - pomArtifact, relocatedArtifact, artifacts, managedVersions, cacheRecord.getRemoteRepositories()); - } - - cache.remove(cacheKey); - - return null; - } - - public void put( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ResolutionGroup result) { - put(newCacheKey(artifact, resolveManagedVersions, localRepository, remoteRepositories), result); - } - - protected CacheKey newCacheKey( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories) { - return new CacheKey(artifact, resolveManagedVersions, localRepository, remoteRepositories); - } - - protected void put(CacheKey cacheKey, ResolutionGroup result) { - CacheRecord cacheRecord = new CacheRecord( - result.getPomArtifact(), - result.getRelocatedArtifact(), - result.getArtifacts(), - result.getManagedVersions(), - result.getResolutionRepositories()); - - cache.put(cacheKey, cacheRecord); - } - - public void flush() { - cache.clear(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java deleted file mode 100644 index 723352f697c5..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/DefaultMetadataSource.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.ProjectBuilder; - -/** - * This realizes the metadata source via the default hint to provide backward-compat with Maven 2.x whose Plexus version - * registered component descriptors twice: once keyed by role+roleHint and once keyed by role only. This effectively - * made the metadata source available with its original role hint ("maven") as well as the default hint. - * - */ -@Named -@Singleton -@Deprecated -public class DefaultMetadataSource extends MavenMetadataSource { - @Inject - public DefaultMetadataSource( - RepositoryMetadataManager repositoryMetadataManager, - ArtifactFactory artifactFactory, - ProjectBuilder projectBuilder, - MavenMetadataCache cache, - LegacySupport legacySupport, - MavenRepositorySystem mavenRepositorySystem) { - super(repositoryMetadataManager, artifactFactory, projectBuilder, cache, legacySupport, mavenRepositorySystem); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java deleted file mode 100644 index bafc22cb8944..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataCache.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * MavenMetadataCache - */ -@Deprecated -public interface MavenMetadataCache { - - ResolutionGroup get( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories); - - void put( - Artifact artifact, - boolean resolveManagedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ResolutionGroup result); - - void flush(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java deleted file mode 100644 index 4240cecba57b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/MavenMetadataSource.java +++ /dev/null @@ -1,712 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExclusionArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.model.DistributionManagement; -import org.apache.maven.model.Model; -import org.apache.maven.model.Relocation; -import org.apache.maven.model.Repository; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.resolution.UnresolvableModelException; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.DefaultProjectBuildingRequest; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuilder; -import org.apache.maven.project.ProjectBuildingException; -import org.apache.maven.project.ProjectBuildingRequest; -import org.apache.maven.properties.internal.EnvironmentUtils; -import org.apache.maven.properties.internal.SystemProperties; -import org.apache.maven.repository.internal.MavenWorkspaceReader; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.RepositoryPolicy; -import org.eclipse.aether.repository.WorkspaceReader; -import org.eclipse.aether.transfer.ArtifactNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - */ -@Named("maven") -@Singleton -@Deprecated -public class MavenMetadataSource implements ArtifactMetadataSource { - private final Logger logger = LoggerFactory.getLogger(getClass()); - private final RepositoryMetadataManager repositoryMetadataManager; - private final ArtifactFactory artifactFactory; - private final ProjectBuilder projectBuilder; - private final MavenMetadataCache cache; - private final LegacySupport legacySupport; - - private MavenRepositorySystem mavenRepositorySystem; - - @Inject - public MavenMetadataSource( - RepositoryMetadataManager repositoryMetadataManager, - ArtifactFactory artifactFactory, - ProjectBuilder projectBuilder, - MavenMetadataCache cache, - LegacySupport legacySupport, - MavenRepositorySystem mavenRepositorySystem) { - this.repositoryMetadataManager = repositoryMetadataManager; - this.artifactFactory = artifactFactory; - this.projectBuilder = projectBuilder; - this.cache = cache; - this.legacySupport = legacySupport; - this.mavenRepositorySystem = mavenRepositorySystem; - } - - private void injectSession(MetadataResolutionRequest request) { - RepositorySystemSession session = legacySupport.getRepositorySession(); - - if (session != null) { - request.setOffline(session.isOffline()); - request.setForceUpdate(RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals(session.getUpdatePolicy())); - } - } - - @Override - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - return retrieve(artifact, localRepository, remoteRepositories, false); - } - - public ResolutionGroup retrieve( - Artifact artifact, - ArtifactRepository localRepository, - List remoteRepositories, - boolean resolveManagedVersions) - throws ArtifactMetadataRetrievalException { - MetadataResolutionRequest request = new DefaultMetadataResolutionRequest(); - injectSession(request); - request.setArtifact(artifact); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - request.setResolveManagedVersions(resolveManagedVersions); - return retrieve(request); - } - - @Override - public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException { - Artifact artifact = request.getArtifact(); - - // - // If we have a system scoped artifact then we do not want any searching in local or remote repositories - // and we want artifact resolution to only return the system scoped artifact itself. - // - if (artifact.getScope() != null && artifact.getScope().equals(Artifact.SCOPE_SYSTEM)) { - return new ResolutionGroup(null, null, null); - } - - ResolutionGroup cached = cache.get( - artifact, - request.isResolveManagedVersions(), - request.getLocalRepository(), - request.getRemoteRepositories()); - - if (cached != null - // if the POM has no file, we cached a missing artifact, only return the cached data if no update forced - && (!request.isForceUpdate() || hasFile(cached.getPomArtifact()))) { - return cached; - } - - List dependencies; - - List managedDependencies = null; - - List pomRepositories = null; - - Artifact pomArtifact; - - Artifact relocatedArtifact = null; - - // TODO hack: don't rebuild model if it was already loaded during reactor resolution - RepositorySystemSession repositorySession = legacySupport.getRepositorySession(); - final WorkspaceReader workspace = repositorySession.getWorkspaceReader(); - Model model; - if (workspace instanceof MavenWorkspaceReader) { - model = ((MavenWorkspaceReader) workspace).findModel(RepositoryUtils.toArtifact(artifact)); - } else { - model = null; - } - - if (model != null) { - pomArtifact = artifact; - dependencies = model.getDependencies(); - DependencyManagement dependencyManagement = model.getDependencyManagement(); - managedDependencies = dependencyManagement == null ? null : dependencyManagement.getDependencies(); - MavenSession session = legacySupport.getSession(); - if (session != null) { - pomRepositories = session.getProjects().stream() - .filter(p -> artifact.equals(p.getArtifact())) - .map(MavenProject::getRemoteArtifactRepositories) - .findFirst() - .orElseGet(() -> getRepositoriesFromModel(repositorySession, model)); - } else { - pomRepositories = new ArrayList<>(); - } - } else if (artifact instanceof ArtifactWithDependencies) { - pomArtifact = artifact; - - dependencies = ((ArtifactWithDependencies) artifact).getDependencies(); - - managedDependencies = ((ArtifactWithDependencies) artifact).getManagedDependencies(); - } else { - ProjectRelocation rel = retrieveRelocatedProject(artifact, request); - - if (rel == null) { - return null; - } - - pomArtifact = rel.pomArtifact; - - relocatedArtifact = rel.relocatedArtifact; - - if (rel.project == null) { - // When this happens we have a Maven 1.x POM, or some invalid POM. - // It should have never found its way into Maven 2.x repository but it did. - dependencies = Collections.emptyList(); - } else { - dependencies = rel.project.getModel().getDependencies(); - - DependencyManagement depMgmt = rel.project.getModel().getDependencyManagement(); - managedDependencies = (depMgmt != null) ? depMgmt.getDependencies() : null; - - pomRepositories = rel.project.getRemoteArtifactRepositories(); - } - } - - Set artifacts = Collections.emptySet(); - - if (!artifact.getArtifactHandler().isIncludesDependencies()) { - artifacts = new LinkedHashSet<>(); - - for (Dependency dependency : dependencies) { - Artifact dependencyArtifact = createDependencyArtifact(dependency, artifact, pomArtifact); - - if (dependencyArtifact != null) { - artifacts.add(dependencyArtifact); - } - } - } - - Map managedVersions = null; - - if (managedDependencies != null && request.isResolveManagedVersions()) { - managedVersions = new HashMap<>(); - - for (Dependency managedDependency : managedDependencies) { - Artifact managedArtifact = createDependencyArtifact(managedDependency, null, pomArtifact); - - managedVersions.put(managedDependency.getManagementKey(), managedArtifact); - } - } - - List aggregatedRepositories = - aggregateRepositories(request.getRemoteRepositories(), pomRepositories); - - ResolutionGroup result = - new ResolutionGroup(pomArtifact, relocatedArtifact, artifacts, managedVersions, aggregatedRepositories); - - cache.put( - artifact, - request.isResolveManagedVersions(), - request.getLocalRepository(), - request.getRemoteRepositories(), - result); - - return result; - } - - private List getRepositoriesFromModel(RepositorySystemSession repositorySession, Model model) { - List pomRepositories = new ArrayList<>(); - for (Repository modelRepository : model.getRepositories()) { - try { - pomRepositories.add(MavenRepositorySystem.buildArtifactRepository(modelRepository)); - } catch (InvalidRepositoryException e) { - // can not use this then - } - } - mavenRepositorySystem.injectMirror(repositorySession, pomRepositories); - mavenRepositorySystem.injectProxy(repositorySession, pomRepositories); - mavenRepositorySystem.injectAuthentication(repositorySession, pomRepositories); - return pomRepositories; - } - - private boolean hasFile(Artifact artifact) { - return artifact != null - && artifact.getFile() != null - && artifact.getFile().exists(); - } - - private List aggregateRepositories( - List requestRepositories, List pomRepositories) { - List repositories = requestRepositories; - - if (pomRepositories != null && !pomRepositories.isEmpty()) { - Map repos = new LinkedHashMap<>(); - - for (ArtifactRepository repo : requestRepositories) { - if (!repos.containsKey(repo.getId())) { - repos.put(repo.getId(), repo); - } - } - - for (ArtifactRepository repo : pomRepositories) { - if (!repos.containsKey(repo.getId())) { - repos.put(repo.getId(), repo); - } - } - - repositories = new ArrayList<>(repos.values()); - } - - return repositories; - } - - private Artifact createDependencyArtifact(Dependency dependency, Artifact owner, Artifact pom) - throws ArtifactMetadataRetrievalException { - try { - String inheritedScope = (owner != null) ? owner.getScope() : null; - - ArtifactFilter inheritedFilter = (owner != null) ? owner.getDependencyFilter() : null; - - return createDependencyArtifact(artifactFactory, dependency, inheritedScope, inheritedFilter); - } catch (InvalidVersionSpecificationException e) { - throw new ArtifactMetadataRetrievalException( - "Invalid version for dependency " + dependency.getManagementKey() + ": " + e.getMessage(), e, pom); - } - } - - private static Artifact createDependencyArtifact( - ArtifactFactory factory, Dependency dependency, String inheritedScope, ArtifactFilter inheritedFilter) - throws InvalidVersionSpecificationException { - String effectiveScope = getEffectiveScope(dependency.getScope(), inheritedScope); - - if (effectiveScope == null) { - return null; - } - - VersionRange versionRange = VersionRange.createFromVersionSpec(dependency.getVersion()); - - Artifact dependencyArtifact = factory.createDependencyArtifact( - dependency.getGroupId(), - dependency.getArtifactId(), - versionRange, - dependency.getType(), - dependency.getClassifier(), - effectiveScope, - dependency.isOptional()); - - if (inheritedFilter != null && !inheritedFilter.include(dependencyArtifact)) { - return null; - } - - if (Artifact.SCOPE_SYSTEM.equals(effectiveScope)) { - dependencyArtifact.setFile(new File(dependency.getSystemPath())); - } - - dependencyArtifact.setDependencyFilter(createDependencyFilter(dependency, inheritedFilter)); - - return dependencyArtifact; - } - - private static String getEffectiveScope(String originalScope, String inheritedScope) { - String effectiveScope = Artifact.SCOPE_RUNTIME; - - if (originalScope == null) { - originalScope = Artifact.SCOPE_COMPILE; - } - - if (inheritedScope == null) { - // direct dependency retains its scope - effectiveScope = originalScope; - } else if (Artifact.SCOPE_TEST.equals(originalScope) || Artifact.SCOPE_PROVIDED.equals(originalScope)) { - // test and provided are not transitive, so exclude them - effectiveScope = null; - } else if (Artifact.SCOPE_SYSTEM.equals(originalScope)) { - // system scope come through unchanged... - effectiveScope = Artifact.SCOPE_SYSTEM; - } else if (Artifact.SCOPE_COMPILE.equals(originalScope) && Artifact.SCOPE_COMPILE.equals(inheritedScope)) { - // added to retain compile scope. Remove if you want compile inherited as runtime - effectiveScope = Artifact.SCOPE_COMPILE; - } else if (Artifact.SCOPE_TEST.equals(inheritedScope)) { - effectiveScope = Artifact.SCOPE_TEST; - } else if (Artifact.SCOPE_PROVIDED.equals(inheritedScope)) { - effectiveScope = Artifact.SCOPE_PROVIDED; - } - - return effectiveScope; - } - - private static ArtifactFilter createDependencyFilter(Dependency dependency, ArtifactFilter inheritedFilter) { - ArtifactFilter effectiveFilter = inheritedFilter; - - if (!dependency.getExclusions().isEmpty()) { - effectiveFilter = new ExclusionArtifactFilter(dependency.getExclusions()); - - if (inheritedFilter != null) { - effectiveFilter = new AndArtifactFilter(Arrays.asList(inheritedFilter, effectiveFilter)); - } - } - - return effectiveFilter; - } - - @Override - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - MetadataResolutionRequest request = new DefaultMetadataResolutionRequest(); - injectSession(request); - request.setArtifact(artifact); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - return retrieveAvailableVersions(request); - } - - @Override - public List retrieveAvailableVersions(MetadataResolutionRequest request) - throws ArtifactMetadataRetrievalException { - RepositoryMetadata metadata = new ArtifactRepositoryMetadata(request.getArtifact()); - - try { - repositoryMetadataManager.resolve(metadata, request); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactMetadataRetrievalException(e.getMessage(), e, request.getArtifact()); - } - - List availableVersions = request.getLocalRepository().findVersions(request.getArtifact()); - - return retrieveAvailableVersionsFromMetadata(metadata.getMetadata(), availableVersions); - } - - @Override - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository deploymentRepository) - throws ArtifactMetadataRetrievalException { - RepositoryMetadata metadata = new ArtifactRepositoryMetadata(artifact); - - try { - repositoryMetadataManager.resolveAlways(metadata, localRepository, deploymentRepository); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactMetadataRetrievalException(e.getMessage(), e, artifact); - } - - List availableVersions = localRepository.findVersions(artifact); - - return retrieveAvailableVersionsFromMetadata(metadata.getMetadata(), availableVersions); - } - - private List retrieveAvailableVersionsFromMetadata( - Metadata repoMetadata, List availableVersions) { - Collection versions = new LinkedHashSet<>(); - - if ((repoMetadata != null) && (repoMetadata.getVersioning() != null)) { - versions.addAll(repoMetadata.getVersioning().getVersions()); - } - - versions.addAll(availableVersions); - - List artifactVersions = new ArrayList<>(versions.size()); - - for (String version : versions) { - artifactVersions.add(new DefaultArtifactVersion(version)); - } - - return artifactVersions; - } - - // USED BY MAVEN ASSEMBLY PLUGIN - @Deprecated - public static Set createArtifacts( - ArtifactFactory artifactFactory, - List dependencies, - String inheritedScope, - ArtifactFilter dependencyFilter, - MavenProject project) - throws InvalidDependencyVersionException { - Set artifacts = new LinkedHashSet<>(); - - for (Dependency d : dependencies) { - Artifact dependencyArtifact; - try { - dependencyArtifact = createDependencyArtifact(artifactFactory, d, inheritedScope, dependencyFilter); - } catch (InvalidVersionSpecificationException e) { - throw new InvalidDependencyVersionException(project.getId(), d, project.getFile(), e); - } - - if (dependencyArtifact != null) { - artifacts.add(dependencyArtifact); - } - } - - return artifacts; - } - - @SuppressWarnings("checkstyle:methodlength") - private ProjectRelocation retrieveRelocatedProject(Artifact artifact, MetadataResolutionRequest repositoryRequest) - throws ArtifactMetadataRetrievalException { - MavenProject project; - - Artifact pomArtifact; - Artifact relocatedArtifact = null; - boolean done = false; - do { - project = null; - - pomArtifact = artifactFactory.createProjectArtifact( - artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope()); - - if ("pom".equals(artifact.getType())) { - pomArtifact.setFile(artifact.getFile()); - } - - if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) { - done = true; - } else { - try { - ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); - configuration.setLocalRepository(repositoryRequest.getLocalRepository()); - configuration.setRemoteRepositories(repositoryRequest.getRemoteRepositories()); - configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL); - configuration.setProcessPlugins(false); - configuration.setRepositoryMerging(ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT); - MavenSession session = legacySupport.getSession(); - if (session != null) { - configuration.setSystemProperties(session.getSystemProperties()); - configuration.setUserProperties(session.getUserProperties()); - } else { - configuration.setSystemProperties(getSystemProperties()); - configuration.setUserProperties(new Properties()); - } - configuration.setRepositorySession(legacySupport.getRepositorySession()); - - project = projectBuilder.build(pomArtifact, configuration).getProject(); - } catch (ProjectBuildingException e) { - ModelProblem missingParentPom = hasMissingParentPom(e); - if (missingParentPom != null) { - throw new ArtifactMetadataRetrievalException( - "Failed to process POM for " + artifact.getId() + ": " + missingParentPom.getMessage(), - missingParentPom.getException(), - artifact); - } - - String message; - - if (isMissingPom(e)) { - message = "Missing POM for " + artifact.getId(); - } else if (isNonTransferablePom(e)) { - throw new ArtifactMetadataRetrievalException( - "Failed to retrieve POM for " + artifact.getId() + ": " - + e.getCause().getMessage(), - e.getCause(), - artifact); - } else { - message = "Invalid POM for " + artifact.getId() - + ", transitive dependencies (if any) will not be available" - + ", enable verbose output (-X) for more details"; - } - - if (logger.isDebugEnabled()) { - message += ": " + e.getMessage(); - } - - logger.warn(message); - } - - if (project != null) { - Relocation relocation = null; - - DistributionManagement distMgmt = project.getModel().getDistributionManagement(); - if (distMgmt != null) { - relocation = distMgmt.getRelocation(); - - artifact.setDownloadUrl(distMgmt.getDownloadUrl()); - pomArtifact.setDownloadUrl(distMgmt.getDownloadUrl()); - } - - if (relocation != null) { - if (relocation.getGroupId() != null) { - artifact.setGroupId(relocation.getGroupId()); - relocatedArtifact = artifact; - project.setGroupId(relocation.getGroupId()); - } - if (relocation.getArtifactId() != null) { - artifact.setArtifactId(relocation.getArtifactId()); - relocatedArtifact = artifact; - project.setArtifactId(relocation.getArtifactId()); - } - if (relocation.getVersion() != null) { - // note: see MNG-3454. This causes a problem, but fixing it may break more. - artifact.setVersionRange(VersionRange.createFromVersion(relocation.getVersion())); - relocatedArtifact = artifact; - project.setVersion(relocation.getVersion()); - } - - if (artifact.getDependencyFilter() != null - && !artifact.getDependencyFilter().include(artifact)) { - return null; - } - - // MNG-2861: the artifact data has changed. If the available versions where previously - // retrieved, we need to update it. - // TODO shouldn't the versions be merged across relocations? - List available = artifact.getAvailableVersions(); - if (available != null && !available.isEmpty()) { - MetadataResolutionRequest metadataRequest = - new DefaultMetadataResolutionRequest(repositoryRequest); - metadataRequest.setArtifact(artifact); - available = retrieveAvailableVersions(metadataRequest); - artifact.setAvailableVersions(available); - } - - String message = " this artifact has been relocated to " + artifact.getGroupId() + ":" - + artifact.getArtifactId() + ":" + artifact.getVersion() + "."; - - if (relocation.getMessage() != null) { - message += " " + relocation.getMessage(); - } - - if (artifact.getDependencyTrail() != null - && artifact.getDependencyTrail().size() == 1) { - logger.warn( - "While downloading {}:{}:{}{}", - pomArtifact.getGroupId(), - pomArtifact.getArtifactId(), - pomArtifact.getVersion(), - message); - } else { - logger.debug( - "While downloading {}:{}:{}{}", - pomArtifact.getGroupId(), - pomArtifact.getArtifactId(), - pomArtifact.getVersion(), - message); - } - } else { - done = true; - } - } else { - done = true; - } - } - } while (!done); - - ProjectRelocation rel = new ProjectRelocation(); - rel.project = project; - rel.pomArtifact = pomArtifact; - rel.relocatedArtifact = relocatedArtifact; - - return rel; - } - - private ModelProblem hasMissingParentPom(ProjectBuildingException e) { - if (e.getCause() instanceof ModelBuildingException) { - ModelBuildingException mbe = (ModelBuildingException) e.getCause(); - for (ModelProblem problem : mbe.getProblems()) { - if (problem.getException() instanceof UnresolvableModelException) { - return problem; - } - } - } - return null; - } - - private boolean isMissingPom(Exception e) { - if (e.getCause() instanceof MultipleArtifactsNotFoundException) { - return true; - } - return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException - && e.getCause().getCause() instanceof ArtifactNotFoundException; - } - - private boolean isNonTransferablePom(Exception e) { - if (e.getCause() instanceof ArtifactResolutionException) { - return true; - } - return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException - && !(e.getCause().getCause() instanceof ArtifactNotFoundException); - } - - private Properties getSystemProperties() { - Properties props = new Properties(); - - EnvironmentUtils.addEnvVars(props); - - SystemProperties.addSystemProperties(props); - - return props; - } - - private static final class ProjectRelocation { - private MavenProject project; - - private Artifact pomArtifact; - - private Artifact relocatedArtifact; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java deleted file mode 100644 index 3cdd8a2546e2..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/artifact/ProjectArtifactMetadata.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.AbstractArtifactMetadata; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException; - -/** - * Attach a POM to an artifact. - * - */ -@Deprecated -public class ProjectArtifactMetadata extends AbstractArtifactMetadata { - private final File file; - - public ProjectArtifactMetadata(Artifact artifact) { - this(artifact, null); - } - - public ProjectArtifactMetadata(Artifact artifact, File file) { - super(artifact); - this.file = file; - } - - public File getFile() { - return file; - } - - public String getRemoteFilename() { - return getFilename(); - } - - public String getLocalFilename(ArtifactRepository repository) { - return getFilename(); - } - - private String getFilename() { - return getArtifactId() + "-" + artifact.getVersion() + ".pom"; - } - - public void storeInLocalRepository(ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataStoreException { - File destination = new File( - localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata(this, remoteRepository)); - - // ---------------------------------------------------------------------------- - // I'm fully aware that the file could just be moved using File.rename but - // there are bugs in various JVM that have problems doing this across - // different filesystem. So we'll incur the small hit to actually copy - // here and be safe. jvz. - // ---------------------------------------------------------------------------- - - try { - Files.createDirectories(destination.toPath().getParent()); - Files.copy(file.toPath(), destination.toPath()); - } catch (IOException e) { - throw new RepositoryMetadataStoreException("Error copying POM to the local repository.", e); - } - } - - public String toString() { - return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion(); - } - - public boolean storedInArtifactVersionDirectory() { - return true; - } - - public String getBaseVersion() { - return artifact.getBaseVersion(); - } - - public Object getKey() { - return "project " + artifact.getGroupId() + ":" + artifact.getArtifactId(); - } - - public void merge(ArtifactMetadata metadata) { - ProjectArtifactMetadata m = (ProjectArtifactMetadata) metadata; - if (!m.file.equals(file)) { - throw new IllegalStateException("Cannot add two different pieces of metadata for: " + getKey()); - } - } - - public void merge(org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata) { - this.merge((ArtifactMetadata) metadata); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java deleted file mode 100644 index c265dc0042ed..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.model.Build; -import org.apache.maven.model.Model; - -/** - * DefaultModelInheritanceAssembler - */ -@Named -@Singleton -@Deprecated -public class DefaultModelInheritanceAssembler implements ModelInheritanceAssembler { - @Override - public void assembleModelInheritance(Model child, Model parent, String childPathAdjustment) { - throw new UnsupportedOperationException(); - } - - @Override - public void assembleModelInheritance(Model child, Model parent) { - throw new UnsupportedOperationException(); - } - - @Override - public void assembleBuildInheritance(Build childBuild, Build parentBuild, boolean handleAsInheritance) { - throw new UnsupportedOperationException(); - } - - @Override - public void copyModel(Model dest, Model source) { - throw new UnsupportedOperationException(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java b/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java deleted file mode 100644 index df0fc5ab4288..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance; - -import org.apache.maven.model.Build; -import org.apache.maven.model.Model; - -/** - */ -@Deprecated -public interface ModelInheritanceAssembler { - String ROLE = ModelInheritanceAssembler.class.getName(); - - void assembleModelInheritance(Model child, Model parent, String childPathAdjustment); - - void assembleModelInheritance(Model child, Model parent); - - void assembleBuildInheritance(Build childBuild, Build parentBuild, boolean handleAsInheritance); - - void copyModel(Model dest, Model source); -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java deleted file mode 100644 index 0570d20a0471..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import javax.inject.Inject; -import javax.xml.stream.XMLStreamException; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.maven.model.Model; -import org.apache.maven.model.v4.MavenStaxReader; -import org.apache.maven.model.v4.MavenStaxWriter; -import org.apache.maven.project.DefaultProjectBuilderConfiguration; -import org.apache.maven.project.ProjectBuilderConfiguration; -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.AbstractValueSource; -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.MapBasedValueSource; -import org.codehaus.plexus.interpolation.ObjectBasedValueSource; -import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor; -import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; -import org.codehaus.plexus.interpolation.PrefixedValueSourceWrapper; -import org.codehaus.plexus.interpolation.RecursionInterceptor; -import org.codehaus.plexus.interpolation.ValueSource; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; - -/** - * Use a regular expression search to find and resolve expressions within the POM. - * - * TODO Consolidate this logic with the PluginParameterExpressionEvaluator, minus deprecations/bans. - */ -@Deprecated -public abstract class AbstractStringBasedModelInterpolator extends AbstractLogEnabled - implements ModelInterpolator, Initializable { - - private static final List PROJECT_PREFIXES = Arrays.asList("pom.", "project."); - - private static final List TRANSLATED_PATH_EXPRESSIONS; - - static { - List translatedPrefixes = new ArrayList<>(); - - // MNG-1927, MNG-2124, MNG-3355: - // If the build section is present and the project directory is non-null, we should make - // sure interpolation of the directories below uses translated paths. - // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the - // code below... - translatedPrefixes.add("build.directory"); - translatedPrefixes.add("build.outputDirectory"); - translatedPrefixes.add("build.testOutputDirectory"); - translatedPrefixes.add("build.sourceDirectory"); - translatedPrefixes.add("build.testSourceDirectory"); - translatedPrefixes.add("build.scriptSourceDirectory"); - translatedPrefixes.add("reporting.outputDirectory"); - - TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes; - } - - @Inject - private PathTranslator pathTranslator; - - private Interpolator interpolator; - - private RecursionInterceptor recursionInterceptor; - - // for testing. - protected AbstractStringBasedModelInterpolator(PathTranslator pathTranslator) { - this.pathTranslator = pathTranslator; - } - - protected AbstractStringBasedModelInterpolator() {} - - public Model interpolate(Model model, Map context) throws ModelInterpolationException { - return interpolate(model, context, true); - } - - /** - * Serialize the inbound Model instance to a StringWriter, perform the regex replacement to resolve - * POM expressions, then re-parse into the resolved Model instance. - *

- * NOTE: This will result in a different instance of Model being returned!!! - * - * @param model The inbound Model instance, to serialize and reference for expression resolution - * @param context The other context map to be used during resolution - * - * @return The resolved instance of the inbound Model. This is a different instance! - * - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - @Deprecated - public Model interpolate(Model model, Map context, boolean strict) throws ModelInterpolationException { - Properties props = new Properties(); - props.putAll(context); - - return interpolate(model, null, new DefaultProjectBuilderConfiguration().setExecutionProperties(props), true); - } - - public Model interpolate(Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled) - throws ModelInterpolationException { - StringWriter sWriter = new StringWriter(1024); - - MavenStaxWriter writer = new MavenStaxWriter(); - try { - writer.write(sWriter, model.getDelegate()); - } catch (IOException | XMLStreamException e) { - throw new ModelInterpolationException("Cannot serialize project model for interpolation.", e); - } - - String serializedModel = sWriter.toString(); - serializedModel = interpolate(serializedModel, model, projectDir, config, debugEnabled); - - StringReader sReader = new StringReader(serializedModel); - - MavenStaxReader modelReader = new MavenStaxReader(); - try { - model = new Model(modelReader.read(sReader)); - } catch (XMLStreamException e) { - throw new ModelInterpolationException( - "Cannot read project model from interpolating filter of serialized version.", e); - } - - return model; - } - - /** - * Interpolates all expressions in the src parameter. - *

- * The algorithm used for each expression is: - *

    - *
  • If it starts with either "pom." or "project.", the expression is evaluated against the model.
  • - *
  • If the value is null, get the value from the context.
  • - *
  • If the value is null, but the context contains the expression, don't replace the expression string - * with the value, and continue to find other expressions.
  • - *
  • If the value is null, get it from the model properties.
  • - *
- */ - public String interpolate( - String src, Model model, final File projectDir, ProjectBuilderConfiguration config, boolean debug) - throws ModelInterpolationException { - try { - List valueSources = createValueSources(model, projectDir, config); - List postProcessors = createPostProcessors(model, projectDir, config); - - return interpolateInternal(src, valueSources, postProcessors, debug); - } finally { - interpolator.clearAnswers(); - } - } - - protected List createValueSources( - final Model model, final File projectDir, final ProjectBuilderConfiguration config) { - String timestampFormat = DEFAULT_BUILD_TIMESTAMP_FORMAT; - - Properties modelProperties = model.getProperties(); - if (modelProperties != null) { - timestampFormat = modelProperties.getProperty(BUILD_TIMESTAMP_FORMAT_PROPERTY, timestampFormat); - } - - ValueSource modelValueSource1 = new PrefixedObjectValueSource(PROJECT_PREFIXES, model, false); - ValueSource modelValueSource2 = new ObjectBasedValueSource(model); - - ValueSource basedirValueSource = new PrefixedValueSourceWrapper( - new AbstractValueSource(false) { - - public Object getValue(String expression) { - if (projectDir != null && "basedir".equals(expression)) { - return projectDir.getAbsolutePath(); - } - return null; - } - }, - PROJECT_PREFIXES, - true); - ValueSource baseUriValueSource = new PrefixedValueSourceWrapper( - new AbstractValueSource(false) { - - public Object getValue(String expression) { - if (projectDir != null && "baseUri".equals(expression)) { - return projectDir.getAbsoluteFile().toPath().toUri().toASCIIString(); - } - return null; - } - }, - PROJECT_PREFIXES, - false); - - List valueSources = new ArrayList<>(9); - - // NOTE: Order counts here! - valueSources.add(basedirValueSource); - valueSources.add(baseUriValueSource); - valueSources.add(new BuildTimestampValueSource(config.getBuildStartTime(), timestampFormat)); - valueSources.add(modelValueSource1); - valueSources.add(new MapBasedValueSource(config.getUserProperties())); - valueSources.add(new MapBasedValueSource(modelProperties)); - valueSources.add(new MapBasedValueSource(config.getExecutionProperties())); - valueSources.add(new AbstractValueSource(false) { - - public Object getValue(String expression) { - return config.getExecutionProperties().getProperty("env." + expression); - } - }); - valueSources.add(modelValueSource2); - - return valueSources; - } - - protected List createPostProcessors( - final Model model, final File projectDir, final ProjectBuilderConfiguration config) { - return Collections.singletonList((InterpolationPostProcessor) new PathTranslatingPostProcessor( - PROJECT_PREFIXES, TRANSLATED_PATH_EXPRESSIONS, projectDir, pathTranslator)); - } - - @SuppressWarnings("unchecked") - protected String interpolateInternal( - String src, List valueSources, List postProcessors, boolean debug) - throws ModelInterpolationException { - if (!src.contains("${")) { - return src; - } - - Logger logger = getLogger(); - - String result = src; - synchronized (this) { - for (ValueSource vs : valueSources) { - interpolator.addValueSource(vs); - } - - for (InterpolationPostProcessor postProcessor : postProcessors) { - interpolator.addPostProcessor(postProcessor); - } - - try { - try { - result = interpolator.interpolate(result, recursionInterceptor); - } catch (InterpolationException e) { - throw new ModelInterpolationException(e.getMessage(), e); - } - - if (debug) { - List feedback = interpolator.getFeedback(); - if (feedback != null && !feedback.isEmpty()) { - logger.debug("Maven encountered the following problems during initial POM interpolation:"); - - Object last = null; - for (Object next : feedback) { - if (next instanceof Throwable) { - if (last == null) { - logger.debug("", ((Throwable) next)); - } else { - logger.debug(String.valueOf(last), ((Throwable) next)); - } - } else { - if (last != null) { - logger.debug(String.valueOf(last)); - } - - last = next; - } - } - - if (last != null) { - logger.debug(String.valueOf(last)); - } - } - } - - interpolator.clearFeedback(); - } finally { - for (ValueSource vs : valueSources) { - interpolator.removeValuesSource(vs); - } - - for (InterpolationPostProcessor postProcessor : postProcessors) { - interpolator.removePostProcessor(postProcessor); - } - } - } - - return result; - } - - protected RecursionInterceptor getRecursionInterceptor() { - return recursionInterceptor; - } - - protected void setRecursionInterceptor(RecursionInterceptor recursionInterceptor) { - this.recursionInterceptor = recursionInterceptor; - } - - protected abstract Interpolator createInterpolator(); - - public void initialize() throws InitializationException { - interpolator = createInterpolator(); - recursionInterceptor = new PrefixAwareRecursionInterceptor(PROJECT_PREFIXES); - } - - protected final Interpolator getInterpolator() { - return interpolator; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java deleted file mode 100644 index f2af8036aed5..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.codehaus.plexus.interpolation.AbstractValueSource; - -/** - * - */ -@Deprecated -public class BuildTimestampValueSource extends AbstractValueSource { - - private final Date startTime; - - private final String format; - - private String formattedDate; - - public BuildTimestampValueSource(Date startTime, String format) { - super(false); - this.startTime = startTime; - this.format = format; - } - - public Object getValue(String expression) { - if ("build.timestamp".equals(expression) || "maven.build.timestamp".equals(expression)) { - if (formattedDate == null && startTime != null) { - formattedDate = new SimpleDateFormat(format).format(startTime); - } - - return formattedDate; - } - - return null; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java deleted file mode 100644 index 9200a094bf88..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -/** - */ -@SuppressWarnings("serial") -@Deprecated -public class ModelInterpolationException extends Exception { - private String expression; - - private String originalMessage; - - public ModelInterpolationException(String message) { - super(message); - } - - public ModelInterpolationException(String message, Throwable cause) { - super(message, cause); - } - - public ModelInterpolationException(String expression, String message, Throwable cause) { - super("The POM expression: " + expression + " could not be evaluated. Reason: " + message, cause); - - this.expression = expression; - this.originalMessage = message; - } - - public ModelInterpolationException(String expression, String message) { - super("The POM expression: " + expression + " could not be evaluated. Reason: " + message); - - this.expression = expression; - this.originalMessage = message; - } - - public String getExpression() { - return expression; - } - - public String getOriginalMessage() { - return originalMessage; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java deleted file mode 100644 index 42d4f1240741..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import java.io.File; -import java.util.Map; - -import org.apache.maven.model.Model; -import org.apache.maven.project.ProjectBuilderConfiguration; - -/** - */ -@Deprecated -public interface ModelInterpolator { - String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyyMMdd-HHmm"; - - String BUILD_TIMESTAMP_FORMAT_PROPERTY = "maven.build.timestamp.format"; - - String ROLE = ModelInterpolator.class.getName(); - - /** - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - @Deprecated - Model interpolate(Model project, Map context) throws ModelInterpolationException; - - /** - * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. - */ - @Deprecated - Model interpolate(Model model, Map context, boolean strict) throws ModelInterpolationException; - - Model interpolate(Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled) - throws ModelInterpolationException; - - String interpolate( - String src, Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled) - throws ModelInterpolationException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java deleted file mode 100644 index c6651fbf7d91..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import java.io.File; -import java.util.List; - -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.util.ValueSourceUtils; - -/** - * - */ -@Deprecated -public class PathTranslatingPostProcessor implements InterpolationPostProcessor { - - private final List unprefixedPathKeys; - private final File projectDir; - private final PathTranslator pathTranslator; - private final List expressionPrefixes; - - public PathTranslatingPostProcessor( - List expressionPrefixes, - List unprefixedPathKeys, - File projectDir, - PathTranslator pathTranslator) { - this.expressionPrefixes = expressionPrefixes; - this.unprefixedPathKeys = unprefixedPathKeys; - this.projectDir = projectDir; - this.pathTranslator = pathTranslator; - } - - public Object execute(String expression, Object value) { - expression = ValueSourceUtils.trimPrefix(expression, expressionPrefixes, true); - - if (projectDir != null && value != null && unprefixedPathKeys.contains(expression)) { - return pathTranslator.alignToBaseDirectory(String.valueOf(value), projectDir); - } - - return value; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java deleted file mode 100644 index f1dfe3f4adde..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import java.io.IOException; -import java.util.Properties; - -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.RegexBasedInterpolator; - -/** - * Use a regular expression search to find and resolve expressions within the POM. - * - * TODO Consolidate this logic with the PluginParameterExpressionEvaluator, minus deprecations/bans. - */ -@Deprecated -public class RegexBasedModelInterpolator extends AbstractStringBasedModelInterpolator { - - public RegexBasedModelInterpolator() throws IOException {} - - public RegexBasedModelInterpolator(PathTranslator pathTranslator) { - super(pathTranslator); - } - - public RegexBasedModelInterpolator(Properties envars) {} - - protected Interpolator createInterpolator() { - return new RegexBasedInterpolator(true); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java deleted file mode 100644 index d63cbec5c131..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.interpolation; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; - -import org.apache.maven.model.Model; -import org.apache.maven.project.ProjectBuilderConfiguration; -import org.apache.maven.project.path.PathTranslator; -import org.codehaus.plexus.interpolation.InterpolationPostProcessor; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.StringSearchInterpolator; -import org.codehaus.plexus.interpolation.ValueSource; -import org.codehaus.plexus.logging.Logger; - -/** - * StringSearchModelInterpolator - */ -@Deprecated -@Named -@Singleton -public class StringSearchModelInterpolator extends AbstractStringBasedModelInterpolator { - - private static final Map, Field[]> FIELDS_BY_CLASS = new WeakHashMap<>(); - private static final Map, Boolean> PRIMITIVE_BY_CLASS = new WeakHashMap<>(); - - public StringSearchModelInterpolator() {} - - public StringSearchModelInterpolator(PathTranslator pathTranslator) { - super(pathTranslator); - } - - public Model interpolate(Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled) - throws ModelInterpolationException { - interpolateObject(model, model, projectDir, config, debugEnabled); - - return model; - } - - protected void interpolateObject( - Object obj, Model model, File projectDir, ProjectBuilderConfiguration config, boolean debugEnabled) - throws ModelInterpolationException { - try { - List valueSources = createValueSources(model, projectDir, config); - List postProcessors = createPostProcessors(model, projectDir, config); - - InterpolateObjectAction action = - new InterpolateObjectAction(obj, valueSources, postProcessors, debugEnabled, this, getLogger()); - - ModelInterpolationException error = AccessController.doPrivileged(action); - - if (error != null) { - throw error; - } - } finally { - getInterpolator().clearAnswers(); - } - } - - protected Interpolator createInterpolator() { - StringSearchInterpolator interpolator = new StringSearchInterpolator(); - interpolator.setCacheAnswers(true); - - return interpolator; - } - - private static final class InterpolateObjectAction implements PrivilegedAction { - - private final boolean debugEnabled; - private final LinkedList interpolationTargets; - private final StringSearchModelInterpolator modelInterpolator; - private final Logger logger; - private final List valueSources; - private final List postProcessors; - - InterpolateObjectAction( - Object target, - List valueSources, - List postProcessors, - boolean debugEnabled, - StringSearchModelInterpolator modelInterpolator, - Logger logger) { - this.valueSources = valueSources; - this.postProcessors = postProcessors; - this.debugEnabled = debugEnabled; - - this.interpolationTargets = new LinkedList<>(); - interpolationTargets.add(target); - - this.modelInterpolator = modelInterpolator; - this.logger = logger; - } - - public ModelInterpolationException run() { - while (!interpolationTargets.isEmpty()) { - Object obj = interpolationTargets.removeFirst(); - - try { - traverseObjectWithParents(obj.getClass(), obj); - } catch (ModelInterpolationException e) { - return e; - } - } - - return null; - } - - @SuppressWarnings({"unchecked", "checkstyle:methodlength"}) - private void traverseObjectWithParents(Class cls, Object target) throws ModelInterpolationException { - if (cls == null) { - return; - } - - if (cls.isArray()) { - evaluateArray(target); - } else if (isQualifiedForInterpolation(cls)) { - Field[] fields = FIELDS_BY_CLASS.computeIfAbsent(cls, k -> cls.getDeclaredFields()); - - for (Field field : fields) { - Class type = field.getType(); - if (isQualifiedForInterpolation(field, type)) { - boolean isAccessible = field.isAccessible(); - field.setAccessible(true); - try { - try { - if (String.class == type) { - String value = (String) field.get(target); - if (value != null) { - String interpolated = modelInterpolator.interpolateInternal( - value, valueSources, postProcessors, debugEnabled); - - if (!interpolated.equals(value)) { - field.set(target, interpolated); - } - } - } else if (Collection.class.isAssignableFrom(type)) { - Collection c = (Collection) field.get(target); - if (c != null && !c.isEmpty()) { - List originalValues = new ArrayList<>(c); - try { - c.clear(); - } catch (UnsupportedOperationException e) { - if (debugEnabled && logger != null) { - logger.debug("Skipping interpolation of field: " + field + " in: " - + cls.getName() - + "; it is an unmodifiable collection."); - } - continue; - } - - for (Object value : originalValues) { - if (value != null) { - if (String.class == value.getClass()) { - String interpolated = modelInterpolator.interpolateInternal( - (String) value, valueSources, postProcessors, debugEnabled); - - if (!interpolated.equals(value)) { - c.add(interpolated); - } else { - c.add(value); - } - } else { - c.add(value); - if (value.getClass().isArray()) { - evaluateArray(value); - } else { - interpolationTargets.add(value); - } - } - } else { - // add the null back in...not sure what else to do... - c.add(value); - } - } - } - } else if (Map.class.isAssignableFrom(type)) { - Map m = (Map) field.get(target); - if (m != null && !m.isEmpty()) { - for (Map.Entry entry : m.entrySet()) { - Object value = entry.getValue(); - - if (value != null) { - if (String.class == value.getClass()) { - String interpolated = modelInterpolator.interpolateInternal( - (String) value, valueSources, postProcessors, debugEnabled); - - if (!interpolated.equals(value)) { - try { - entry.setValue(interpolated); - } catch (UnsupportedOperationException e) { - if (debugEnabled && logger != null) { - logger.debug("Skipping interpolation of field: " + field - + " (key: " + entry.getKey() + ") in: " - + cls.getName() - + "; it is an unmodifiable collection."); - } - } - } - } else { - if (value.getClass().isArray()) { - evaluateArray(value); - } else { - interpolationTargets.add(value); - } - } - } - } - } - } else { - Object value = field.get(target); - if (value != null) { - if (field.getType().isArray()) { - evaluateArray(value); - } else { - interpolationTargets.add(value); - } - } - } - } catch (IllegalArgumentException | IllegalAccessException e) { - throw new ModelInterpolationException( - "Failed to interpolate field: " + field + " on class: " + cls.getName(), e); - } - } finally { - field.setAccessible(isAccessible); - } - } - } - - traverseObjectWithParents(cls.getSuperclass(), target); - } - } - - private boolean isQualifiedForInterpolation(Class cls) { - return !cls.getPackage().getName().startsWith("java") - && !cls.getPackage().getName().startsWith("sun.nio.fs"); - } - - private boolean isQualifiedForInterpolation(Field field, Class fieldType) { - if (!PRIMITIVE_BY_CLASS.containsKey(fieldType)) { - PRIMITIVE_BY_CLASS.put(fieldType, fieldType.isPrimitive()); - } - - if (PRIMITIVE_BY_CLASS.get(fieldType)) { - return false; - } - - // if ( fieldType.isPrimitive() ) - // { - // return false; - // } - - return !"parent".equals(field.getName()); - } - - private void evaluateArray(Object target) throws ModelInterpolationException { - int len = Array.getLength(target); - for (int i = 0; i < len; i++) { - Object value = Array.get(target, i); - if (value != null) { - if (String.class == value.getClass()) { - String interpolated = modelInterpolator.interpolateInternal( - (String) value, valueSources, postProcessors, debugEnabled); - - if (!interpolated.equals(value)) { - Array.set(target, i, interpolated); - } - } else { - interpolationTargets.add(value); - } - } - } - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java b/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java deleted file mode 100644 index e08b2e24a41f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.path; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.model.Build; -import org.apache.maven.model.Model; -import org.apache.maven.model.Reporting; -import org.apache.maven.model.Resource; - -/** - * DefaultPathTranslator - */ -@Deprecated -@Named -@Singleton -public class DefaultPathTranslator implements PathTranslator { - private static final String[] BASEDIR_EXPRESSIONS = {"${basedir}", "${pom.basedir}", "${project.basedir}"}; - - public void alignToBaseDirectory(Model model, File basedir) { - if (basedir == null) { - return; - } - - Build build = model.getBuild(); - - if (build != null) { - build.setDirectory(alignToBaseDirectory(build.getDirectory(), basedir)); - - build.setSourceDirectory(alignToBaseDirectory(build.getSourceDirectory(), basedir)); - - build.setTestSourceDirectory(alignToBaseDirectory(build.getTestSourceDirectory(), basedir)); - - for (Resource resource : build.getResources()) { - resource.setDirectory(alignToBaseDirectory(resource.getDirectory(), basedir)); - } - - for (Resource resource : build.getTestResources()) { - resource.setDirectory(alignToBaseDirectory(resource.getDirectory(), basedir)); - } - - if (build.getFilters() != null) { - List filters = new ArrayList<>(); - for (String filter : build.getFilters()) { - filters.add(alignToBaseDirectory(filter, basedir)); - } - build.setFilters(filters); - } - - build.setOutputDirectory(alignToBaseDirectory(build.getOutputDirectory(), basedir)); - - build.setTestOutputDirectory(alignToBaseDirectory(build.getTestOutputDirectory(), basedir)); - } - - Reporting reporting = model.getReporting(); - - if (reporting != null) { - reporting.setOutputDirectory(alignToBaseDirectory(reporting.getOutputDirectory(), basedir)); - } - } - - public String alignToBaseDirectory(String path, File basedir) { - if (basedir == null) { - return path; - } - - if (path == null) { - return null; - } - - String s = stripBasedirToken(path); - - File file = new File(s); - if (file.isAbsolute()) { - // path was already absolute, just normalize file separator and we're done - s = file.getPath(); - } else if (file.getPath().startsWith(File.separator)) { - // drive-relative Windows path, don't align with project directory but with drive root - s = file.getAbsolutePath(); - } else { - // an ordinary relative path, align with project directory - s = new File(new File(basedir, s).toURI().normalize()).getAbsolutePath(); - } - - return s; - } - - private String stripBasedirToken(String s) { - if (s != null) { - String basedirExpr = null; - for (String expression : BASEDIR_EXPRESSIONS) { - if (s.startsWith(expression)) { - basedirExpr = expression; - break; - } - } - - if (basedirExpr != null) { - if (s.length() > basedirExpr.length()) { - // Take out basedir expression and the leading slash - s = chopLeadingFileSeparator(s.substring(basedirExpr.length())); - } else { - s = "."; - } - } - } - - return s; - } - - /** - * Removes the leading directory separator from the specified filesystem path (if any). For platform-independent - * behavior, this method accepts both the forward slash and the backward slash as separator. - * - * @param path The filesystem path, may be null. - * @return The altered filesystem path or null if the input path was null. - */ - private String chopLeadingFileSeparator(String path) { - if (path != null) { - if (path.startsWith("/") || path.startsWith("\\")) { - path = path.substring(1); - } - } - return path; - } - - public void unalignFromBaseDirectory(Model model, File basedir) { - if (basedir == null) { - return; - } - - Build build = model.getBuild(); - - if (build != null) { - build.setDirectory(unalignFromBaseDirectory(build.getDirectory(), basedir)); - - build.setSourceDirectory(unalignFromBaseDirectory(build.getSourceDirectory(), basedir)); - - build.setTestSourceDirectory(unalignFromBaseDirectory(build.getTestSourceDirectory(), basedir)); - - for (Resource resource : build.getResources()) { - resource.setDirectory(unalignFromBaseDirectory(resource.getDirectory(), basedir)); - } - - for (Resource resource : build.getTestResources()) { - resource.setDirectory(unalignFromBaseDirectory(resource.getDirectory(), basedir)); - } - - if (build.getFilters() != null) { - List filters = new ArrayList<>(); - for (String filter : build.getFilters()) { - filters.add(unalignFromBaseDirectory(filter, basedir)); - } - build.setFilters(filters); - } - - build.setOutputDirectory(unalignFromBaseDirectory(build.getOutputDirectory(), basedir)); - - build.setTestOutputDirectory(unalignFromBaseDirectory(build.getTestOutputDirectory(), basedir)); - } - - Reporting reporting = model.getReporting(); - - if (reporting != null) { - reporting.setOutputDirectory(unalignFromBaseDirectory(reporting.getOutputDirectory(), basedir)); - } - } - - public String unalignFromBaseDirectory(String path, File basedir) { - if (basedir == null) { - return path; - } - - if (path == null) { - return null; - } - - path = path.trim(); - - String base = basedir.getAbsolutePath(); - if (path.startsWith(base)) { - path = chopLeadingFileSeparator(path.substring(base.length())); - } - - if (path.isEmpty()) { - path = "."; - } - - if (!new File(path).isAbsolute()) { - path = path.replace('\\', '/'); - } - - return path; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/path/PathTranslator.java b/maven-compat/src/main/java/org/apache/maven/project/path/PathTranslator.java deleted file mode 100644 index c345412fd5b4..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/path/PathTranslator.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.path; - -import java.io.File; - -import org.apache.maven.model.Model; - -/** - */ -@Deprecated -public interface PathTranslator { - String ROLE = PathTranslator.class.getName(); - - void alignToBaseDirectory(Model model, File basedir); - - String alignToBaseDirectory(String path, File basedir); - - void unalignFromBaseDirectory(Model model, File basedir); - - String unalignFromBaseDirectory(String directory, File basedir); -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java deleted file mode 100644 index 180a49e22559..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.validation; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.model.Model; -import org.apache.maven.model.building.DefaultModelBuildingRequest; -import org.apache.maven.model.building.ModelBuildingRequest; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.model.building.ModelProblemCollector; -import org.apache.maven.model.building.ModelProblemCollectorRequest; - -/** - */ -@Deprecated -@Named -@Singleton -public class DefaultModelValidator implements ModelValidator { - - @Inject - private org.apache.maven.model.validation.ModelValidator modelValidator; - - public ModelValidationResult validate(Model model) { - ModelValidationResult result = new ModelValidationResult(); - - ModelBuildingRequest request = - new DefaultModelBuildingRequest().setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0); - - SimpleModelProblemCollector problems = new SimpleModelProblemCollector(result); - - modelValidator.validateEffectiveModel(model, request, problems); - - return result; - } - - private static class SimpleModelProblemCollector implements ModelProblemCollector { - - ModelValidationResult result; - - SimpleModelProblemCollector(ModelValidationResult result) { - this.result = result; - } - - public void add(ModelProblemCollectorRequest req) { - if (!ModelProblem.Severity.WARNING.equals(req.getSeverity())) { - result.addMessage(req.getMessage()); - } - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java b/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java deleted file mode 100644 index bc305cb2a0fb..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.validation; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - */ -@Deprecated -public class ModelValidationResult { - - /** */ - private static final String LS = System.lineSeparator(); - - /** */ - private List messages; - - public ModelValidationResult() { - messages = new ArrayList<>(); - } - - public int getMessageCount() { - return messages.size(); - } - - public String getMessage(int i) { - return messages.get(i); - } - - public List getMessages() { - return Collections.unmodifiableList(messages); - } - - public void addMessage(String message) { - messages.add(message); - } - - public String toString() { - return render(""); - } - - public String render(String indentation) { - if (messages.size() == 0) { - return indentation + "There were no validation errors."; - } - - StringBuilder message = new StringBuilder(); - - // if ( messages.size() == 1 ) - // { - // message.append( "There was 1 validation error: " ); - // } - // else - // { - // message.append( "There was " + messages.size() + " validation errors: " + LS ); - // } - // - for (int i = 0; i < messages.size(); i++) { - message.append(indentation) - .append('[') - .append(i) - .append("] ") - .append(messages.get(i)) - .append(LS); - } - - return message.toString(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java b/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java deleted file mode 100644 index a9bd44bf7946..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.validation; - -import org.apache.maven.model.Model; - -/** - * Checks the model for missing or invalid values. - * - */ -@Deprecated -public interface ModelValidator { - - String ROLE = ModelValidator.class.getName(); - - ModelValidationResult validate(Model model); -} diff --git a/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java b/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java deleted file mode 100644 index f6e1fbb351e7..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.reporting; - -/** - * An exception occurring during the execution of a Maven report. - * - */ -@Deprecated -public class MavenReportException extends Exception { - public MavenReportException(String msg) { - super(msg); - } - - public MavenReportException(String msg, Exception e) { - super(msg, e); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java deleted file mode 100644 index 5624e1d99d01..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactDoesNotExistException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -/** - * ArtifactDoesNotExistException - */ -@Deprecated -public class ArtifactDoesNotExistException extends Exception { - public ArtifactDoesNotExistException(final String message) { - super(message); - } - - public ArtifactDoesNotExistException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java deleted file mode 100644 index f6b70ffdf7da..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferEvent.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.io.File; -import java.util.EventObject; - -/** - * TransferEvent is used to notify TransferListeners about progress - * in transfer of resources form/to the repository - * - */ -@Deprecated -public class ArtifactTransferEvent extends EventObject { - /** - * A transfer was attempted, but has not yet commenced. - */ - public static final int TRANSFER_INITIATED = 0; - - /** - * A transfer was started. - */ - public static final int TRANSFER_STARTED = 1; - - /** - * A transfer is completed. - */ - public static final int TRANSFER_COMPLETED = 2; - - /** - * A transfer is in progress. - */ - public static final int TRANSFER_PROGRESS = 3; - - /** - * An error occurred during transfer - */ - public static final int TRANSFER_ERROR = 4; - - /** - * Indicates GET transfer (from the repository) - */ - public static final int REQUEST_GET = 5; - - /** - * Indicates PUT transfer (to the repository) - */ - public static final int REQUEST_PUT = 6; - - private int eventType; - - private int requestType; - - private Exception exception; - - private File localFile; - - private ArtifactTransferResource artifact; - - private long transferredBytes; - - private byte[] dataBuffer; - - private int dataOffset; - - private int dataLength; - - public ArtifactTransferEvent( - String wagon, final int eventType, final int requestType, ArtifactTransferResource artifact) { - super(wagon); - - setEventType(eventType); - - setRequestType(requestType); - - this.artifact = artifact; - } - - public ArtifactTransferEvent( - String wagon, final Exception exception, final int requestType, ArtifactTransferResource artifact) { - this(wagon, TRANSFER_ERROR, requestType, artifact); - - this.exception = exception; - } - - public ArtifactTransferResource getResource() { - return artifact; - } - - /** - * @return Returns the exception. - */ - public Exception getException() { - return exception; - } - - /** - * Returns the request type. - * - * @return Returns the request type. The Request type is one of - * TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT - */ - public int getRequestType() { - return requestType; - } - - /** - * Sets the request type - * - * @param requestType The requestType to set. - * The Request type value should be either - * TransferEvent.REQUEST_GET or TransferEvent.REQUEST_PUT. - * @throws IllegalArgumentException when - */ - public void setRequestType(final int requestType) { - switch (requestType) { - case REQUEST_PUT: - break; - case REQUEST_GET: - break; - default: - throw new IllegalArgumentException("Illegal request type: " + requestType); - } - - this.requestType = requestType; - } - - /** - * @return Returns the eventType. - */ - public int getEventType() { - return eventType; - } - - /** - * @param eventType The eventType to set. - */ - public void setEventType(final int eventType) { - switch (eventType) { - case TRANSFER_INITIATED: - break; - case TRANSFER_STARTED: - break; - case TRANSFER_COMPLETED: - break; - case TRANSFER_PROGRESS: - break; - case TRANSFER_ERROR: - break; - default: - throw new IllegalArgumentException("Illegal event type: " + eventType); - } - - this.eventType = eventType; - } - - /** - * @return Returns the local file. - */ - public File getLocalFile() { - return localFile; - } - - /** - * @param localFile The local file to set. - */ - public void setLocalFile(File localFile) { - this.localFile = localFile; - } - - public long getTransferredBytes() { - return transferredBytes; - } - - public void setTransferredBytes(long transferredBytes) { - this.transferredBytes = transferredBytes; - } - - public byte[] getDataBuffer() { - return dataBuffer; - } - - public void setDataBuffer(byte[] dataBuffer) { - this.dataBuffer = dataBuffer; - } - - public int getDataOffset() { - return dataOffset; - } - - public void setDataOffset(int dataOffset) { - this.dataOffset = dataOffset; - } - - public int getDataLength() { - return dataLength; - } - - public void setDataLength(int dataLength) { - this.dataLength = dataLength; - } - - public String toString() { - StringBuilder sb = new StringBuilder(64); - - sb.append("TransferEvent["); - - switch (this.getRequestType()) { - case REQUEST_GET: - sb.append("GET"); - break; - case REQUEST_PUT: - sb.append("PUT"); - break; - default: - sb.append(this.getRequestType()); - break; - } - - sb.append('|'); - switch (this.getEventType()) { - case TRANSFER_COMPLETED: - sb.append("COMPLETED"); - break; - case TRANSFER_ERROR: - sb.append("ERROR"); - break; - case TRANSFER_INITIATED: - sb.append("INITIATED"); - break; - case TRANSFER_PROGRESS: - sb.append("PROGRESS"); - break; - case TRANSFER_STARTED: - sb.append("STARTED"); - break; - default: - sb.append(this.getEventType()); - break; - } - - sb.append('|'); - sb.append(this.getLocalFile()).append('|'); - sb.append(']'); - - return sb.toString(); - } - - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + eventType; - result = prime * result + ((exception == null) ? 0 : exception.hashCode()); - result = prime * result + ((localFile == null) ? 0 : localFile.hashCode()); - result = prime * result + requestType; - return result; - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if ((obj == null) || (getClass() != obj.getClass())) { - return false; - } - final ArtifactTransferEvent other = (ArtifactTransferEvent) obj; - if (eventType != other.eventType) { - return false; - } - if (exception == null) { - if (other.exception != null) { - return false; - } - } else if (!exception.getClass().equals(other.exception.getClass())) { - return false; - } - if (requestType != other.requestType) { - return false; - } else { - return source.equals(other.source); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java deleted file mode 100644 index 530ec343a9b1..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferFailedException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -/** - * ArtifactTransferFailedException - */ -@Deprecated -public class ArtifactTransferFailedException extends Exception { - public ArtifactTransferFailedException(final String message) { - super(message); - } - - public ArtifactTransferFailedException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java deleted file mode 100644 index c2868815824c..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -/** - * ArtifactTransferListener - */ -@Deprecated -public interface ArtifactTransferListener { - boolean isShowChecksumEvents(); - - void setShowChecksumEvents(boolean showChecksumEvents); - - void transferInitiated(ArtifactTransferEvent transferEvent); - - void transferStarted(ArtifactTransferEvent transferEvent); - - void transferProgress(ArtifactTransferEvent transferEvent); - - void transferCompleted(ArtifactTransferEvent transferEvent); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java b/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java deleted file mode 100644 index 22aeba543877..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/ArtifactTransferResource.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -/** - * Describes a resource being uploaded or downloaded by the repository system. - * - */ -@Deprecated -public interface ArtifactTransferResource { - - /** - * The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be - * terminated by a trailing slash. - * - * @return The base URL of the repository or an empty string if unknown, never {@code null}. - */ - String getRepositoryUrl(); - - /** - * The path of the artifact relative to the repository's base URL. - * - * @return The path of the artifact, never {@code null}. - */ - String getName(); - - /** - * Gets the full URL of the artifact. - * - * @return The full URL of the artifact, never {@code null}. - */ - String getUrl(); - - /** - * The size of the artifact in bytes. - * - * @return The of the artifact in bytes or a negative value if unknown. - */ - long getContentLength(); - - /** - * Gets the timestamp when the transfer of this artifact was started. - * - * @return The timestamp when the transfer of this artifact was started. - */ - long getTransferStartTime(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java b/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java deleted file mode 100644 index fc8361c993db..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.settings.Mirror; - -/** - * DefaultMirrorSelector - */ -@Named -@Singleton -public class DefaultMirrorSelector implements MirrorSelector { - - private static final String WILDCARD = "*"; - - private static final String EXTERNAL_WILDCARD = "external:*"; - - private static final String EXTERNAL_HTTP_WILDCARD = "external:http:*"; - - public Mirror getMirror(ArtifactRepository repository, List mirrors) { - String repoId = repository.getId(); - - if (repoId != null && mirrors != null) { - for (Mirror mirror : mirrors) { - if (repoId.equals(mirror.getMirrorOf()) && matchesLayout(repository, mirror)) { - return mirror; - } - } - - for (Mirror mirror : mirrors) { - if (matchPattern(repository, mirror.getMirrorOf()) && matchesLayout(repository, mirror)) { - return mirror; - } - } - } - - return null; - } - - /** - * This method checks if the pattern matches the originalRepository. Valid patterns: - *
    - *
  • {@code *} = everything,
  • - *
  • {@code external:*} = everything not on the localhost and not file based,
  • - *
  • {@code external:http:*} = any repository not on the localhost using HTTP,
  • - *
  • {@code repo,repo1} = {@code repo} or {@code repo1},
  • - *
  • {@code *,!repo1} = everything except {@code repo1}.
  • - *
- * - * @param originalRepository to compare for a match. - * @param pattern used for match. - * @return true if the repository is a match to this pattern. - */ - static boolean matchPattern(ArtifactRepository originalRepository, String pattern) { - boolean result = false; - String originalId = originalRepository.getId(); - - // simple checks first to short circuit processing below. - if (WILDCARD.equals(pattern) || pattern.equals(originalId)) { - result = true; - } else { - // process the list - String[] repos = pattern.split(","); - for (String repo : repos) { - repo = repo.trim(); - // see if this is a negative match - if (repo.length() > 1 && repo.startsWith("!")) { - if (repo.substring(1).equals(originalId)) { - // explicitly exclude. Set result and stop processing. - result = false; - break; - } - } - // check for exact match - else if (repo.equals(originalId)) { - result = true; - break; - } - // check for external:* - else if (EXTERNAL_WILDCARD.equals(repo) && isExternalRepo(originalRepository)) { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - // check for external:http:* - else if (EXTERNAL_HTTP_WILDCARD.equals(repo) && isExternalHttpRepo(originalRepository)) { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } else if (WILDCARD.equals(repo)) { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - } - } - return result; - } - - /** - * Checks the URL to see if this repository refers to an external repository - * - * @param originalRepository - * @return true if external. - */ - static boolean isExternalRepo(ArtifactRepository originalRepository) { - try { - URL url = new URL(originalRepository.getUrl()); - return !(isLocal(url.getHost()) || url.getProtocol().equals("file")); - } catch (MalformedURLException e) { - // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it - return false; - } - } - - private static boolean isLocal(String host) { - return "localhost".equals(host) || "127.0.0.1".equals(host); - } - - /** - * Checks the URL to see if this repository refers to a non-localhost repository using HTTP. - * - * @param originalRepository - * @return true if external. - */ - static boolean isExternalHttpRepo(ArtifactRepository originalRepository) { - try { - URL url = new URL(originalRepository.getUrl()); - return ("http".equalsIgnoreCase(url.getProtocol()) - || "dav".equalsIgnoreCase(url.getProtocol()) - || "dav:http".equalsIgnoreCase(url.getProtocol()) - || "dav+http".equalsIgnoreCase(url.getProtocol())) - && !isLocal(url.getHost()); - } catch (MalformedURLException e) { - // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it - return false; - } - } - - static boolean matchesLayout(ArtifactRepository repository, Mirror mirror) { - return matchesLayout(RepositoryUtils.getLayout(repository), mirror.getMirrorOfLayouts()); - } - - /** - * Checks whether the layouts configured for a mirror match with the layout of the repository. - * - * @param repoLayout The layout of the repository, may be {@code null}. - * @param mirrorLayout The layouts supported by the mirror, may be {@code null}. - * @return {@code true} if the layouts associated with the mirror match the layout of the original repository, - * {@code false} otherwise. - */ - static boolean matchesLayout(String repoLayout, String mirrorLayout) { - boolean result = false; - - // simple checks first to short circuit processing below. - if ((mirrorLayout == null || mirrorLayout.isEmpty()) || WILDCARD.equals(mirrorLayout)) { - result = true; - } else if (mirrorLayout.equals(repoLayout)) { - result = true; - } else { - // process the list - String[] layouts = mirrorLayout.split(","); - for (String layout : layouts) { - // see if this is a negative match - if (layout.length() > 1 && layout.startsWith("!")) { - if (layout.substring(1).equals(repoLayout)) { - // explicitly exclude. Set result and stop processing. - result = false; - break; - } - } - // check for exact match - else if (layout.equals(repoLayout)) { - result = true; - break; - } else if (WILDCARD.equals(layout)) { - result = true; - // don't stop processing in case a future segment explicitly excludes this repo - } - } - } - - return result; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java deleted file mode 100644 index 306d61230b7f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.MavenArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; - -/** - * Delegating local artifact repository chains the reactor, IDE workspace - * and user local repository. - */ -@Deprecated -public class DelegatingLocalArtifactRepository extends MavenArtifactRepository { - private LocalArtifactRepository buildReactor; - - private LocalArtifactRepository ideWorkspace; - - private ArtifactRepository userLocalArtifactRepository; - - public DelegatingLocalArtifactRepository(ArtifactRepository artifactRepository) { - this.userLocalArtifactRepository = artifactRepository; - } - - public void setBuildReactor(LocalArtifactRepository localRepository) { - this.buildReactor = localRepository; - } - - public void setIdeWorkspace(LocalArtifactRepository localRepository) { - this.ideWorkspace = localRepository; - } - - /** - * @deprecated instead use {@link #getIdeWorkspace()} - */ - @Deprecated - public LocalArtifactRepository getIdeWorspace() { - return ideWorkspace; - } - - public LocalArtifactRepository getIdeWorkspace() { - return getIdeWorspace(); - } - - @Override - public Artifact find(Artifact artifact) { - if (!artifact.isRelease() && buildReactor != null) { - artifact = buildReactor.find(artifact); - } - - if (!artifact.isResolved() && ideWorkspace != null) { - artifact = ideWorkspace.find(artifact); - } - - if (!artifact.isResolved()) { - artifact = userLocalArtifactRepository.find(artifact); - } - - return artifact; - } - - @Override - public List findVersions(Artifact artifact) { - Collection versions = new LinkedHashSet<>(); - - if (buildReactor != null) { - versions.addAll(buildReactor.findVersions(artifact)); - } - - if (ideWorkspace != null) { - versions.addAll(ideWorkspace.findVersions(artifact)); - } - - versions.addAll(userLocalArtifactRepository.findVersions(artifact)); - - return Collections.unmodifiableList(new ArrayList<>(versions)); - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return userLocalArtifactRepository.pathOfLocalRepositoryMetadata(metadata, repository); - } - - public String getId() { - return userLocalArtifactRepository.getId(); - } - - @Override - public String pathOf(Artifact artifact) { - return userLocalArtifactRepository.pathOf(artifact); - } - - @Override - public String getBasedir() { - return (userLocalArtifactRepository != null) ? userLocalArtifactRepository.getBasedir() : null; - } - - @Override - public ArtifactRepositoryLayout getLayout() { - return userLocalArtifactRepository.getLayout(); - } - - @Override - public ArtifactRepositoryPolicy getReleases() { - return userLocalArtifactRepository.getReleases(); - } - - @Override - public ArtifactRepositoryPolicy getSnapshots() { - return userLocalArtifactRepository.getSnapshots(); - } - - @Override - public String getKey() { - return userLocalArtifactRepository.getKey(); - } - - @Override - public String getUrl() { - return userLocalArtifactRepository.getUrl(); - } - - @Override - public int hashCode() { - int hash = 17; - hash = hash * 31 + (buildReactor == null ? 0 : buildReactor.hashCode()); - hash = hash * 31 + (ideWorkspace == null ? 0 : ideWorkspace.hashCode()); - hash = hash * 31 + (userLocalArtifactRepository == null ? 0 : userLocalArtifactRepository.hashCode()); - - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - - DelegatingLocalArtifactRepository other = (DelegatingLocalArtifactRepository) obj; - - return eq(buildReactor, other.buildReactor) - && eq(ideWorkspace, other.ideWorkspace) - && eq(userLocalArtifactRepository, other.userLocalArtifactRepository); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java deleted file mode 100644 index 3577c316adbf..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.MavenArtifactRepository; - -/** - * LocalArtifactRepository - */ -@Deprecated -public abstract class LocalArtifactRepository extends MavenArtifactRepository { - public static final String IDE_WORKSPACE = "ide-workspace"; - - public abstract Artifact find(Artifact artifact); - - public abstract boolean hasLocalMetadata(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java b/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java deleted file mode 100644 index 921c07d43cf6..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.io.IOException; - -/** - * Signals a failure to store files within the local repository. - * - */ -@Deprecated -public class LocalRepositoryNotAccessibleException extends IOException { - - public LocalRepositoryNotAccessibleException(String message, Throwable cause) { - super(message); - initCause(cause); - } - - public LocalRepositoryNotAccessibleException(String message) { - super(message); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java deleted file mode 100644 index d84e67a03ab8..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -/** - * - * - * - */ -@Deprecated -public class MavenArtifactMetadata { - public static final String DEFAULT_TYPE = "jar"; - - String groupId; - String artifactId; - String version; - String classifier; - String type; - String scope; - - transient Object datum; - - public String getGroupId() { - return groupId; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getClassifier() { - return classifier; - } - - public void setClassifier(String classifier) { - this.classifier = classifier; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Object getDatum() { - return datum; - } - - public void setDatum(Object datum) { - this.datum = datum; - } - - public String getScope() { - return scope; - } - - public void setScope(String scope) { - this.scope = scope; - } - - @Override - public String toString() { - return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" - + (getClassifier() == null ? "" : getClassifier()) + ":" - + (getType() == null ? DEFAULT_TYPE : getType()); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java deleted file mode 100644 index d6b7c9205b96..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * This is the main graph data structure used by the RepositorySystem to present tree and graph objects. - * - * - */ -@Deprecated -public class MetadataGraph { - /** all graph nodes */ - Collection nodes; - - /** entry point for tree-like structures */ - MetadataGraphNode entry; - - public MetadataGraph(MetadataGraphNode entry) { - this(); - - this.entry = entry; - } - - public MetadataGraph() { - nodes = new ArrayList<>(64); - } - - public void addNode(MetadataGraphNode node) { - nodes.add(node); - } - - /** - * find a node by the GAV (metadata) - * - * @param md - */ - public MetadataGraphNode findNode(MavenArtifactMetadata md) { - for (MetadataGraphNode mgn : nodes) { - if (mgn.metadata.equals(md)) { - return mgn; - } - } - - MetadataGraphNode node = new MetadataGraphNode(md); - addNode(node); - return node; - } - - /** - * getter - */ - public MetadataGraphNode getEntry() { - return entry; - } - - /** - * getter - */ - public Collection getNodes() { - return nodes; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java deleted file mode 100644 index c67a55550f1f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.ArrayList; -import java.util.List; - -/** - * MetadataGraph node - as it's a directed graph - holds adjacency lists for incident and exident nodes - * - * - */ -@Deprecated -public class MetadataGraphNode { - /** node payload */ - MavenArtifactMetadata metadata; - - /** nodes, incident to this (depend on me) */ - List inNodes; - - /** nodes, exident to this (I depend on) */ - List exNodes; - - public MetadataGraphNode() { - inNodes = new ArrayList<>(4); - exNodes = new ArrayList<>(8); - } - - public MetadataGraphNode(MavenArtifactMetadata metadata) { - this(); - this.metadata = metadata; - } - - public MetadataGraphNode addIncident(MetadataGraphNode node) { - inNodes.add(node); - return this; - } - - public MetadataGraphNode addExident(MetadataGraphNode node) { - exNodes.add(node); - return this; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - - if (MetadataGraphNode.class.isAssignableFrom(obj.getClass())) { - MetadataGraphNode node2 = (MetadataGraphNode) obj; - - if (node2.metadata == null) { - return metadata == null; - } - - return metadata != null && metadata.toString().equals(node2.metadata.toString()); - } else { - return super.equals(obj); - } - } - - @Override - public int hashCode() { - if (metadata == null) { - return super.hashCode(); - } - - return metadata.toString().hashCode(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java deleted file mode 100644 index 4c438ca1e746..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * - * - * - */ -@Deprecated -public class MetadataResolutionRequest { - private MavenArtifactMetadata mad; - - private String scope; - - // Needs to go away - private Set artifactDependencies; - - private ArtifactRepository localRepository; - - private List remoteRepositories; - - // This is like a filter but overrides all transitive versions - private Map managedVersionMap; - - /** result type - flat list; the default */ - private boolean asList = true; - - /** result type - dirty tree */ - private boolean asDirtyTree = false; - - /** result type - resolved tree */ - private boolean asResolvedTree = false; - - /** result type - graph */ - private boolean asGraph = false; - - public MetadataResolutionRequest() {} - - public MetadataResolutionRequest( - MavenArtifactMetadata md, ArtifactRepository localRepository, List remoteRepositories) { - this.mad = md; - this.localRepository = localRepository; - this.remoteRepositories = remoteRepositories; - } - - public MavenArtifactMetadata getArtifactMetadata() { - return mad; - } - - public MetadataResolutionRequest setArtifactMetadata(MavenArtifactMetadata md) { - this.mad = md; - - return this; - } - - public MetadataResolutionRequest setArtifactDependencies(Set artifactDependencies) { - this.artifactDependencies = artifactDependencies; - - return this; - } - - public Set getArtifactDependencies() { - return artifactDependencies; - } - - public ArtifactRepository getLocalRepository() { - return localRepository; - } - - public MetadataResolutionRequest setLocalRepository(ArtifactRepository localRepository) { - this.localRepository = localRepository; - - return this; - } - - /** - * @deprecated instead use {@link #getRemoteRepositories()} - */ - @Deprecated - public List getRemoteRepostories() { - return remoteRepositories; - } - - public List getRemoteRepositories() { - return getRemoteRepostories(); - } - - /** - * @deprecated instead use {@link #setRemoteRepositories(List)} - */ - @Deprecated - public MetadataResolutionRequest setRemoteRepostories(List remoteRepositories) { - this.remoteRepositories = remoteRepositories; - - return this; - } - - public MetadataResolutionRequest setRemoteRepositories(List remoteRepositories) { - return setRemoteRepostories(remoteRepositories); - } - - public Map getManagedVersionMap() { - return managedVersionMap; - } - - public MetadataResolutionRequest setManagedVersionMap(Map managedVersionMap) { - this.managedVersionMap = managedVersionMap; - - return this; - } - - public String toString() { - StringBuilder sb = new StringBuilder() - .append("REQUEST: ") - .append("\n") - .append("artifact: ") - .append(mad) - .append("\n") - .append(artifactDependencies) - .append("\n") - .append("localRepository: ") - .append(localRepository) - .append("\n") - .append("remoteRepositories: ") - .append(remoteRepositories) - .append("\n"); - - return sb.toString(); - } - - public boolean isAsList() { - return asList; - } - - public MetadataResolutionRequest setAsList(boolean asList) { - this.asList = asList; - return this; - } - - public boolean isAsDirtyTree() { - return asDirtyTree; - } - - public MetadataResolutionRequest setAsDirtyTree(boolean asDirtyTree) { - this.asDirtyTree = asDirtyTree; - return this; - } - - public boolean isAsResolvedTree() { - return asResolvedTree; - } - - public MetadataResolutionRequest setAsResolvedTree(boolean asResolvedTree) { - this.asResolvedTree = asResolvedTree; - return this; - } - - public boolean isAsGraph() { - return asGraph; - } - - public MetadataResolutionRequest setAsGraph(boolean asGraph) { - this.asGraph = asGraph; - return this; - } - - public MetadataResolutionRequest setScope(String scope) { - this.scope = scope; - return this; - } - - public String getScope() { - return scope; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java deleted file mode 100644 index 6f9ff2943799..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.CyclicDependencyException; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * - * - * - */ -@Deprecated -public class MetadataResolutionResult { - private Artifact originatingArtifact; - - private List missingArtifacts; - - // Exceptions - - private List exceptions; - - private List versionRangeViolations; - - private List metadataResolutionExceptions; - - private List circularDependencyExceptions; - - private List errorArtifactExceptions; - - // file system errors - - private List repositories; - - private Set requestedArtifacts; - - private Set artifacts; - - private MetadataGraph dirtyTree; - - private MetadataGraph resolvedTree; - - private MetadataGraph resolvedGraph; - - public Artifact getOriginatingArtifact() { - return originatingArtifact; - } - - public MetadataResolutionResult listOriginatingArtifact(final Artifact originatingArtifact) { - this.originatingArtifact = originatingArtifact; - - return this; - } - - public void addArtifact(Artifact artifact) { - if (artifacts == null) { - artifacts = new LinkedHashSet<>(); - } - - artifacts.add(artifact); - } - - public Set getArtifacts() { - return artifacts; - } - - public void addRequestedArtifact(Artifact artifact) { - if (requestedArtifacts == null) { - requestedArtifacts = new LinkedHashSet<>(); - } - - requestedArtifacts.add(artifact); - } - - public Set getRequestedArtifacts() { - return requestedArtifacts; - } - - public boolean hasMissingArtifacts() { - return missingArtifacts != null && !missingArtifacts.isEmpty(); - } - - public List getMissingArtifacts() { - return missingArtifacts == null ? Collections.emptyList() : Collections.unmodifiableList(missingArtifacts); - } - - public MetadataResolutionResult addMissingArtifact(Artifact artifact) { - missingArtifacts = initList(missingArtifacts); - - missingArtifacts.add(artifact); - - return this; - } - - public MetadataResolutionResult setUnresolvedArtifacts(final List unresolvedArtifacts) { - this.missingArtifacts = unresolvedArtifacts; - - return this; - } - - // ------------------------------------------------------------------------ - // Exceptions - // ------------------------------------------------------------------------ - - public boolean hasExceptions() { - return exceptions != null && !exceptions.isEmpty(); - } - - public List getExceptions() { - return exceptions == null ? Collections.emptyList() : Collections.unmodifiableList(exceptions); - } - - // ------------------------------------------------------------------------ - // Version Range Violations - // ------------------------------------------------------------------------ - - public boolean hasVersionRangeViolations() { - return versionRangeViolations != null; - } - - /** - * TODO this needs to accept a {@link OverConstrainedVersionException} as returned by - * {@link #getVersionRangeViolation(int)} but it's not used like that in - * {@link org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector} - */ - public MetadataResolutionResult addVersionRangeViolation(Exception e) { - versionRangeViolations = initList(versionRangeViolations); - - versionRangeViolations.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public OverConstrainedVersionException getVersionRangeViolation(int i) { - return (OverConstrainedVersionException) versionRangeViolations.get(i); - } - - public List getVersionRangeViolations() { - return versionRangeViolations == null - ? Collections.emptyList() - : Collections.unmodifiableList(versionRangeViolations); - } - - // ------------------------------------------------------------------------ - // Metadata Resolution Exceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasMetadataResolutionExceptions() { - return metadataResolutionExceptions != null; - } - - public MetadataResolutionResult addMetadataResolutionException(ArtifactResolutionException e) { - metadataResolutionExceptions = initList(metadataResolutionExceptions); - - metadataResolutionExceptions.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public ArtifactResolutionException getMetadataResolutionException(int i) { - return metadataResolutionExceptions.get(i); - } - - public List getMetadataResolutionExceptions() { - return metadataResolutionExceptions == null - ? Collections.emptyList() - : Collections.unmodifiableList(metadataResolutionExceptions); - } - - // ------------------------------------------------------------------------ - // ErrorArtifactExceptions: ArtifactResolutionExceptions - // ------------------------------------------------------------------------ - - public boolean hasErrorArtifactExceptions() { - return errorArtifactExceptions != null; - } - - public MetadataResolutionResult addError(Exception e) { - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public List getErrorArtifactExceptions() { - if (errorArtifactExceptions == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(errorArtifactExceptions); - } - - // ------------------------------------------------------------------------ - // Circular Dependency Exceptions - // ------------------------------------------------------------------------ - - public boolean hasCircularDependencyExceptions() { - return circularDependencyExceptions != null; - } - - public MetadataResolutionResult addCircularDependencyException(CyclicDependencyException e) { - circularDependencyExceptions = initList(circularDependencyExceptions); - - circularDependencyExceptions.add(e); - - exceptions = initList(exceptions); - - exceptions.add(e); - - return this; - } - - public CyclicDependencyException getCircularDependencyException(int i) { - return circularDependencyExceptions.get(i); - } - - public List getCircularDependencyExceptions() { - if (circularDependencyExceptions == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(circularDependencyExceptions); - } - - // ------------------------------------------------------------------------ - // Repositories - // ------------------------------------------------------------------------ - - public List getRepositories() { - if (repositories == null) { - return Collections.emptyList(); - } - - return Collections.unmodifiableList(repositories); - } - - public MetadataResolutionResult setRepositories(final List repositories) { - this.repositories = repositories; - - return this; - } - - // - // Internal - // - - private List initList(final List l) { - if (l == null) { - return new ArrayList<>(); - } - return l; - } - - public String toString() { - if (artifacts == null) { - return ""; - } - StringBuilder sb = new StringBuilder(256); - int i = 1; - sb.append("---------\n"); - sb.append(artifacts.size()).append('\n'); - for (Artifact a : artifacts) { - sb.append(i).append(' ').append(a).append('\n'); - i++; - } - sb.append("---------\n"); - return sb.toString(); - } - - public MetadataGraph getResolvedTree() { - return resolvedTree; - } - - public void setResolvedTree(MetadataGraph resolvedTree) { - this.resolvedTree = resolvedTree; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java b/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java deleted file mode 100644 index eb958ae4864f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.settings.Mirror; - -/** - * Handles the selection of mirrors for repositories. - * - */ -@Deprecated -public interface MirrorSelector { - - /** - * Determines the mirror for the specified repository. - * - * @param repository The repository to determine the mirror for, must not be {@code null}. - * @param mirrors The available mirrors, may be {@code null}. - * @return The mirror specification for the repository or {@code null} if no mirror matched. - */ - Mirror getMirror(ArtifactRepository repository, List mirrors); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java deleted file mode 100644 index 789c2cf981bc..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/RepositorySystem.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.io.File; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Server; -import org.eclipse.aether.RepositorySystemSession; - -/** - * @since 3.0-alpha - * @deprecated Use {@link MavenRepositorySystem} if needed, or maven-resolver directly, until maven 4.x api is out - */ -@Deprecated -public interface RepositorySystem { - String DEFAULT_LOCAL_REPO_ID = MavenRepositorySystem.DEFAULT_LOCAL_REPO_ID; - - @SuppressWarnings("checkstyle:constantname") - String userHome = System.getProperty("user.home"); - - @SuppressWarnings("checkstyle:constantname") - File userMavenConfigurationHome = new File(userHome, ".m2"); - - @SuppressWarnings("checkstyle:constantname") - File defaultUserLocalRepository = new File(userMavenConfigurationHome, "repository"); - - String DEFAULT_REMOTE_REPO_ID = MavenRepositorySystem.DEFAULT_REMOTE_REPO_ID; - - String DEFAULT_REMOTE_REPO_URL = MavenRepositorySystem.DEFAULT_REMOTE_REPO_ID; - - Artifact createArtifact(String groupId, String artifactId, String version, String packaging); - - Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type); - - Artifact createProjectArtifact(String groupId, String artifactId, String version); - - Artifact createArtifactWithClassifier( - String groupId, String artifactId, String version, String type, String classifier); - - Artifact createPluginArtifact(Plugin plugin); - - Artifact createDependencyArtifact(Dependency dependency); - - ArtifactRepository buildArtifactRepository(Repository repository) throws InvalidRepositoryException; - - ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException; - - ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException; - - ArtifactRepository createLocalRepository(File localRepository) throws InvalidRepositoryException; - - ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases); - - /** - * Calculates the effective repositories for the given input repositories which are assumed to be already mirrored - * (if applicable). This process will essentially remove duplicate repositories by merging them into one equivalent - * repository. It is worth to point out that merging does not simply choose one of the input repositories and - * discards the others but actually combines their possibly different policies. - * - * @param repositories The original repositories, may be {@code null}. - * @return The effective repositories or {@code null} if the input was {@code null}. - */ - List getEffectiveRepositories(List repositories); - - /** - * Determines the mirror for the specified repository. - * - * @param repository The repository to determine the mirror for, must not be {@code null}. - * @param mirrors The available mirrors, may be {@code null}. - * @return The mirror specification for the repository or {@code null} if no mirror matched. - */ - Mirror getMirror(ArtifactRepository repository, List mirrors); - - /** - * Injects the mirroring information into the specified repositories. For each repository that is matched by a - * mirror, its URL and ID will be updated to match the values from the mirror specification. Repositories without a - * matching mirror will pass through unchanged. Note: This method must be called before - * {@link #injectAuthentication(List, List)} or the repositories will end up with the wrong credentials. - * - * @param repositories The repositories into which to inject the mirror information, may be {@code null}. - * @param mirrors The available mirrors, may be {@code null}. - */ - void injectMirror(List repositories, List mirrors); - - /** - * Injects the proxy information into the specified repositories. For each repository that is matched by a proxy, - * its proxy data will be set accordingly. Repositories without a matching proxy will have their proxy cleared. - * Note: This method must be called after {@link #injectMirror(List, List)} or the repositories will end up - * with the wrong proxies. - * - * @param repositories The repositories into which to inject the proxy information, may be {@code null}. - * @param proxies The available proxies, may be {@code null}. - */ - void injectProxy(List repositories, List proxies); - - /** - * Injects the authentication information into the specified repositories. For each repository that is matched by a - * server, its credentials will be updated to match the values from the server specification. Repositories without a - * matching server will have their credentials cleared. Note: This method must be called after - * {@link #injectMirror(List, List)} or the repositories will end up with the wrong credentials. - * - * @param repositories The repositories into which to inject the authentication information, may be {@code null}. - * @param servers The available servers, may be {@code null}. - */ - void injectAuthentication(List repositories, List servers); - - void injectMirror(RepositorySystemSession session, List repositories); - - void injectProxy(RepositorySystemSession session, List repositories); - - void injectAuthentication(RepositorySystemSession session, List repositories); - - ArtifactResolutionResult resolve(ArtifactResolutionRequest request); - - // Install - - // Deploy - - // Map types of artifacts - - // - // Raw file transfers - // - void publish( - ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException; - - void retrieve( - ArtifactRepository repository, - File destination, - String remotePath, - ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException, ArtifactDoesNotExistException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java b/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java deleted file mode 100644 index 2cc8e36c8c5a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.io.File; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * UserLocalArtifactRepository - */ -@Deprecated -public class UserLocalArtifactRepository extends LocalArtifactRepository { - private ArtifactRepository localRepository; - - public UserLocalArtifactRepository(ArtifactRepository localRepository) { - this.localRepository = localRepository; - setLayout(localRepository.getLayout()); - } - - @Override - public Artifact find(Artifact artifact) { - File artifactFile = new File(localRepository.getBasedir(), pathOf(artifact)); - - // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal - // with multiple local repository implementations yet. - artifact.setFile(artifactFile); - - return artifact; - } - - @Override - public String getId() { - return localRepository.getId(); - } - - @Override - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return localRepository.pathOfLocalRepositoryMetadata(metadata, repository); - } - - @Override - public String pathOf(Artifact artifact) { - return localRepository.pathOf(artifact); - } - - @Override - public boolean hasLocalMetadata() { - return true; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java b/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java deleted file mode 100644 index 4adb4eb660ac..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import java.io.File; - -import org.apache.maven.artifact.ArtifactUtils; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.model.Dependency; - -/** - * Thrown if a dependency has an invalid version. - * - */ -@Deprecated -public class VersionNotFoundException extends Exception { - private Dependency dependency; - - private String projectId; - private File pomFile; - private InvalidVersionSpecificationException cause; - - public VersionNotFoundException( - String projectId, Dependency dependency, File pomFile, InvalidVersionSpecificationException cause) { - super( - projectId + ", " + formatLocationInPom(dependency) + " " + dependency.getVersion() + ", pom file " - + pomFile, - cause); - - this.projectId = projectId; - - this.pomFile = pomFile; - - this.cause = cause; - - this.dependency = dependency; - } - - private static String formatLocationInPom(Dependency dependency) { - return "Dependency: " + ArtifactUtils.versionlessKey(dependency.getGroupId(), dependency.getArtifactId()); - } - - public Dependency getDependency() { - return dependency; - } - - public String getProjectId() { - return projectId; - } - - public File getPomFile() { - return pomFile; - } - - public InvalidVersionSpecificationException getCauseException() { - return cause; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java deleted file mode 100644 index ea375a3fbb33..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import org.apache.maven.wagon.TransferFailedException; - -/** - * Occurs when a download checksum fails. - * - */ -@Deprecated -public class ChecksumFailedException extends TransferFailedException { - public ChecksumFailedException(String s) { - super(s); - } - - public ChecksumFailedException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java deleted file mode 100644 index 4c4156a07172..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.nio.channels.Channels; -import java.nio.channels.FileChannel; -import java.nio.channels.FileLock; -import java.util.Date; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.Authentication; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.repository.Proxy; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.logging.Logger; - -/** - * DefaultUpdateCheckManager - */ -@Named -@Singleton -@Deprecated -public class DefaultUpdateCheckManager extends AbstractLogEnabled implements UpdateCheckManager { - - private static final String ERROR_KEY_SUFFIX = ".error"; - - public DefaultUpdateCheckManager() {} - - public DefaultUpdateCheckManager(Logger logger) { - enableLogging(logger); - } - - public static final String LAST_UPDATE_TAG = ".lastUpdated"; - - private static final String TOUCHFILE_NAME = "resolver-status.properties"; - - public boolean isUpdateRequired(Artifact artifact, ArtifactRepository repository) { - File file = artifact.getFile(); - - ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases(); - - if (!policy.isEnabled()) { - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Skipping update check for " + artifact + " (" + file + ") from " + repository.getId() - + " (" + repository.getUrl() + ")"); - } - - return false; - } - - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Determining update check for " + artifact + " (" + file + ") from " + repository.getId() - + " (" + repository.getUrl() + ")"); - } - - if (file == null) { - // TODO throw something instead? - return true; - } - - Date lastCheckDate; - - if (file.exists()) { - lastCheckDate = new Date(file.lastModified()); - } else { - File touchfile = getTouchfile(artifact); - lastCheckDate = readLastUpdated(touchfile, getRepositoryKey(repository)); - } - - return (lastCheckDate == null) || policy.checkOutOfDate(lastCheckDate); - } - - public boolean isUpdateRequired(RepositoryMetadata metadata, ArtifactRepository repository, File file) { - // Here, we need to determine which policy to use. Release updateInterval will be used when - // the metadata refers to a release artifact or meta-version, and snapshot updateInterval will be used when - // it refers to a snapshot artifact or meta-version. - // NOTE: Release metadata includes version information about artifacts that have been released, to allow - // meta-versions like RELEASE and LATEST to resolve, and also to allow retrieval of the range of valid, released - // artifacts available. - ArtifactRepositoryPolicy policy = metadata.getPolicy(repository); - - if (!policy.isEnabled()) { - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Skipping update check for " + metadata.getKey() + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")"); - } - - return false; - } - - if (getLogger().isDebugEnabled()) { - getLogger() - .debug("Determining update check for " + metadata.getKey() + " (" + file + ") from " - + repository.getId() + " (" + repository.getUrl() + ")"); - } - - if (file == null) { - // TODO throw something instead? - return true; - } - - Date lastCheckDate = readLastUpdated(metadata, repository, file); - - return (lastCheckDate == null) || policy.checkOutOfDate(lastCheckDate); - } - - private Date readLastUpdated(RepositoryMetadata metadata, ArtifactRepository repository, File file) { - File touchfile = getTouchfile(metadata, file); - - String key = getMetadataKey(repository, file); - - return readLastUpdated(touchfile, key); - } - - public String getError(Artifact artifact, ArtifactRepository repository) { - File touchFile = getTouchfile(artifact); - return getError(touchFile, getRepositoryKey(repository)); - } - - public void touch(Artifact artifact, ArtifactRepository repository, String error) { - File file = artifact.getFile(); - - File touchfile = getTouchfile(artifact); - - if (file.exists()) { - touchfile.delete(); - } else { - writeLastUpdated(touchfile, getRepositoryKey(repository), error); - } - } - - public void touch(RepositoryMetadata metadata, ArtifactRepository repository, File file) { - File touchfile = getTouchfile(metadata, file); - - String key = getMetadataKey(repository, file); - - writeLastUpdated(touchfile, key, null); - } - - String getMetadataKey(ArtifactRepository repository, File file) { - return repository.getId() + '.' + file.getName() + LAST_UPDATE_TAG; - } - - String getRepositoryKey(ArtifactRepository repository) { - StringBuilder buffer = new StringBuilder(256); - - Proxy proxy = repository.getProxy(); - if (proxy != null) { - if (proxy.getUserName() != null) { - int hash = (proxy.getUserName() + proxy.getPassword()).hashCode(); - buffer.append(hash).append('@'); - } - buffer.append(proxy.getHost()).append(':').append(proxy.getPort()).append('>'); - } - - // consider the username&password because a repo manager might block artifacts depending on authorization - Authentication auth = repository.getAuthentication(); - if (auth != null) { - int hash = (auth.getUsername() + auth.getPassword()).hashCode(); - buffer.append(hash).append('@'); - } - - // consider the URL (instead of the id) as this most closely relates to the contents in the repo - buffer.append(repository.getUrl()); - - return buffer.toString(); - } - - private void writeLastUpdated(File touchfile, String key, String error) { - synchronized (touchfile.getAbsolutePath().intern()) { - if (!touchfile.getParentFile().exists() - && !touchfile.getParentFile().mkdirs()) { - getLogger() - .debug("Failed to create directory: " + touchfile.getParent() - + " for tracking artifact metadata resolution."); - return; - } - - FileChannel channel = null; - FileLock lock = null; - try { - Properties props = new Properties(); - - channel = new RandomAccessFile(touchfile, "rw").getChannel(); - lock = channel.lock(); - - if (touchfile.canRead()) { - getLogger().debug("Reading resolution-state from: " + touchfile); - props.load(Channels.newInputStream(channel)); - } - - props.setProperty(key, Long.toString(System.currentTimeMillis())); - - if (error != null) { - props.setProperty(key + ERROR_KEY_SUFFIX, error); - } else { - props.remove(key + ERROR_KEY_SUFFIX); - } - - getLogger().debug("Writing resolution-state to: " + touchfile); - channel.truncate(0); - props.store(Channels.newOutputStream(channel), "Last modified on: " + new Date()); - - lock.release(); - lock = null; - - channel.close(); - channel = null; - } catch (IOException e) { - getLogger() - .debug( - "Failed to record lastUpdated information for resolution.\nFile: " - + touchfile.toString() + "; key: " + key, - e); - } finally { - if (lock != null) { - try { - lock.release(); - } catch (IOException e) { - getLogger() - .debug("Error releasing exclusive lock for resolution tracking file: " + touchfile, e); - } - } - - if (channel != null) { - try { - channel.close(); - } catch (IOException e) { - getLogger().debug("Error closing FileChannel for resolution tracking file: " + touchfile, e); - } - } - } - } - } - - Date readLastUpdated(File touchfile, String key) { - getLogger().debug("Searching for " + key + " in resolution tracking file."); - - Properties props = read(touchfile); - if (props != null) { - String rawVal = props.getProperty(key); - if (rawVal != null) { - try { - return new Date(Long.parseLong(rawVal)); - } catch (NumberFormatException e) { - getLogger().debug("Cannot parse lastUpdated date: '" + rawVal + "'. Ignoring.", e); - } - } - } - return null; - } - - private String getError(File touchFile, String key) { - Properties props = read(touchFile); - if (props != null) { - return props.getProperty(key + ERROR_KEY_SUFFIX); - } - return null; - } - - private Properties read(File touchfile) { - if (!touchfile.canRead()) { - getLogger().debug("Skipped unreadable resolution tracking file: " + touchfile); - return null; - } - - synchronized (touchfile.getAbsolutePath().intern()) { - try { - Properties props = new Properties(); - - try (FileInputStream in = new FileInputStream(touchfile)) { - try (FileLock lock = in.getChannel().lock(0, Long.MAX_VALUE, true)) { - getLogger().debug("Reading resolution-state from: " + touchfile); - props.load(in); - - return props; - } - } - - } catch (IOException e) { - getLogger().debug("Failed to read resolution tracking file: " + touchfile, e); - - return null; - } - } - } - - File getTouchfile(Artifact artifact) { - StringBuilder sb = new StringBuilder(128); - sb.append(artifact.getArtifactId()); - sb.append('-').append(artifact.getBaseVersion()); - if (artifact.getClassifier() != null) { - sb.append('-').append(artifact.getClassifier()); - } - sb.append('.').append(artifact.getType()).append(LAST_UPDATE_TAG); - return new File(artifact.getFile().getParentFile(), sb.toString()); - } - - File getTouchfile(RepositoryMetadata metadata, File file) { - return new File(file.getParent(), TOUCHFILE_NAME); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java deleted file mode 100644 index 4fa05c9b145d..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ /dev/null @@ -1,709 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.nio.file.StandardOpenOption; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.authentication.AuthenticationInfo; -import org.apache.maven.wagon.authorization.AuthorizationException; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.observers.ChecksumObserver; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.repository.Repository; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; -import org.eclipse.aether.ConfigurationProperties; -import org.eclipse.aether.util.ConfigUtils; - -// TODO remove the update check manager -// TODO separate into retriever and publisher -// TODO remove hardcoding of checksum logic - -/** - * Manages Wagon related operations in Maven. - */ -@Named -@Singleton -@Deprecated -public class DefaultWagonManager implements WagonManager { - - private static final String[] CHECKSUM_IDS = {"md5", "sha1"}; - - /** - * have to match the CHECKSUM_IDS - */ - private static final String[] CHECKSUM_ALGORITHMS = {"MD5", "SHA-1"}; - - @Inject - private Logger logger; - - @Inject - private PlexusContainer container; - - @Inject - private UpdateCheckManager updateCheckManager; - - @Inject - private LegacySupport legacySupport; - - // - // Retriever - // - @Override - public void getArtifact( - Artifact artifact, ArtifactRepository repository, TransferListener downloadMonitor, boolean force) - throws TransferFailedException, ResourceDoesNotExistException { - String remotePath = repository.pathOf(artifact); - - ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases(); - - if (!policy.isEnabled()) { - logger.debug( - "Skipping disabled repository " + repository.getId() + " for resolution of " + artifact.getId()); - - } else if (artifact.isSnapshot() || !artifact.getFile().exists()) { - if (force || updateCheckManager.isUpdateRequired(artifact, repository)) { - logger.debug("Trying repository " + repository.getId() + " for resolution of " + artifact.getId() - + " from " + remotePath); - - try { - getRemoteFile( - repository, - artifact.getFile(), - remotePath, - downloadMonitor, - policy.getChecksumPolicy(), - false); - - updateCheckManager.touch(artifact, repository, null); - } catch (ResourceDoesNotExistException e) { - updateCheckManager.touch(artifact, repository, null); - throw e; - } catch (TransferFailedException e) { - String error = (e.getMessage() != null) - ? e.getMessage() - : e.getClass().getSimpleName(); - updateCheckManager.touch(artifact, repository, error); - throw e; - } - - logger.debug(" Artifact " + artifact.getId() + " resolved to " + artifact.getFile()); - - artifact.setResolved(true); - } else if (!artifact.getFile().exists()) { - String error = updateCheckManager.getError(artifact, repository); - if (error != null) { - throw new TransferFailedException("Failure to resolve " + remotePath + " from " - + repository.getUrl() - + " was cached in the local repository. " - + "Resolution will not be reattempted until the update interval of " - + repository.getId() + " has elapsed or updates are forced. Original error: " + error); - - } else { - throw new ResourceDoesNotExistException( - "Failure to resolve " + remotePath + " from " + repository.getUrl() - + " was cached in the local repository. " - + "Resolution will not be reattempted until the update interval of " - + repository.getId() + " has elapsed or updates are forced."); - } - } - } - } - - @Override - public void getArtifact( - Artifact artifact, - List remoteRepositories, - TransferListener downloadMonitor, - boolean force) - throws TransferFailedException, ResourceDoesNotExistException { - TransferFailedException tfe = null; - - for (ArtifactRepository repository : remoteRepositories) { - try { - getArtifact(artifact, repository, downloadMonitor, force); - - if (artifact.isResolved()) { - artifact.setRepository(repository); - break; - } - } catch (ResourceDoesNotExistException e) { - // This one we will eat when looking through remote repositories - // because we want to cycle through them all before squawking. - - logger.debug( - "Unable to find artifact " + artifact.getId() + " in repository " + repository.getId() + " (" - + repository.getUrl() + ")", - e); - - } catch (TransferFailedException e) { - tfe = e; - - String msg = "Unable to get artifact " + artifact.getId() + " from repository " + repository.getId() - + " (" + repository.getUrl() + "): " + e.getMessage(); - - if (logger.isDebugEnabled()) { - logger.warn(msg, e); - } else { - logger.warn(msg); - } - } - } - - // if it already exists locally we were just trying to force it - ignore the update - if (!artifact.getFile().exists()) { - if (tfe != null) { - throw tfe; - } else { - throw new ResourceDoesNotExistException("Unable to download the artifact from any repository"); - } - } - } - - @Override - public void getArtifactMetadata( - ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy) - throws TransferFailedException, ResourceDoesNotExistException { - String remotePath = repository.pathOfRemoteRepositoryMetadata(metadata); - - getRemoteFile(repository, destination, remotePath, null, checksumPolicy, true); - } - - @Override - public void getArtifactMetadataFromDeploymentRepository( - ArtifactMetadata metadata, ArtifactRepository repository, File destination, String checksumPolicy) - throws TransferFailedException, ResourceDoesNotExistException { - String remotePath = repository.pathOfRemoteRepositoryMetadata(metadata); - - getRemoteFile(repository, destination, remotePath, null, checksumPolicy, true); - } - - /** - * Deal with connecting to a wagon repository taking into account authentication and proxies. - * - * @param wagon - * @param repository - * - * @throws ConnectionException - * @throws AuthenticationException - */ - private void connectWagon(Wagon wagon, ArtifactRepository repository) - throws ConnectionException, AuthenticationException { - // MNG-5509 - // See org.eclipse.aether.connector.wagon.WagonRepositoryConnector.connectWagon(Wagon) - if (legacySupport.getRepositorySession() != null) { - String userAgent = ConfigUtils.getString( - legacySupport.getRepositorySession(), null, ConfigurationProperties.USER_AGENT); - - if (userAgent == null) { - Properties headers = new Properties(); - - headers.put( - "User-Agent", - ConfigUtils.getString( - legacySupport.getRepositorySession(), "Maven", ConfigurationProperties.USER_AGENT)); - try { - Method setHttpHeaders = wagon.getClass().getMethod("setHttpHeaders", Properties.class); - setHttpHeaders.invoke(wagon, headers); - } catch (NoSuchMethodException e) { - // normal for non-http wagons - } catch (Exception e) { - logger.debug("Could not set user agent for wagon " - + wagon.getClass().getName() + ": " + e); - } - } - } - - if (repository.getProxy() != null && logger.isDebugEnabled()) { - logger.debug("Using proxy " + repository.getProxy().getHost() + ":" - + repository.getProxy().getPort() + " for " + repository.getUrl()); - } - - if (repository.getAuthentication() != null && repository.getProxy() != null) { - wagon.connect( - new Repository(repository.getId(), repository.getUrl()), - authenticationInfo(repository), - proxyInfo(repository)); - - } else if (repository.getAuthentication() != null) { - wagon.connect(new Repository(repository.getId(), repository.getUrl()), authenticationInfo(repository)); - - } else if (repository.getProxy() != null) { - wagon.connect(new Repository(repository.getId(), repository.getUrl()), proxyInfo(repository)); - } else { - wagon.connect(new Repository(repository.getId(), repository.getUrl())); - } - } - - private AuthenticationInfo authenticationInfo(ArtifactRepository repository) { - AuthenticationInfo ai = new AuthenticationInfo(); - ai.setUserName(repository.getAuthentication().getUsername()); - ai.setPassword(repository.getAuthentication().getPassword()); - return ai; - } - - private ProxyInfo proxyInfo(ArtifactRepository repository) { - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setHost(repository.getProxy().getHost()); - proxyInfo.setType(repository.getProxy().getProtocol()); - proxyInfo.setPort(repository.getProxy().getPort()); - proxyInfo.setNonProxyHosts(repository.getProxy().getNonProxyHosts()); - proxyInfo.setUserName(repository.getProxy().getUserName()); - proxyInfo.setPassword(repository.getProxy().getPassword()); - return proxyInfo; - } - - @SuppressWarnings("checkstyle:methodlength") - @Override - public void getRemoteFile( - ArtifactRepository repository, - File destination, - String remotePath, - TransferListener downloadMonitor, - String checksumPolicy, - boolean force) - throws TransferFailedException, ResourceDoesNotExistException { - String protocol = repository.getProtocol(); - - Wagon wagon; - - try { - wagon = getWagon(protocol); - } catch (UnsupportedProtocolException e) { - throw new TransferFailedException("Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e); - } - - if (downloadMonitor != null) { - wagon.addTransferListener(downloadMonitor); - } - - File temp = new File(destination + ".tmp"); - - temp.deleteOnExit(); - - boolean downloaded = false; - - try { - connectWagon(wagon, repository); - - boolean firstRun = true; - boolean retry = true; - - // this will run at most twice. The first time, the firstRun flag is turned off, and if the retry flag - // is set on the first run, it will be turned off and not re-set on the second try. This is because the - // only way the retry flag can be set is if ( firstRun == true ). - while (firstRun || retry) { - ChecksumObserver md5ChecksumObserver = null; - ChecksumObserver sha1ChecksumObserver = null; - try { - // TODO configure on repository - int i = 0; - - md5ChecksumObserver = addChecksumObserver(wagon, CHECKSUM_ALGORITHMS[i++]); - sha1ChecksumObserver = addChecksumObserver(wagon, CHECKSUM_ALGORITHMS[i++]); - - // reset the retry flag. - retry = false; - - // This should take care of creating destination directory now on - if (destination.exists() && !force) { - try { - downloaded = wagon.getIfNewer(remotePath, temp, destination.lastModified()); - - if (!downloaded) { - // prevent additional checks of this artifact until it expires again - destination.setLastModified(System.currentTimeMillis()); - } - } catch (UnsupportedOperationException e) { - // older wagons throw this. Just get() instead - wagon.get(remotePath, temp); - - downloaded = true; - } - } else { - wagon.get(remotePath, temp); - downloaded = true; - } - } finally { - wagon.removeTransferListener(md5ChecksumObserver); - wagon.removeTransferListener(sha1ChecksumObserver); - } - - if (downloaded) { - // keep the checksum files from showing up on the download monitor... - if (downloadMonitor != null) { - wagon.removeTransferListener(downloadMonitor); - } - - // try to verify the SHA-1 checksum for this file. - try { - verifyChecksum(sha1ChecksumObserver, destination, temp, remotePath, ".sha1", wagon); - } catch (ChecksumFailedException e) { - // if we catch a ChecksumFailedException, it means the transfer/read succeeded, but the - // checksum doesn't match. This could be a problem with the server (ibiblio HTTP-200 error - // page), so we'll try this up to two times. On the second try, we'll handle it as a bona-fide - // error, based on the repository's checksum checking policy. - if (firstRun) { - logger.warn("*** CHECKSUM FAILED - " + e.getMessage() + " - RETRYING"); - retry = true; - } else { - handleChecksumFailure(checksumPolicy, e.getMessage(), e.getCause()); - } - } catch (ResourceDoesNotExistException sha1TryException) { - logger.debug("SHA1 not found, trying MD5: " + sha1TryException.getMessage()); - - // if this IS NOT a ChecksumFailedException, it was a problem with transfer/read of the checksum - // file...we'll try again with the MD5 checksum. - try { - verifyChecksum(md5ChecksumObserver, destination, temp, remotePath, ".md5", wagon); - } catch (ChecksumFailedException e) { - // if we also fail to verify based on the MD5 checksum, and the checksum transfer/read - // succeeded, then we need to determine whether to retry or handle it as a failure. - if (firstRun) { - retry = true; - } else { - handleChecksumFailure(checksumPolicy, e.getMessage(), e.getCause()); - } - } catch (ResourceDoesNotExistException md5TryException) { - // this was a failed transfer, and we don't want to retry. - handleChecksumFailure( - checksumPolicy, - "Error retrieving checksum file for " + remotePath, - md5TryException); - } - } - - // reinstate the download monitor... - if (downloadMonitor != null) { - wagon.addTransferListener(downloadMonitor); - } - } - - // unset the firstRun flag, so we don't get caught in an infinite loop... - firstRun = false; - } - } catch (ConnectionException e) { - throw new TransferFailedException("Connection failed: " + e.getMessage(), e); - } catch (AuthenticationException e) { - throw new TransferFailedException("Authentication failed: " + e.getMessage(), e); - } catch (AuthorizationException e) { - throw new TransferFailedException("Authorization failed: " + e.getMessage(), e); - } finally { - // Remove remaining TransferListener instances (checksum handlers removed in above finally clause) - if (downloadMonitor != null) { - wagon.removeTransferListener(downloadMonitor); - } - - disconnectWagon(wagon); - - releaseWagon(protocol, wagon); - } - - if (downloaded) { - if (!temp.exists()) { - throw new ResourceDoesNotExistException("Downloaded file does not exist: " + temp); - } - - // The temporary file is named destination + ".tmp" and is done this way to ensure - // that the temporary file is in the same file system as the destination because the - // File.renameTo operation doesn't really work across file systems. - // So we will attempt to do a File.renameTo for efficiency and atomicity, if this fails - // then we will use a brute force copy and delete the temporary file. - if (!temp.renameTo(destination)) { - try { - Files.copy( - temp.toPath(), - destination.toPath(), - StandardCopyOption.REPLACE_EXISTING, - StandardCopyOption.COPY_ATTRIBUTES); - - if (!temp.delete()) { - temp.deleteOnExit(); - } - } catch (IOException e) { - throw new TransferFailedException( - "Error copying temporary file to the final destination: " + e.getMessage(), e); - } - } - } - } - - // - // Publisher - // - @Override - public void putArtifact( - File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor) - throws TransferFailedException { - putRemoteFile(deploymentRepository, source, deploymentRepository.pathOf(artifact), downloadMonitor); - } - - @Override - public void putArtifactMetadata(File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository) - throws TransferFailedException { - logger.info("Uploading " + artifactMetadata); - putRemoteFile(repository, source, repository.pathOfRemoteRepositoryMetadata(artifactMetadata), null); - } - - @Override - public void putRemoteFile( - ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor) - throws TransferFailedException { - String protocol = repository.getProtocol(); - - Wagon wagon; - try { - wagon = getWagon(protocol); - } catch (UnsupportedProtocolException e) { - throw new TransferFailedException("Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e); - } - - if (downloadMonitor != null) { - wagon.addTransferListener(downloadMonitor); - } - - Map checksums = new HashMap<>(2); - - Map sums = new HashMap<>(2); - - // TODO configure these on the repository - for (int i = 0; i < CHECKSUM_IDS.length; i++) { - checksums.put(CHECKSUM_IDS[i], addChecksumObserver(wagon, CHECKSUM_ALGORITHMS[i])); - } - - List temporaryFiles = new ArrayList<>(); - - try { - try { - connectWagon(wagon, repository); - - wagon.put(source, remotePath); - } finally { - if (downloadMonitor != null) { - wagon.removeTransferListener(downloadMonitor); - } - } - - // Pre-store the checksums as any future puts will overwrite them - for (String extension : checksums.keySet()) { - ChecksumObserver observer = checksums.get(extension); - sums.put(extension, observer.getActualChecksum()); - } - - // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself - for (String extension : checksums.keySet()) { - // TODO shouldn't need a file intermediary - improve wagon to take a stream - File temp = File.createTempFile("maven-artifact", null); - temp.deleteOnExit(); - byte[] bytes = sums.get(extension).getBytes(StandardCharsets.UTF_8); - Files.write( - Paths.get(temp.getAbsolutePath()), bytes, StandardOpenOption.APPEND, StandardOpenOption.CREATE); - - temporaryFiles.add(temp); - wagon.put(temp, remotePath + "." + extension); - } - } catch (ConnectionException e) { - throw new TransferFailedException("Connection failed: " + e.getMessage(), e); - } catch (AuthenticationException e) { - throw new TransferFailedException("Authentication failed: " + e.getMessage(), e); - } catch (AuthorizationException e) { - throw new TransferFailedException("Authorization failed: " + e.getMessage(), e); - } catch (ResourceDoesNotExistException e) { - throw new TransferFailedException("Resource to deploy not found: " + e.getMessage(), e); - } catch (IOException e) { - throw new TransferFailedException("Error creating temporary file for deployment: " + e.getMessage(), e); - } finally { - // MNG-4543 - cleanupTemporaryFiles(temporaryFiles); - - // Remove every checksum listener - for (String id : CHECKSUM_IDS) { - TransferListener checksumListener = checksums.get(id); - if (checksumListener != null) { - wagon.removeTransferListener(checksumListener); - } - } - - disconnectWagon(wagon); - - releaseWagon(protocol, wagon); - } - } - - private void cleanupTemporaryFiles(List files) { - for (File file : files) { - // really don't care if it failed here only log warning - if (!file.delete()) { - logger.warn("skip failed to delete temporary file : " + file.getAbsolutePath()); - file.deleteOnExit(); - } - } - } - - private ChecksumObserver addChecksumObserver(Wagon wagon, String algorithm) throws TransferFailedException { - try { - ChecksumObserver checksumObserver = new ChecksumObserver(algorithm); - wagon.addTransferListener(checksumObserver); - return checksumObserver; - } catch (NoSuchAlgorithmException e) { - throw new TransferFailedException("Unable to add checksum for unsupported algorithm " + algorithm, e); - } - } - - private void handleChecksumFailure(String checksumPolicy, String message, Throwable cause) - throws ChecksumFailedException { - if (ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL.equals(checksumPolicy)) { - throw new ChecksumFailedException(message, cause); - } else if (!ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE.equals(checksumPolicy)) { - // warn if it is set to anything other than ignore - logger.warn("*** CHECKSUM FAILED - " + message + " - IGNORING"); - } - // otherwise it is ignore - } - - private void verifyChecksum( - ChecksumObserver checksumObserver, - File destination, - File tempDestination, - String remotePath, - String checksumFileExtension, - Wagon wagon) - throws ResourceDoesNotExistException, TransferFailedException, AuthorizationException { - try { - // grab it first, because it's about to change... - String actualChecksum = checksumObserver.getActualChecksum(); - - File tempChecksumFile = new File(tempDestination + checksumFileExtension + ".tmp"); - tempChecksumFile.deleteOnExit(); - wagon.get(remotePath + checksumFileExtension, tempChecksumFile); - byte[] bytes = Files.readAllBytes(tempChecksumFile.toPath()); - String expectedChecksum = new String(bytes, StandardCharsets.UTF_8); - - // remove whitespaces at the end - expectedChecksum = expectedChecksum.trim(); - - // check for 'ALGO (name) = CHECKSUM' like used by openssl - if (expectedChecksum.regionMatches(true, 0, "MD", 0, 2) - || expectedChecksum.regionMatches(true, 0, "SHA", 0, 3)) { - int lastSpacePos = expectedChecksum.lastIndexOf(' '); - expectedChecksum = expectedChecksum.substring(lastSpacePos + 1); - } else { - // remove everything after the first space (if available) - int spacePos = expectedChecksum.indexOf(' '); - - if (spacePos != -1) { - expectedChecksum = expectedChecksum.substring(0, spacePos); - } - } - if (expectedChecksum.equalsIgnoreCase(actualChecksum)) { - File checksumFile = new File(destination + checksumFileExtension); - if (checksumFile.exists()) { - checksumFile.delete(); // ignore if failed as we will overwrite - } - Files.copy( - tempChecksumFile.toPath(), - checksumFile.toPath(), - StandardCopyOption.REPLACE_EXISTING, - StandardCopyOption.COPY_ATTRIBUTES); - - if (!tempChecksumFile.delete()) { - tempChecksumFile.deleteOnExit(); - } - } else { - throw new ChecksumFailedException("Checksum failed on download: local = '" + actualChecksum - + "'; remote = '" + expectedChecksum + "'"); - } - } catch (IOException e) { - throw new ChecksumFailedException("Invalid checksum file", e); - } - } - - private void disconnectWagon(Wagon wagon) { - try { - wagon.disconnect(); - } catch (ConnectionException e) { - logger.error("Problem disconnecting from wagon - ignoring: " + e.getMessage()); - } - } - - private void releaseWagon(String protocol, Wagon wagon) { - try { - container.release(wagon); - } catch (ComponentLifecycleException e) { - logger.error("Problem releasing wagon - ignoring: " + e.getMessage()); - logger.debug("", e); - } - } - - @Override - @Deprecated - public Wagon getWagon(Repository repository) throws UnsupportedProtocolException { - return getWagon(repository.getProtocol()); - } - - @Override - @Deprecated - public Wagon getWagon(String protocol) throws UnsupportedProtocolException { - if (protocol == null) { - throw new UnsupportedProtocolException("Unspecified protocol"); - } - - String hint = protocol.toLowerCase(java.util.Locale.ENGLISH); - - Wagon wagon; - try { - wagon = container.lookup(Wagon.class, hint); - } catch (ComponentLookupException e) { - throw new UnsupportedProtocolException( - "Cannot find wagon which supports the requested protocol: " + protocol, e); - } - - return wagon; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java deleted file mode 100644 index fac3efb39800..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java +++ /dev/null @@ -1,798 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.Authentication; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Exclusion; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.model.RepositoryPolicy; -import org.apache.maven.repository.ArtifactDoesNotExistException; -import org.apache.maven.repository.ArtifactTransferFailedException; -import org.apache.maven.repository.ArtifactTransferListener; -import org.apache.maven.repository.DelegatingLocalArtifactRepository; -import org.apache.maven.repository.LocalArtifactRepository; -import org.apache.maven.repository.MirrorSelector; -import org.apache.maven.repository.Proxy; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Server; -import org.apache.maven.settings.building.SettingsProblem; -import org.apache.maven.settings.crypto.DefaultSettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecrypter; -import org.apache.maven.settings.crypto.SettingsDecryptionRequest; -import org.apache.maven.settings.crypto.SettingsDecryptionResult; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.proxy.ProxyUtils; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.logging.Logger; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.repository.AuthenticationContext; -import org.eclipse.aether.repository.AuthenticationSelector; -import org.eclipse.aether.repository.ProxySelector; -import org.eclipse.aether.repository.RemoteRepository; - -/** - */ -@Named("default") -@Singleton -@Deprecated -public class LegacyRepositorySystem implements RepositorySystem { - - @Inject - private Logger logger; - - @Inject - private ArtifactFactory artifactFactory; - - @Inject - private ArtifactResolver artifactResolver; - - @Inject - private ArtifactRepositoryFactory artifactRepositoryFactory; - - @Inject - private Map layouts; - - @Inject - private WagonManager wagonManager; - - @Inject - private PlexusContainer plexus; - - @Inject - private MirrorSelector mirrorSelector; - - @Inject - private SettingsDecrypter settingsDecrypter; - - public Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) { - return artifactFactory.createArtifact(groupId, artifactId, version, scope, type); - } - - public Artifact createArtifact(String groupId, String artifactId, String version, String packaging) { - return artifactFactory.createBuildArtifact(groupId, artifactId, version, packaging); - } - - public Artifact createArtifactWithClassifier( - String groupId, String artifactId, String version, String type, String classifier) { - return artifactFactory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier); - } - - public Artifact createProjectArtifact(String groupId, String artifactId, String metaVersionId) { - return artifactFactory.createProjectArtifact(groupId, artifactId, metaVersionId); - } - - public Artifact createDependencyArtifact(Dependency d) { - VersionRange versionRange; - try { - versionRange = VersionRange.createFromVersionSpec(d.getVersion()); - } catch (InvalidVersionSpecificationException e) { - // MNG-5368: Log a message instead of returning 'null' silently. - this.logger.error( - String.format( - "Invalid version specification '%s' creating dependency artifact '%s'.", d.getVersion(), d), - e); - return null; - } - - Artifact artifact = artifactFactory.createDependencyArtifact( - d.getGroupId(), - d.getArtifactId(), - versionRange, - d.getType(), - d.getClassifier(), - d.getScope(), - d.isOptional()); - - if (Artifact.SCOPE_SYSTEM.equals(d.getScope()) && d.getSystemPath() != null) { - artifact.setFile(new File(d.getSystemPath())); - } - - if (!d.getExclusions().isEmpty()) { - List exclusions = new ArrayList<>(); - - for (Exclusion exclusion : d.getExclusions()) { - exclusions.add(exclusion.getGroupId() + ':' + exclusion.getArtifactId()); - } - - artifact.setDependencyFilter(new ExcludesArtifactFilter(exclusions)); - } - - return artifact; - } - - public Artifact createExtensionArtifact(String groupId, String artifactId, String version) { - VersionRange versionRange; - try { - versionRange = VersionRange.createFromVersionSpec(version); - } catch (InvalidVersionSpecificationException e) { - // MNG-5368: Log a message instead of returning 'null' silently. - this.logger.error( - String.format( - "Invalid version specification '%s' creating extension artifact '%s:%s:%s'.", - version, groupId, artifactId, version), - e); - - return null; - } - - return artifactFactory.createExtensionArtifact(groupId, artifactId, versionRange); - } - - public Artifact createParentArtifact(String groupId, String artifactId, String version) { - return artifactFactory.createParentArtifact(groupId, artifactId, version); - } - - public Artifact createPluginArtifact(Plugin plugin) { - String version = plugin.getVersion(); - if (version == null || version.isEmpty()) { - version = "RELEASE"; - } - - VersionRange versionRange; - try { - versionRange = VersionRange.createFromVersionSpec(version); - } catch (InvalidVersionSpecificationException e) { - // MNG-5368: Log a message instead of returning 'null' silently. - this.logger.error( - String.format("Invalid version specification '%s' creating plugin artifact '%s'.", version, plugin), - e); - - return null; - } - - return artifactFactory.createPluginArtifact(plugin.getGroupId(), plugin.getArtifactId(), versionRange); - } - - public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(RepositoryPolicy policy) { - boolean enabled = true; - - String updatePolicy = null; - - String checksumPolicy = null; - - if (policy != null) { - enabled = policy.isEnabled(); - - if (policy.getUpdatePolicy() != null) { - updatePolicy = policy.getUpdatePolicy(); - } - if (policy.getChecksumPolicy() != null) { - checksumPolicy = policy.getChecksumPolicy(); - } - } - - return new ArtifactRepositoryPolicy(enabled, updatePolicy, checksumPolicy); - } - - public ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException { - return createLocalRepository(RepositorySystem.defaultUserLocalRepository); - } - - public ArtifactRepository createLocalRepository(File localRepository) throws InvalidRepositoryException { - return createRepository( - "file://" + localRepository.toURI().getRawPath(), - RepositorySystem.DEFAULT_LOCAL_REPO_ID, - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE); - } - - public ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException { - return createRepository( - RepositorySystem.DEFAULT_REMOTE_REPO_URL, - RepositorySystem.DEFAULT_REMOTE_REPO_ID, - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, - false, - ArtifactRepositoryPolicy.UPDATE_POLICY_DAILY, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN); - } - - public ArtifactRepository createLocalRepository(String url, String repositoryId) throws IOException { - return createRepository( - canonicalFileUrl(url), - repositoryId, - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE); - } - - private String canonicalFileUrl(String url) throws IOException { - if (!url.startsWith("file:")) { - url = "file://" + url; - } else if (url.startsWith("file:") && !url.startsWith("file://")) { - url = "file://" + url.substring("file:".length()); - } - - // So now we have an url of the form file:// - - // We want to eliminate any relative path nonsense and lock down the path so we - // need to fully resolve it before any submodules use the path. This can happen - // when you are using a custom settings.xml that contains a relative path entry - // for the local repository setting. - - File localRepository = new File(url.substring("file://".length())); - - if (!localRepository.isAbsolute()) { - url = "file://" + localRepository.getCanonicalPath(); - } - - return url; - } - - public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) { - /* - * Probably is not worth it, but here I make sure I restore request - * to its original state. - */ - try { - LocalArtifactRepository ideWorkspace = - plexus.lookup(LocalArtifactRepository.class, LocalArtifactRepository.IDE_WORKSPACE); - - if (request.getLocalRepository() instanceof DelegatingLocalArtifactRepository) { - DelegatingLocalArtifactRepository delegatingLocalRepository = - (DelegatingLocalArtifactRepository) request.getLocalRepository(); - - LocalArtifactRepository orig = delegatingLocalRepository.getIdeWorkspace(); - - delegatingLocalRepository.setIdeWorkspace(ideWorkspace); - - try { - return artifactResolver.resolve(request); - } finally { - delegatingLocalRepository.setIdeWorkspace(orig); - } - } else { - ArtifactRepository localRepository = request.getLocalRepository(); - DelegatingLocalArtifactRepository delegatingLocalRepository = - new DelegatingLocalArtifactRepository(localRepository); - delegatingLocalRepository.setIdeWorkspace(ideWorkspace); - request.setLocalRepository(delegatingLocalRepository); - try { - return artifactResolver.resolve(request); - } finally { - request.setLocalRepository(localRepository); - } - } - } catch (ComponentLookupException e) { - // no ide workspace artifact resolution - } - - return artifactResolver.resolve(request); - } - - // public void addProxy( String protocol, String host, int port, String username, String password, - // String nonProxyHosts ) - // { - // ProxyInfo proxyInfo = new ProxyInfo(); - // proxyInfo.setHost( host ); - // proxyInfo.setType( protocol ); - // proxyInfo.setPort( port ); - // proxyInfo.setNonProxyHosts( nonProxyHosts ); - // proxyInfo.setUserName( username ); - // proxyInfo.setPassword( password ); - // - // proxies.put( protocol, proxyInfo ); - // - // wagonManager.addProxy( protocol, host, port, username, password, nonProxyHosts ); - // } - - public List getEffectiveRepositories(List repositories) { - if (repositories == null) { - return null; - } - - Map> reposByKey = new LinkedHashMap<>(); - - for (ArtifactRepository repository : repositories) { - String key = repository.getId(); - - List aliasedRepos = reposByKey.computeIfAbsent(key, k -> new ArrayList<>()); - - aliasedRepos.add(repository); - } - - List effectiveRepositories = new ArrayList<>(); - - for (List aliasedRepos : reposByKey.values()) { - List mirroredRepos = new ArrayList<>(); - - List releasePolicies = new ArrayList<>(aliasedRepos.size()); - - for (ArtifactRepository aliasedRepo : aliasedRepos) { - releasePolicies.add(aliasedRepo.getReleases()); - mirroredRepos.addAll(aliasedRepo.getMirroredRepositories()); - } - - ArtifactRepositoryPolicy releasePolicy = getEffectivePolicy(releasePolicies); - - List snapshotPolicies = new ArrayList<>(aliasedRepos.size()); - - for (ArtifactRepository aliasedRepo : aliasedRepos) { - snapshotPolicies.add(aliasedRepo.getSnapshots()); - } - - ArtifactRepositoryPolicy snapshotPolicy = getEffectivePolicy(snapshotPolicies); - - ArtifactRepository aliasedRepo = aliasedRepos.get(0); - - ArtifactRepository effectiveRepository = createArtifactRepository( - aliasedRepo.getId(), aliasedRepo.getUrl(), aliasedRepo.getLayout(), snapshotPolicy, releasePolicy); - - effectiveRepository.setAuthentication(aliasedRepo.getAuthentication()); - - effectiveRepository.setProxy(aliasedRepo.getProxy()); - - effectiveRepository.setMirroredRepositories(mirroredRepos); - - effectiveRepository.setBlocked(aliasedRepo.isBlocked()); - - effectiveRepositories.add(effectiveRepository); - } - - return effectiveRepositories; - } - - private ArtifactRepositoryPolicy getEffectivePolicy(Collection policies) { - ArtifactRepositoryPolicy effectivePolicy = null; - - for (ArtifactRepositoryPolicy policy : policies) { - if (effectivePolicy == null) { - effectivePolicy = new ArtifactRepositoryPolicy(policy); - } else { - effectivePolicy.merge(policy); - } - } - - return effectivePolicy; - } - - public Mirror getMirror(ArtifactRepository repository, List mirrors) { - return mirrorSelector.getMirror(repository, mirrors); - } - - public void injectMirror(List repositories, List mirrors) { - if (repositories != null && mirrors != null) { - for (ArtifactRepository repository : repositories) { - Mirror mirror = getMirror(repository, mirrors); - injectMirror(repository, mirror); - } - } - } - - private Mirror getMirror(RepositorySystemSession session, ArtifactRepository repository) { - if (session != null) { - org.eclipse.aether.repository.MirrorSelector selector = session.getMirrorSelector(); - if (selector != null) { - RemoteRepository repo = selector.getMirror(RepositoryUtils.toRepo(repository)); - if (repo != null) { - Mirror mirror = new Mirror(); - mirror.setId(repo.getId()); - mirror.setUrl(repo.getUrl()); - mirror.setLayout(repo.getContentType()); - mirror.setBlocked(repo.isBlocked()); - return mirror; - } - } - } - return null; - } - - public void injectMirror(RepositorySystemSession session, List repositories) { - if (repositories != null && session != null) { - for (ArtifactRepository repository : repositories) { - Mirror mirror = getMirror(session, repository); - injectMirror(repository, mirror); - } - } - } - - private void injectMirror(ArtifactRepository repository, Mirror mirror) { - if (mirror != null) { - ArtifactRepository original = createArtifactRepository( - repository.getId(), - repository.getUrl(), - repository.getLayout(), - repository.getSnapshots(), - repository.getReleases()); - - repository.setMirroredRepositories(Collections.singletonList(original)); - - repository.setId(mirror.getId()); - repository.setUrl(mirror.getUrl()); - - if (mirror.getLayout() != null && !mirror.getLayout().isEmpty()) { - repository.setLayout(getLayout(mirror.getLayout())); - } - - repository.setBlocked(mirror.isBlocked()); - } - } - - public void injectAuthentication(List repositories, List servers) { - if (repositories != null) { - Map serversById = new HashMap<>(); - - if (servers != null) { - for (Server server : servers) { - if (!serversById.containsKey(server.getId())) { - serversById.put(server.getId(), server); - } - } - } - - for (ArtifactRepository repository : repositories) { - Server server = serversById.get(repository.getId()); - - if (server != null) { - SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(server); - SettingsDecryptionResult result = settingsDecrypter.decrypt(request); - server = result.getServer(); - - if (logger.isDebugEnabled()) { - for (SettingsProblem problem : result.getProblems()) { - logger.debug(problem.getMessage(), problem.getException()); - } - } - - Authentication authentication = new Authentication(server.getUsername(), server.getPassword()); - authentication.setPrivateKey(server.getPrivateKey()); - authentication.setPassphrase(server.getPassphrase()); - - repository.setAuthentication(authentication); - } else { - repository.setAuthentication(null); - } - } - } - } - - private Authentication getAuthentication(RepositorySystemSession session, ArtifactRepository repository) { - if (session != null) { - AuthenticationSelector selector = session.getAuthenticationSelector(); - if (selector != null) { - RemoteRepository repo = RepositoryUtils.toRepo(repository); - org.eclipse.aether.repository.Authentication auth = selector.getAuthentication(repo); - if (auth != null) { - repo = new RemoteRepository.Builder(repo) - .setAuthentication(auth) - .build(); - AuthenticationContext authCtx = AuthenticationContext.forRepository(session, repo); - Authentication result = new Authentication( - authCtx.get(AuthenticationContext.USERNAME), authCtx.get(AuthenticationContext.PASSWORD)); - result.setPrivateKey(authCtx.get(AuthenticationContext.PRIVATE_KEY_PATH)); - result.setPassphrase(authCtx.get(AuthenticationContext.PRIVATE_KEY_PASSPHRASE)); - authCtx.close(); - return result; - } - } - } - return null; - } - - public void injectAuthentication(RepositorySystemSession session, List repositories) { - if (repositories != null && session != null) { - for (ArtifactRepository repository : repositories) { - repository.setAuthentication(getAuthentication(session, repository)); - } - } - } - - private org.apache.maven.settings.Proxy getProxy( - ArtifactRepository repository, List proxies) { - if (proxies != null && repository.getProtocol() != null) { - for (org.apache.maven.settings.Proxy proxy : proxies) { - if (proxy.isActive() && repository.getProtocol().equalsIgnoreCase(proxy.getProtocol())) { - if (proxy.getNonProxyHosts() != null - && !proxy.getNonProxyHosts().isEmpty()) { - ProxyInfo pi = new ProxyInfo(); - pi.setNonProxyHosts(proxy.getNonProxyHosts()); - - org.apache.maven.wagon.repository.Repository repo = - new org.apache.maven.wagon.repository.Repository( - repository.getId(), repository.getUrl()); - - if (!ProxyUtils.validateNonProxyHosts(pi, repo.getHost())) { - return proxy; - } - } else { - return proxy; - } - } - } - } - - return null; - } - - public void injectProxy(List repositories, List proxies) { - if (repositories != null) { - for (ArtifactRepository repository : repositories) { - org.apache.maven.settings.Proxy proxy = getProxy(repository, proxies); - - if (proxy != null) { - SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(proxy); - SettingsDecryptionResult result = settingsDecrypter.decrypt(request); - proxy = result.getProxy(); - - if (logger.isDebugEnabled()) { - for (SettingsProblem problem : result.getProblems()) { - logger.debug(problem.getMessage(), problem.getException()); - } - } - - Proxy p = new Proxy(); - p.setHost(proxy.getHost()); - p.setProtocol(proxy.getProtocol()); - p.setPort(proxy.getPort()); - p.setNonProxyHosts(proxy.getNonProxyHosts()); - p.setUserName(proxy.getUsername()); - p.setPassword(proxy.getPassword()); - - repository.setProxy(p); - } else { - repository.setProxy(null); - } - } - } - } - - private Proxy getProxy(RepositorySystemSession session, ArtifactRepository repository) { - if (session != null) { - ProxySelector selector = session.getProxySelector(); - if (selector != null) { - RemoteRepository repo = RepositoryUtils.toRepo(repository); - org.eclipse.aether.repository.Proxy proxy = selector.getProxy(repo); - if (proxy != null) { - Proxy p = new Proxy(); - p.setHost(proxy.getHost()); - p.setProtocol(proxy.getType()); - p.setPort(proxy.getPort()); - if (proxy.getAuthentication() != null) { - repo = new RemoteRepository.Builder(repo) - .setProxy(proxy) - .build(); - AuthenticationContext authCtx = AuthenticationContext.forProxy(session, repo); - p.setUserName(authCtx.get(AuthenticationContext.USERNAME)); - p.setPassword(authCtx.get(AuthenticationContext.PASSWORD)); - p.setNtlmDomain(authCtx.get(AuthenticationContext.NTLM_DOMAIN)); - p.setNtlmHost(authCtx.get(AuthenticationContext.NTLM_WORKSTATION)); - authCtx.close(); - } - return p; - } - } - } - return null; - } - - public void injectProxy(RepositorySystemSession session, List repositories) { - if (repositories != null && session != null) { - for (ArtifactRepository repository : repositories) { - repository.setProxy(getProxy(session, repository)); - } - } - } - - public void retrieve( - ArtifactRepository repository, - File destination, - String remotePath, - ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException, ArtifactDoesNotExistException { - try { - wagonManager.getRemoteFile( - repository, - destination, - remotePath, - TransferListenerAdapter.newAdapter(transferListener), - ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN, - true); - } catch (org.apache.maven.wagon.TransferFailedException e) { - throw new ArtifactTransferFailedException(getMessage(e, "Error transferring artifact."), e); - } catch (org.apache.maven.wagon.ResourceDoesNotExistException e) { - throw new ArtifactDoesNotExistException(getMessage(e, "Requested artifact does not exist."), e); - } - } - - public void publish( - ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException { - try { - wagonManager.putRemoteFile( - repository, source, remotePath, TransferListenerAdapter.newAdapter(transferListener)); - } catch (org.apache.maven.wagon.TransferFailedException e) { - throw new ArtifactTransferFailedException(getMessage(e, "Error transferring artifact."), e); - } - } - - // - // Artifact Repository Creation - // - public ArtifactRepository buildArtifactRepository(Repository repo) throws InvalidRepositoryException { - if (repo != null) { - String id = repo.getId(); - - if (id == null || id.isEmpty()) { - throw new InvalidRepositoryException("Repository identifier missing", ""); - } - - String url = repo.getUrl(); - - if (url == null || url.isEmpty()) { - throw new InvalidRepositoryException("URL missing for repository " + id, id); - } - - ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy(repo.getSnapshots()); - - ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy(repo.getReleases()); - - return createArtifactRepository(id, url, getLayout(repo.getLayout()), snapshots, releases); - } else { - return null; - } - } - - private ArtifactRepository createRepository( - String url, - String repositoryId, - boolean releases, - String releaseUpdates, - boolean snapshots, - String snapshotUpdates, - String checksumPolicy) { - ArtifactRepositoryPolicy snapshotsPolicy = - new ArtifactRepositoryPolicy(snapshots, snapshotUpdates, checksumPolicy); - - ArtifactRepositoryPolicy releasesPolicy = - new ArtifactRepositoryPolicy(releases, releaseUpdates, checksumPolicy); - - return createArtifactRepository(repositoryId, url, null, snapshotsPolicy, releasesPolicy); - } - - public ArtifactRepository createArtifactRepository( - String repositoryId, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) { - if (repositoryLayout == null) { - repositoryLayout = layouts.get("default"); - } - return artifactRepositoryFactory.createArtifactRepository( - repositoryId, url, repositoryLayout, snapshots, releases); - } - - private static String getMessage(Throwable error, String def) { - if (error == null) { - return def; - } - String msg = error.getMessage(); - if (msg != null && !msg.isEmpty()) { - return msg; - } - return getMessage(error.getCause(), def); - } - - private ArtifactRepositoryLayout getLayout(String id) { - ArtifactRepositoryLayout layout = layouts.get(id); - - if (layout == null) { - layout = new UnknownRepositoryLayout(id, layouts.get("default")); - } - - return layout; - } - - /** - * In the future, the legacy system might encounter repository types for which no layout components exists because - * the actual communication with the repository happens via a repository connector. As a minimum, the legacy system - * needs to retain the id of this layout so that the content type of the remote repository can still be accurately - * described. - */ - static class UnknownRepositoryLayout implements ArtifactRepositoryLayout { - - private final String id; - - private final ArtifactRepositoryLayout fallback; - - UnknownRepositoryLayout(String id, ArtifactRepositoryLayout fallback) { - this.id = id; - this.fallback = fallback; - } - - public String getId() { - return id; - } - - public String pathOf(Artifact artifact) { - return fallback.pathOf(artifact); - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return fallback.pathOfLocalRepositoryMetadata(metadata, repository); - } - - public String pathOfRemoteRepositoryMetadata(ArtifactMetadata metadata) { - return fallback.pathOfRemoteRepositoryMetadata(metadata); - } - - @Override - public String toString() { - return getId(); - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java deleted file mode 100644 index 8051ded0255e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import org.apache.maven.repository.ArtifactTransferResource; -import org.apache.maven.wagon.resource.Resource; - -@Deprecated -class MavenArtifact implements ArtifactTransferResource { - - private String repositoryUrl; - - private Resource resource; - - private long transferStartTime; - - MavenArtifact(String repositoryUrl, Resource resource) { - if (repositoryUrl == null) { - this.repositoryUrl = ""; - } else if (!repositoryUrl.endsWith("/") && !repositoryUrl.isEmpty()) { - this.repositoryUrl = repositoryUrl + '/'; - } else { - this.repositoryUrl = repositoryUrl; - } - this.resource = resource; - - this.transferStartTime = System.currentTimeMillis(); - } - - public String getRepositoryUrl() { - return repositoryUrl; - } - - public String getName() { - String name = resource.getName(); - - if (name == null) { - name = ""; - } else if (name.startsWith("/")) { - name = name.substring(1); - } - - return name; - } - - public String getUrl() { - return getRepositoryUrl() + getName(); - } - - public long getContentLength() { - return resource.getContentLength(); - } - - public long getTransferStartTime() { - return transferStartTime; - } - - @Override - public String toString() { - return getUrl(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java deleted file mode 100644 index e6d533105f07..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import java.util.IdentityHashMap; -import java.util.Map; - -import org.apache.maven.repository.ArtifactTransferEvent; -import org.apache.maven.repository.ArtifactTransferListener; -import org.apache.maven.repository.ArtifactTransferResource; -import org.apache.maven.wagon.events.TransferEvent; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.repository.Repository; -import org.apache.maven.wagon.resource.Resource; - -/** - * TransferListenerAdapter - */ -@Deprecated -public class TransferListenerAdapter implements TransferListener { - - private final ArtifactTransferListener listener; - - private final Map artifacts; - - private final Map transfers; - - public static TransferListener newAdapter(ArtifactTransferListener listener) { - if (listener == null) { - return null; - } else { - return new TransferListenerAdapter(listener); - } - } - - private TransferListenerAdapter(ArtifactTransferListener listener) { - this.listener = listener; - this.artifacts = new IdentityHashMap<>(); - this.transfers = new IdentityHashMap<>(); - } - - public void debug(String message) {} - - public void transferCompleted(TransferEvent transferEvent) { - ArtifactTransferEvent event = wrap(transferEvent); - - Long transferred; - synchronized (transfers) { - transferred = transfers.remove(transferEvent.getResource()); - } - if (transferred != null) { - event.setTransferredBytes(transferred); - } - - synchronized (artifacts) { - artifacts.remove(transferEvent.getResource()); - } - - listener.transferCompleted(event); - } - - public void transferError(TransferEvent transferEvent) { - synchronized (transfers) { - transfers.remove(transferEvent.getResource()); - } - synchronized (artifacts) { - artifacts.remove(transferEvent.getResource()); - } - } - - public void transferInitiated(TransferEvent transferEvent) { - listener.transferInitiated(wrap(transferEvent)); - } - - public void transferProgress(TransferEvent transferEvent, byte[] buffer, int length) { - Long transferred; - synchronized (transfers) { - transferred = transfers.get(transferEvent.getResource()); - if (transferred == null) { - transferred = (long) length; - } else { - transferred = transferred + length; - } - transfers.put(transferEvent.getResource(), transferred); - } - - ArtifactTransferEvent event = wrap(transferEvent); - event.setDataBuffer(buffer); - event.setDataOffset(0); - event.setDataLength(length); - event.setTransferredBytes(transferred); - - listener.transferProgress(event); - } - - public void transferStarted(TransferEvent transferEvent) { - listener.transferStarted(wrap(transferEvent)); - } - - private ArtifactTransferEvent wrap(TransferEvent event) { - if (event == null) { - return null; - } else { - String wagon = event.getWagon().getClass().getName(); - - ArtifactTransferResource artifact = wrap(event.getWagon().getRepository(), event.getResource()); - - ArtifactTransferEvent evt; - if (event.getException() != null) { - evt = new ArtifactTransferEvent(wagon, event.getException(), event.getRequestType(), artifact); - } else { - evt = new ArtifactTransferEvent(wagon, event.getEventType(), event.getRequestType(), artifact); - } - - evt.setLocalFile(event.getLocalFile()); - - return evt; - } - } - - private ArtifactTransferResource wrap(Repository repository, Resource resource) { - if (resource == null) { - return null; - } else { - synchronized (artifacts) { - ArtifactTransferResource artifact = artifacts.get(resource); - - if (artifact == null) { - artifact = new MavenArtifact(repository.getUrl(), resource); - artifacts.put(resource, artifact); - } - - return artifact; - } - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java deleted file mode 100644 index 957594f57c1a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import java.io.File; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; - -/** - * UpdateCheckManager - */ -@Deprecated -public interface UpdateCheckManager { - - boolean isUpdateRequired(Artifact artifact, ArtifactRepository repository); - - void touch(Artifact artifact, ArtifactRepository repository, String error); - - String getError(Artifact artifact, ArtifactRepository repository); - - boolean isUpdateRequired(RepositoryMetadata metadata, ArtifactRepository repository, File file); - - void touch(RepositoryMetadata metadata, ArtifactRepository repository, File file); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java deleted file mode 100644 index 1ebe551c8b96..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import org.apache.maven.wagon.TransferFailedException; - -/** - * WagonConfigurationException - */ -@Deprecated -public class WagonConfigurationException extends TransferFailedException { - - static final long serialVersionUID = 1; - - private final String originalMessage; - private final String repositoryId; - - public WagonConfigurationException(String repositoryId, String message, Throwable cause) { - super("While configuring wagon for '" + repositoryId + "': " + message, cause); - - this.repositoryId = repositoryId; - this.originalMessage = message; - } - - public WagonConfigurationException(String repositoryId, String message) { - super("While configuring wagon for '" + repositoryId + "': " + message); - - this.repositoryId = repositoryId; - this.originalMessage = message; - } - - public final String getRepositoryId() { - return repositoryId; - } - - public final String getOriginalMessage() { - return originalMessage; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java deleted file mode 100644 index 697e86af6e21..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import java.io.File; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.repository.Repository; - -/** - * WagonManager - */ -@Deprecated -public interface WagonManager { - @Deprecated - Wagon getWagon(String protocol) throws UnsupportedProtocolException; - - @Deprecated - Wagon getWagon(Repository repository) throws UnsupportedProtocolException, WagonConfigurationException; - - // - // Retriever - // - void getArtifact(Artifact artifact, ArtifactRepository repository, TransferListener transferListener, boolean force) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifact( - Artifact artifact, - List remoteRepositories, - TransferListener transferListener, - boolean force) - throws TransferFailedException, ResourceDoesNotExistException; - - void getRemoteFile( - ArtifactRepository repository, - File destination, - String remotePath, - TransferListener downloadMonitor, - String checksumPolicy, - boolean force) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifactMetadata( - ArtifactMetadata metadata, ArtifactRepository remoteRepository, File destination, String checksumPolicy) - throws TransferFailedException, ResourceDoesNotExistException; - - void getArtifactMetadataFromDeploymentRepository( - ArtifactMetadata metadata, ArtifactRepository remoteRepository, File file, String checksumPolicyWarn) - throws TransferFailedException, ResourceDoesNotExistException; - - // - // Deployer - // - void putArtifact( - File source, Artifact artifact, ArtifactRepository deploymentRepository, TransferListener downloadMonitor) - throws TransferFailedException; - - void putRemoteFile(ArtifactRepository repository, File source, String remotePath, TransferListener downloadMonitor) - throws TransferFailedException; - - void putArtifactMetadata(File source, ArtifactMetadata artifactMetadata, ArtifactRepository repository) - throws TransferFailedException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java deleted file mode 100644 index a02af146070b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/AbstractArtifactMetadata.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import org.apache.maven.artifact.Artifact; - -/** - * Common elements of artifact metadata. - * - */ -@Deprecated -public abstract class AbstractArtifactMetadata implements ArtifactMetadata { - private static final String LS = System.lineSeparator(); - - protected Artifact artifact; - - protected AbstractArtifactMetadata(Artifact artifact) { - this.artifact = artifact; - } - - public boolean storedInGroupDirectory() { - return false; - } - - public String getGroupId() { - return artifact.getGroupId(); - } - - public String getArtifactId() { - return artifact.getArtifactId(); - } - - public String extendedToString() { - StringBuilder buffer = new StringBuilder(256); - - buffer.append(LS).append("Artifact Metadata").append(LS).append("--------------------------"); - buffer.append(LS).append("GroupId: ").append(getGroupId()); - buffer.append(LS).append("ArtifactId: ").append(getArtifactId()); - buffer.append(LS).append("Metadata Type: ").append(getClass().getName()); - - return buffer.toString(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java deleted file mode 100644 index a065eeda7709..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataRetrievalException.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import org.apache.maven.artifact.Artifact; - -/** - * Error while retrieving repository metadata from the repository. - * - */ -@Deprecated -public class ArtifactMetadataRetrievalException extends Exception { - private Artifact artifact; - - /** - * @param message a message - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(String message) { - this(message, null, null); - } - - /** - * @param cause a cause - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(Throwable cause) { - this(null, cause, null); - } - - /** - * @param message a message - * @param cause a cause - * @deprecated use {@link #ArtifactMetadataRetrievalException(String, Throwable, Artifact)} - */ - @Deprecated - public ArtifactMetadataRetrievalException(String message, Throwable cause) { - this(message, cause, null); - } - - public ArtifactMetadataRetrievalException(String message, Throwable cause, Artifact artifact) { - super(message, cause); - this.artifact = artifact; - } - - public Artifact getArtifact() { - return artifact; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java deleted file mode 100644 index 45094119e8ec..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ArtifactMetadataSource.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; - -/** - * Provides some metadata operations, like querying the remote repository for a list of versions available for an - * artifact. - * - */ -@Deprecated -public interface ArtifactMetadataSource { - - ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException; - - ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException; - - /** - * Get a list of available versions for an artifact in the remote repository - * - * @param artifact artifact we are interested in. Only groupid and artifactId - * are needed, for instance the following code will work - * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) - * @param localRepository local repository - * @param remoteRepositories remote repositories, {@link List} $lt; {@link ArtifactRepository} > - * @return {@link List} $lt; {@link ArtifactVersion} > - * @throws ArtifactMetadataRetrievalException - * in case of error while retrieving repository metadata from the repository. - */ - List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException; - - /** - * Get a list of available versions for an artifact in the remote deployment repository. This ignores any update - * policy checks and mirrors and always retrieves the latest information from the given repository. - * - * @param artifact artifact we are interested in. Only groupid and artifactId are - * needed, for instance the following code will work - * artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" ) - * @param localRepository local repository - * @param remoteRepository remote repository - * @return {@link List} $lt; {@link ArtifactVersion} > - * @throws ArtifactMetadataRetrievalException - * in case of error while retrieving repository metadata from the repository. - */ - List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java deleted file mode 100644 index 6e09aa5340eb..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/DefaultMetadataResolutionRequest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultRepositoryRequest; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; - -/** - * Forms a request to retrieve artifact metadata. - * - */ -@Deprecated -public class DefaultMetadataResolutionRequest implements MetadataResolutionRequest { - - private Artifact artifact; - - private boolean resolveManagedVersions; - - private RepositoryRequest repositoryRequest; - - public DefaultMetadataResolutionRequest() { - repositoryRequest = new DefaultRepositoryRequest(); - } - - public DefaultMetadataResolutionRequest(RepositoryRequest repositoryRequest) { - this.repositoryRequest = new DefaultRepositoryRequest(repositoryRequest); - } - - public DefaultMetadataResolutionRequest(ArtifactResolutionRequest resolutionRequest) { - this.repositoryRequest = new DefaultRepositoryRequest(resolutionRequest); - } - - public Artifact getArtifact() { - return artifact; - } - - public DefaultMetadataResolutionRequest setArtifact(Artifact artifact) { - this.artifact = artifact; - - return this; - } - - public ArtifactRepository getLocalRepository() { - return repositoryRequest.getLocalRepository(); - } - - public DefaultMetadataResolutionRequest setLocalRepository(ArtifactRepository localRepository) { - repositoryRequest.setLocalRepository(localRepository); - - return this; - } - - public List getRemoteRepositories() { - return repositoryRequest.getRemoteRepositories(); - } - - public DefaultMetadataResolutionRequest setRemoteRepositories(List remoteRepositories) { - repositoryRequest.setRemoteRepositories(remoteRepositories); - - return this; - } - - public boolean isResolveManagedVersions() { - return resolveManagedVersions; - } - - public DefaultMetadataResolutionRequest setResolveManagedVersions(boolean resolveManagedVersions) { - this.resolveManagedVersions = resolveManagedVersions; - - return this; - } - - public boolean isOffline() { - return repositoryRequest.isOffline(); - } - - public DefaultMetadataResolutionRequest setOffline(boolean offline) { - repositoryRequest.setOffline(offline); - - return this; - } - - public boolean isForceUpdate() { - return repositoryRequest.isForceUpdate(); - } - - public DefaultMetadataResolutionRequest setForceUpdate(boolean forceUpdate) { - repositoryRequest.setForceUpdate(forceUpdate); - - return this; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java deleted file mode 100644 index 819e182c9102..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/MetadataResolutionRequest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; - -/** - * Forms a request to retrieve artifact metadata. - * - */ -@Deprecated -public interface MetadataResolutionRequest extends RepositoryRequest { - - /** - * Indicates whether network access to remote repositories has been disabled. - * - * @return {@code true} if remote access has been disabled, {@code false} otherwise. - */ - boolean isOffline(); - - /** - * Enables/disables network access to remote repositories. - * - * @param offline {@code true} to disable remote access, {@code false} to allow network access. - * @return This request, never {@code null}. - */ - MetadataResolutionRequest setOffline(boolean offline); - - /** - * Gets the artifact to resolve metadata for. - * - * @return The artifact to resolve metadata for or {@code null} if not set. - */ - Artifact getArtifact(); - - /** - * Sets the artifact for which to resolve metadata. - * - * @param artifact The artifact for which to resolve metadata. - * @return This request, never {@code null}. - */ - MetadataResolutionRequest setArtifact(Artifact artifact); - - /** - * Gets the local repository to use for the resolution. - * - * @return The local repository to use for the resolution or {@code null} if not set. - */ - ArtifactRepository getLocalRepository(); - - /** - * Sets the local repository to use for the resolution. - * - * @param localRepository The local repository to use for the resolution. - * @return This request, never {@code null}. - */ - MetadataResolutionRequest setLocalRepository(ArtifactRepository localRepository); - - /** - * Gets the remote repositories to use for the resolution. - * - * @return The remote repositories to use for the resolution, never {@code null}. - */ - List getRemoteRepositories(); - - /** - * Sets the remote repositories to use for the resolution. - * - * @param remoteRepositories The remote repositories to use for the resolution. - * @return This request, never {@code null}. - */ - MetadataResolutionRequest setRemoteRepositories(List remoteRepositories); - - /** - * Determines whether the managed version information should be retrieved. - * - * @return {@code true} if the dependency management information should be retrieved, {@code false} otherwise. - */ - boolean isResolveManagedVersions(); - - /** - * Enables/disables resolution of the dependency management information. - * - * @param resolveManagedVersions {@code true} if the dependency management information should be retrieved, {@code - * false} otherwise. - * @return This request, never {@code null}. - */ - MetadataResolutionRequest setResolveManagedVersions(boolean resolveManagedVersions); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java deleted file mode 100644 index 1bb1c9c735c4..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/metadata/ResolutionGroup.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.metadata; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * ResolutionGroup - */ -@Deprecated -public class ResolutionGroup { - - private final Set artifacts; - - private final List resolutionRepositories; - - private final Artifact pomArtifact; - - private final Artifact relocatedArtifact; - - private final Map managedVersions; - - public ResolutionGroup( - Artifact pomArtifact, Set artifacts, List resolutionRepositories) { - this(pomArtifact, null, artifacts, null, resolutionRepositories); - } - - public ResolutionGroup( - Artifact pomArtifact, - Artifact relocatedArtifact, - Set artifacts, - Map managedVersions, - List resolutionRepositories) { - this.pomArtifact = pomArtifact; - this.relocatedArtifact = relocatedArtifact; - this.artifacts = artifacts; - this.managedVersions = managedVersions; - this.resolutionRepositories = resolutionRepositories; - } - - public Artifact getPomArtifact() { - return pomArtifact; - } - - public Artifact getRelocatedArtifact() { - return relocatedArtifact; - } - - public Set getArtifacts() { - return artifacts; - } - - public List getResolutionRepositories() { - return resolutionRepositories; - } - - public Map getManagedVersions() { - return managedVersions; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java deleted file mode 100644 index 2abe5ea84b8b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.repository; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; - -@Deprecated -public interface ArtifactRepositoryFactory { - - String DEFAULT_LAYOUT_ID = "default"; - - String LOCAL_REPOSITORY_ID = "local"; - - @Deprecated - ArtifactRepositoryLayout getLayout(String layoutId) throws UnknownRepositoryLayoutException; - - @Deprecated - ArtifactRepository createDeploymentArtifactRepository(String id, String url, String layoutId, boolean uniqueVersion) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createDeploymentArtifactRepository( - String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion); - - ArtifactRepository createArtifactRepository( - String id, - String url, - String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) - throws UnknownRepositoryLayoutException; - - ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases); - - void setGlobalUpdatePolicy(String snapshotPolicy); - - void setGlobalChecksumPolicy(String checksumPolicy); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java deleted file mode 100644 index 34dd8e860d1b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.repository; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Map; - -import org.apache.maven.artifact.UnknownRepositoryLayoutException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.MavenArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactRepositoryFactory implements ArtifactRepositoryFactory { - // TODO use settings? - private String globalUpdatePolicy; - - private String globalChecksumPolicy; - - @Inject - private Map repositoryLayouts; - - public ArtifactRepositoryLayout getLayout(String layoutId) throws UnknownRepositoryLayoutException { - return repositoryLayouts.get(layoutId); - } - - public ArtifactRepository createDeploymentArtifactRepository( - String id, String url, String layoutId, boolean uniqueVersion) throws UnknownRepositoryLayoutException { - ArtifactRepositoryLayout layout = repositoryLayouts.get(layoutId); - - checkLayout(id, layoutId, layout); - - return createDeploymentArtifactRepository(id, url, layout, uniqueVersion); - } - - private void checkLayout(String repositoryId, String layoutId, ArtifactRepositoryLayout layout) - throws UnknownRepositoryLayoutException { - if (layout == null) { - throw new UnknownRepositoryLayoutException(repositoryId, layoutId); - } - } - - public ArtifactRepository createDeploymentArtifactRepository( - String id, String url, ArtifactRepositoryLayout repositoryLayout, boolean uniqueVersion) { - return createArtifactRepository(id, url, repositoryLayout, null, null); - } - - public ArtifactRepository createArtifactRepository( - String id, - String url, - String layoutId, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) - throws UnknownRepositoryLayoutException { - ArtifactRepositoryLayout layout = repositoryLayouts.get(layoutId); - - checkLayout(id, layoutId, layout); - - return createArtifactRepository(id, url, layout, snapshots, releases); - } - - public ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) { - if (snapshots == null) { - snapshots = new ArtifactRepositoryPolicy(); - } - - if (releases == null) { - releases = new ArtifactRepositoryPolicy(); - } - - if (globalUpdatePolicy != null) { - snapshots.setUpdatePolicy(globalUpdatePolicy); - releases.setUpdatePolicy(globalUpdatePolicy); - } - - if (globalChecksumPolicy != null) { - snapshots.setChecksumPolicy(globalChecksumPolicy); - releases.setChecksumPolicy(globalChecksumPolicy); - } - - ArtifactRepository repository; - if (repositoryLayout instanceof ArtifactRepositoryLayout2) { - repository = ((ArtifactRepositoryLayout2) repositoryLayout) - .newMavenArtifactRepository(id, url, snapshots, releases); - } else { - repository = new MavenArtifactRepository(id, url, repositoryLayout, snapshots, releases); - } - - return repository; - } - - public void setGlobalUpdatePolicy(String updatePolicy) { - globalUpdatePolicy = updatePolicy; - } - - public void setGlobalChecksumPolicy(String checksumPolicy) { - globalChecksumPolicy = checksumPolicy; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java deleted file mode 100644 index 01ace063816e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java +++ /dev/null @@ -1,753 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.CyclicDependencyException; -import org.apache.maven.artifact.resolver.ResolutionListener; -import org.apache.maven.artifact.resolver.ResolutionListenerForDepMgmt; -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.ManagedVersionMap; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; -import org.codehaus.plexus.logging.Logger; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultLegacyArtifactCollector implements LegacyArtifactCollector { - - @Inject - @Named("nearest") - private ConflictResolver defaultConflictResolver; - - @Inject - private Logger logger; - - @Inject - private LegacySupport legacySupport; - - private void injectSession(ArtifactResolutionRequest request) { - MavenSession session = legacySupport.getSession(); - - if (session != null) { - request.setOffline(session.isOffline()); - request.setForceUpdate(session.getRequest().isUpdateSnapshots()); - request.setServers(session.getRequest().getServers()); - request.setMirrors(session.getRequest().getMirrors()); - request.setProxies(session.getRequest().getProxies()); - } - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers) { - ArtifactResolutionRequest request = new ArtifactResolutionRequest(); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - injectSession(request); - return collect( - artifacts, originatingArtifact, managedVersions, request, source, filter, listeners, conflictResolvers); - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactResolutionRequest repositoryRequest, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers) { - ArtifactResolutionResult result = new ArtifactResolutionResult(); - - result.setOriginatingArtifact(originatingArtifact); - - if (conflictResolvers == null) { - conflictResolvers = Collections.singletonList(defaultConflictResolver); - } - - Map> resolvedArtifacts = new LinkedHashMap<>(); - - ResolutionNode root = new ResolutionNode(originatingArtifact, repositoryRequest.getRemoteRepositories()); - - try { - root.addDependencies(artifacts, repositoryRequest.getRemoteRepositories(), filter); - } catch (CyclicDependencyException e) { - result.addCircularDependencyException(e); - - return result; - } catch (OverConstrainedVersionException e) { - result.addVersionRangeViolation(e); - - return result; - } - - ManagedVersionMap versionMap = getManagedVersionsMap(originatingArtifact, managedVersions); - - try { - recurse( - result, - root, - resolvedArtifacts, - versionMap, - repositoryRequest, - source, - filter, - listeners, - conflictResolvers); - } catch (CyclicDependencyException e) { - logger.debug("While recursing: " + e.getMessage(), e); - result.addCircularDependencyException(e); - } catch (OverConstrainedVersionException e) { - logger.debug("While recursing: " + e.getMessage(), e); - result.addVersionRangeViolation(e); - } catch (ArtifactResolutionException e) { - logger.debug("While recursing: " + e.getMessage(), e); - result.addErrorArtifactException(e); - } - - Set set = new LinkedHashSet<>(); - - for (List nodes : resolvedArtifacts.values()) { - for (ResolutionNode node : nodes) { - if (!node.equals(root) && node.isActive()) { - Artifact artifact = node.getArtifact(); - - try { - if (node.filterTrail(filter)) { - // If it was optional and not a direct dependency, - // we don't add it or its children, just allow the update of the version and artifactScope - if (node.isChildOfRootNode() || !artifact.isOptional()) { - artifact.setDependencyTrail(node.getDependencyTrail()); - - set.add(node); - - // This is required right now. - result.addArtifact(artifact); - } - } - } catch (OverConstrainedVersionException e) { - result.addVersionRangeViolation(e); - } - } - } - } - - result.setArtifactResolutionNodes(set); - - return result; - } - - /** - * Get the map of managed versions, removing the originating artifact if it is also in managed versions - * - * @param originatingArtifact artifact we are processing - * @param managedVersions original managed versions - */ - private ManagedVersionMap getManagedVersionsMap( - Artifact originatingArtifact, Map managedVersions) { - ManagedVersionMap versionMap; - if (managedVersions instanceof ManagedVersionMap) { - versionMap = (ManagedVersionMap) managedVersions; - } else { - versionMap = new ManagedVersionMap(managedVersions); - } - - // remove the originating artifact if it is also in managed versions to avoid being modified during resolution - Artifact managedOriginatingArtifact = versionMap.get(originatingArtifact.getDependencyConflictId()); - - if (managedOriginatingArtifact != null) { - // TODO we probably want to warn the user that he is building an artifact with - // different values than in dependencyManagement - if (managedVersions instanceof ManagedVersionMap) { - /* avoid modifying the managedVersions parameter creating a new map */ - versionMap = new ManagedVersionMap(managedVersions); - } - versionMap.remove(originatingArtifact.getDependencyConflictId()); - } - - return versionMap; - } - - @SuppressWarnings({"checkstyle:parameternumber", "checkstyle:methodlength"}) - private void recurse( - ArtifactResolutionResult result, - ResolutionNode node, - Map> resolvedArtifacts, - ManagedVersionMap managedVersions, - ArtifactResolutionRequest request, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers) - throws ArtifactResolutionException { - fireEvent(ResolutionListener.TEST_ARTIFACT, listeners, node); - - Object key = node.getKey(); - - // TODO Does this check need to happen here? Had to add the same call - // below when we iterate on child nodes -- will that suffice? - if (managedVersions.containsKey(key)) { - manageArtifact(node, managedVersions, listeners); - } - - List previousNodes = resolvedArtifacts.get(key); - - if (previousNodes != null) { - for (ResolutionNode previous : previousNodes) { - try { - if (previous.isActive()) { - // Version mediation - VersionRange previousRange = previous.getArtifact().getVersionRange(); - VersionRange currentRange = node.getArtifact().getVersionRange(); - - if ((previousRange != null) && (currentRange != null)) { - // TODO shouldn't need to double up on this work, only done for simplicity of handling - // recommended - // version but the restriction is identical - VersionRange newRange = previousRange.restrict(currentRange); - // TODO ick. this forces the OCE that should have come from the previous call. It is still - // correct - if (newRange.isSelectedVersionKnown(previous.getArtifact())) { - fireEvent( - ResolutionListener.RESTRICT_RANGE, - listeners, - node, - previous.getArtifact(), - newRange); - } - previous.getArtifact().setVersionRange(newRange); - node.getArtifact().setVersionRange(currentRange.restrict(previousRange)); - - // Select an appropriate available version from the (now restricted) range - // Note this version was selected before to get the appropriate POM - // But it was reset by the call to setVersionRange on restricting the version - ResolutionNode[] resetNodes = {previous, node}; - for (int j = 0; j < 2; j++) { - Artifact resetArtifact = resetNodes[j].getArtifact(); - - // MNG-2123: if the previous node was not a range, then it wouldn't have any available - // versions. We just clobbered the selected version above. (why? I have no idea.) - // So since we are here and this is ranges we must go figure out the version (for a - // third time...) - if (resetArtifact.getVersion() == null && resetArtifact.getVersionRange() != null) { - - // go find the version. This is a total hack. See previous comment. - List versions = resetArtifact.getAvailableVersions(); - if (versions == null) { - try { - MetadataResolutionRequest metadataRequest = - new DefaultMetadataResolutionRequest(request); - - metadataRequest.setArtifact(resetArtifact); - versions = source.retrieveAvailableVersions(metadataRequest); - resetArtifact.setAvailableVersions(versions); - } catch (ArtifactMetadataRetrievalException e) { - resetArtifact.setDependencyTrail(node.getDependencyTrail()); - throw new ArtifactResolutionException( - "Unable to get dependency information: " + e.getMessage(), - resetArtifact, - request.getRemoteRepositories(), - e); - } - } - // end hack - - // MNG-2861: match version can return null - ArtifactVersion selectedVersion = resetArtifact - .getVersionRange() - .matchVersion(resetArtifact.getAvailableVersions()); - - if (selectedVersion != null) { - resetArtifact.selectVersion(selectedVersion.toString()); - } else { - throw new OverConstrainedVersionException( - "Unable to find a version in " + resetArtifact.getAvailableVersions() - + " to match the range " + resetArtifact.getVersionRange(), - resetArtifact); - } - - fireEvent(ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, resetNodes[j]); - } - } - } - - // Conflict Resolution - ResolutionNode resolved = null; - for (Iterator j = conflictResolvers.iterator(); - resolved == null && j.hasNext(); ) { - ConflictResolver conflictResolver = j.next(); - - resolved = conflictResolver.resolveConflict(previous, node); - } - - if (resolved == null) { - // TODO add better exception that can detail the two conflicting artifacts - ArtifactResolutionException are = new ArtifactResolutionException( - "Cannot resolve artifact version conflict between " - + previous.getArtifact().getVersion() + " and " - + node.getArtifact().getVersion(), - previous.getArtifact()); - - result.addVersionRangeViolation(are); - } - - if ((resolved != previous) && (resolved != node)) { - // TODO add better exception - result.addVersionRangeViolation(new ArtifactResolutionException( - "Conflict resolver returned unknown resolution node: ", resolved.getArtifact())); - } - - // TODO should this be part of mediation? - // previous one is more dominant - ResolutionNode nearest; - ResolutionNode farthest; - - if (resolved == previous) { - nearest = previous; - farthest = node; - } else { - nearest = node; - farthest = previous; - } - - if (checkScopeUpdate(farthest, nearest, listeners)) { - // if we need to update artifactScope of nearest to use farthest artifactScope, use the - // nearest version, but farthest artifactScope - nearest.disable(); - farthest.getArtifact() - .setVersion(nearest.getArtifact().getVersion()); - fireEvent(ResolutionListener.OMIT_FOR_NEARER, listeners, nearest, farthest.getArtifact()); - } else { - farthest.disable(); - fireEvent(ResolutionListener.OMIT_FOR_NEARER, listeners, farthest, nearest.getArtifact()); - } - } - } catch (OverConstrainedVersionException e) { - result.addVersionRangeViolation(e); - } - } - } else { - previousNodes = new ArrayList<>(); - - resolvedArtifacts.put(key, previousNodes); - } - previousNodes.add(node); - - if (node.isActive()) { - fireEvent(ResolutionListener.INCLUDE_ARTIFACT, listeners, node); - } - - // don't pull in the transitive deps of a system-scoped dependency. - if (node.isActive() && !Artifact.SCOPE_SYSTEM.equals(node.getArtifact().getScope())) { - fireEvent(ResolutionListener.PROCESS_CHILDREN, listeners, node); - - Artifact parentArtifact = node.getArtifact(); - - for (Iterator i = node.getChildrenIterator(); i.hasNext(); ) { - ResolutionNode child = i.next(); - - try { - - // We leave in optional ones, but don't pick up its dependencies - if (!child.isResolved() && (!child.getArtifact().isOptional() || child.isChildOfRootNode())) { - Artifact artifact = child.getArtifact(); - artifact.setDependencyTrail(node.getDependencyTrail()); - List childRemoteRepositories = child.getRemoteRepositories(); - - MetadataResolutionRequest metadataRequest = new DefaultMetadataResolutionRequest(request); - metadataRequest.setArtifact(artifact); - metadataRequest.setRemoteRepositories(childRemoteRepositories); - - try { - ResolutionGroup rGroup; - - Object childKey; - do { - childKey = child.getKey(); - - if (managedVersions.containsKey(childKey)) { - // If this child node is a managed dependency, ensure - // we are using the dependency management version - // of this child if applicable b/c we want to use the - // managed version's POM, *not* any other version's POM. - // We retrieve the POM below in the retrieval step. - manageArtifact(child, managedVersions, listeners); - - // Also, we need to ensure that any exclusions it presents are - // added to the artifact before we retrieve the metadata - // for the artifact; otherwise we may end up with unwanted - // dependencies. - Artifact ma = managedVersions.get(childKey); - ArtifactFilter managedExclusionFilter = ma.getDependencyFilter(); - if (null != managedExclusionFilter) { - if (null != artifact.getDependencyFilter()) { - AndArtifactFilter aaf = new AndArtifactFilter(); - aaf.add(artifact.getDependencyFilter()); - aaf.add(managedExclusionFilter); - artifact.setDependencyFilter(aaf); - } else { - artifact.setDependencyFilter(managedExclusionFilter); - } - } - } - - if (artifact.getVersion() == null) { - // set the recommended version - // TODO maybe its better to just pass the range through to retrieval and use a - // transformation? - ArtifactVersion version; - if (!artifact.isSelectedVersionKnown()) { - List versions = artifact.getAvailableVersions(); - if (versions == null) { - versions = source.retrieveAvailableVersions(metadataRequest); - artifact.setAvailableVersions(versions); - } - - Collections.sort(versions); - - VersionRange versionRange = artifact.getVersionRange(); - - version = versionRange.matchVersion(versions); - - if (version == null) { - if (versions.isEmpty()) { - throw new OverConstrainedVersionException( - "No versions are present in the repository for the artifact" - + " with a range " + versionRange, - artifact, - childRemoteRepositories); - } - - throw new OverConstrainedVersionException( - "Couldn't find a version in " + versions + " to match range " - + versionRange, - artifact, - childRemoteRepositories); - } - } else { - version = artifact.getSelectedVersion(); - } - - artifact.selectVersion(version.toString()); - fireEvent(ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child); - } - - rGroup = source.retrieve(metadataRequest); - - if (rGroup == null) { - break; - } - } while (!childKey.equals(child.getKey())); - - if (parentArtifact != null - && parentArtifact.getDependencyFilter() != null - && !parentArtifact.getDependencyFilter().include(artifact)) { - // MNG-3769: the [probably relocated] artifact is excluded. - // We could process exclusions on relocated artifact details in the - // MavenMetadataSource.createArtifacts(..) step, BUT that would - // require resolving the POM from the repository very early on in - // the build. - continue; - } - - // TODO might be better to have source.retrieve() throw a specific exception for this - // situation - // and catch here rather than have it return null - if (rGroup == null) { - // relocated dependency artifact is declared excluded, no need to add and recurse - // further - continue; - } - - child.addDependencies(rGroup.getArtifacts(), rGroup.getResolutionRepositories(), filter); - - } catch (CyclicDependencyException e) { - // would like to throw this, but we have crappy stuff in the repo - - fireEvent( - ResolutionListener.OMIT_FOR_CYCLE, - listeners, - new ResolutionNode(e.getArtifact(), childRemoteRepositories, child)); - } catch (ArtifactMetadataRetrievalException e) { - artifact.setDependencyTrail(node.getDependencyTrail()); - - throw new ArtifactResolutionException( - "Unable to get dependency information for " + artifact.getId() + ": " - + e.getMessage(), - artifact, - childRemoteRepositories, - e); - } - - ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest(metadataRequest); - subRequest.setServers(request.getServers()); - subRequest.setMirrors(request.getMirrors()); - subRequest.setProxies(request.getProxies()); - recurse( - result, - child, - resolvedArtifacts, - managedVersions, - subRequest, - source, - filter, - listeners, - conflictResolvers); - } - } catch (OverConstrainedVersionException e) { - result.addVersionRangeViolation(e); - } catch (ArtifactResolutionException e) { - result.addMetadataResolutionException(e); - } - } - - fireEvent(ResolutionListener.FINISH_PROCESSING_CHILDREN, listeners, node); - } - } - - private void manageArtifact( - ResolutionNode node, ManagedVersionMap managedVersions, List listeners) { - Artifact artifact = managedVersions.get(node.getKey()); - - // Before we update the version of the artifact, we need to know - // whether we are working on a transitive dependency or not. This - // allows depMgmt to always override transitive dependencies, while - // explicit child override depMgmt (viz. depMgmt should only - // provide defaults to children, but should override transitives). - // We can do this by calling isChildOfRootNode on the current node. - if ((artifact.getVersion() != null) - && (!node.isChildOfRootNode() || node.getArtifact().getVersion() == null)) { - fireEvent(ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact); - node.getArtifact().setVersion(artifact.getVersion()); - } - - if ((artifact.getScope() != null) - && (!node.isChildOfRootNode() || node.getArtifact().getScope() == null)) { - fireEvent(ResolutionListener.MANAGE_ARTIFACT_SCOPE, listeners, node, artifact); - node.getArtifact().setScope(artifact.getScope()); - } - - if (Artifact.SCOPE_SYSTEM.equals(node.getArtifact().getScope()) - && (node.getArtifact().getFile() == null) - && (artifact.getFile() != null)) { - fireEvent(ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact); - node.getArtifact().setFile(artifact.getFile()); - } - } - - /** - * Check if the artifactScope needs to be updated. More info. - * - * @param farthest farthest resolution node - * @param nearest nearest resolution node - * @param listeners - */ - boolean checkScopeUpdate(ResolutionNode farthest, ResolutionNode nearest, List listeners) { - boolean updateScope = false; - Artifact farthestArtifact = farthest.getArtifact(); - Artifact nearestArtifact = nearest.getArtifact(); - - /* farthest is runtime and nearest has lower priority, change to runtime */ - if (Artifact.SCOPE_RUNTIME.equals(farthestArtifact.getScope()) - && (Artifact.SCOPE_TEST.equals(nearestArtifact.getScope()) - || Artifact.SCOPE_PROVIDED.equals(nearestArtifact.getScope()))) { - updateScope = true; - } - - /* farthest is compile and nearest is not (has lower priority), change to compile */ - if (Artifact.SCOPE_COMPILE.equals(farthestArtifact.getScope()) - && !Artifact.SCOPE_COMPILE.equals(nearestArtifact.getScope())) { - updateScope = true; - } - - /* current POM rules all, if nearest is in current pom, do not update its artifactScope */ - if ((nearest.getDepth() < 2) && updateScope) { - updateScope = false; - - fireEvent(ResolutionListener.UPDATE_SCOPE_CURRENT_POM, listeners, nearest, farthestArtifact); - } - - if (updateScope) { - fireEvent(ResolutionListener.UPDATE_SCOPE, listeners, nearest, farthestArtifact); - - // previously we cloned the artifact, but it is more efficient to just update the artifactScope - // if problems are later discovered that the original object needs its original artifactScope value, - // cloning may - // again be appropriate - nearestArtifact.setScope(farthestArtifact.getScope()); - } - - return updateScope; - } - - private void fireEvent(int event, List listeners, ResolutionNode node) { - fireEvent(event, listeners, node, null); - } - - private void fireEvent(int event, List listeners, ResolutionNode node, Artifact replacement) { - fireEvent(event, listeners, node, replacement, null); - } - - private void fireEvent( - int event, - List listeners, - ResolutionNode node, - Artifact replacement, - VersionRange newRange) { - for (ResolutionListener listener : listeners) { - switch (event) { - case ResolutionListener.TEST_ARTIFACT: - listener.testArtifact(node.getArtifact()); - break; - case ResolutionListener.PROCESS_CHILDREN: - listener.startProcessChildren(node.getArtifact()); - break; - case ResolutionListener.FINISH_PROCESSING_CHILDREN: - listener.endProcessChildren(node.getArtifact()); - break; - case ResolutionListener.INCLUDE_ARTIFACT: - listener.includeArtifact(node.getArtifact()); - break; - case ResolutionListener.OMIT_FOR_NEARER: - listener.omitForNearer(node.getArtifact(), replacement); - break; - case ResolutionListener.OMIT_FOR_CYCLE: - listener.omitForCycle(node.getArtifact()); - break; - case ResolutionListener.UPDATE_SCOPE: - listener.updateScope(node.getArtifact(), replacement.getScope()); - break; - case ResolutionListener.UPDATE_SCOPE_CURRENT_POM: - listener.updateScopeCurrentPom(node.getArtifact(), replacement.getScope()); - break; - case ResolutionListener.MANAGE_ARTIFACT_VERSION: - if (listener instanceof ResolutionListenerForDepMgmt) { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactVersion(node.getArtifact(), replacement); - } else { - listener.manageArtifact(node.getArtifact(), replacement); - } - break; - case ResolutionListener.MANAGE_ARTIFACT_SCOPE: - if (listener instanceof ResolutionListenerForDepMgmt) { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactScope(node.getArtifact(), replacement); - } else { - listener.manageArtifact(node.getArtifact(), replacement); - } - break; - case ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH: - if (listener instanceof ResolutionListenerForDepMgmt) { - ResolutionListenerForDepMgmt asImpl = (ResolutionListenerForDepMgmt) listener; - asImpl.manageArtifactSystemPath(node.getArtifact(), replacement); - } else { - listener.manageArtifact(node.getArtifact(), replacement); - } - break; - case ResolutionListener.SELECT_VERSION_FROM_RANGE: - listener.selectVersionFromRange(node.getArtifact()); - break; - case ResolutionListener.RESTRICT_RANGE: - if (node.getArtifact().getVersionRange().hasRestrictions() - || replacement.getVersionRange().hasRestrictions()) { - listener.restrictRange(node.getArtifact(), replacement, newRange); - } - break; - default: - throw new IllegalStateException("Unknown event: " + event); - } - } - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners) { - return collect( - artifacts, - originatingArtifact, - managedVersions, - localRepository, - remoteRepositories, - source, - filter, - listeners, - null); - } - - public ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners) { - return collect( - artifacts, originatingArtifact, null, localRepository, remoteRepositories, source, filter, listeners); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java deleted file mode 100644 index 945a1e25c384..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ResolutionListener; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; - -/** - * Artifact collector - takes a set of original artifacts and resolves all of the best versions to use - * along with their metadata. No artifacts are downloaded. - * - */ -@Deprecated -@SuppressWarnings("checkstyle:parameternumber") -public interface LegacyArtifactCollector { - - ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactResolutionRequest repositoryRequest, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers); - - ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners, - List conflictResolvers); - - // used by maven-dependency-tree and maven-dependency-plugin - @Deprecated - ArtifactResolutionResult collect( - Set artifacts, - Artifact originatingArtifact, - Map managedVersions, - ArtifactRepository localRepository, - List remoteRepositories, - ArtifactMetadataSource source, - ArtifactFilter filter, - List listeners); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java deleted file mode 100644 index 00846bf5ee71..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import org.apache.maven.artifact.resolver.ResolutionNode; - -/** - * Determines which version of an artifact to use when there are conflicting declarations. - * - */ -@Deprecated -public interface ConflictResolver { - String ROLE = ConflictResolver.class.getName(); - - /** - * Determines which of the specified versions of an artifact to use when there are conflicting declarations. - * - * @param node1 the first artifact declaration - * @param node2 the second artifact declaration - * @return the artifact declaration to use: node1; node2; or nullif - * this conflict cannot be resolved - * @since 3.0 - */ - ResolutionNode resolveConflict(ResolutionNode node1, ResolutionNode node2); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java deleted file mode 100644 index ecda46077c98..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -/** - * A factory that produces conflict resolvers of various types. - * - * @see ConflictResolver - * @since 3.0 - */ -@Deprecated -public interface ConflictResolverFactory { - // constants -------------------------------------------------------------- - - /** The plexus role for this component. */ - String ROLE = ConflictResolverFactory.class.getName(); - - // methods ---------------------------------------------------------------- - - /** - * Gets a conflict resolver of the specified type. - * - * @param type the type of conflict resolver to obtain - * @return the conflict resolver - * @throws ConflictResolverNotFoundException - * if the specified type was not found - */ - ConflictResolver getConflictResolver(String type) throws ConflictResolverNotFoundException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java deleted file mode 100644 index e8213c470143..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -/** - * Indicates that a specified conflict resolver implementation could not be found. - * - * @since 3.0 - */ -@Deprecated -public class ConflictResolverNotFoundException extends Exception { - // constants -------------------------------------------------------------- - - /** The serial version ID. */ - private static final long serialVersionUID = 3372412184339653914L; - - // constructors ----------------------------------------------------------- - - /** - * Creates a new ConflictResolverNotFoundException with the specified message. - * - * @param message the message - */ - public ConflictResolverNotFoundException(String message) { - super(message); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java deleted file mode 100644 index a3a06800f3ec..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Named; -import javax.inject.Singleton; - -/** - * The default conflict resolver that delegates to the nearest strategy. - * - * @see NearestConflictResolver - * @deprecated As of 3.0, use a specific implementation instead, e.g. {@link NearestConflictResolver} - */ -@Deprecated -@Named -@Singleton -public class DefaultConflictResolver extends NearestConflictResolver {} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java deleted file mode 100644 index cfe9cd43785a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.codehaus.plexus.PlexusConstants; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; - -/** - * A conflict resolver factory that obtains instances from a plexus container. - * - * TODO you don't need the container in here with the active maps (jvz). - * @since 3.0 - */ -@Named -@Singleton -@Deprecated -public class DefaultConflictResolverFactory implements ConflictResolverFactory, Contextualizable { - // fields ----------------------------------------------------------------- - - /** - * The plexus container used to obtain instances from. - */ - @Inject - private PlexusContainer container; - - // ConflictResolverFactory methods ---------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolverFactory#getConflictResolver(java.lang.String) - */ - - public ConflictResolver getConflictResolver(String type) throws ConflictResolverNotFoundException { - try { - return (ConflictResolver) container.lookup(ConflictResolver.ROLE, type); - } catch (ComponentLookupException exception) { - throw new ConflictResolverNotFoundException("Cannot find conflict resolver of type: " + type); - } - } - - // Contextualizable methods ----------------------------------------------- - - /* - * @see org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable#contextualize(org.codehaus.plexus.context.Context) - */ - - public void contextualize(Context context) throws ContextException { - container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java deleted file mode 100644 index b3dc4772a7c0..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.resolver.ResolutionNode; - -/** - * Resolves conflicting artifacts by always selecting the farthest declaration. Farthest is defined as the - * declaration that has the most transitive steps away from the project being built. - * - * @since 3.0 - */ -@Named("farthest") -@Singleton -@Deprecated -public class FarthestConflictResolver implements ConflictResolver { - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict(ResolutionNode node1, ResolutionNode node2) { - return node1.getDepth() >= node2.getDepth() ? node1 : node2; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java deleted file mode 100644 index 7d2bccc23e0a..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.resolver.ResolutionNode; - -/** - * Resolves conflicting artifacts by always selecting the nearest declaration. Nearest is defined as the - * declaration that has the least transitive steps away from the project being built. - * - * @since 3.0 - */ -@Named("nearest") -@Singleton -@Deprecated -public class NearestConflictResolver implements ConflictResolver { - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict(ResolutionNode node1, ResolutionNode node2) { - return node1.getDepth() <= node2.getDepth() ? node1 : node2; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java deleted file mode 100644 index 10cadb204dac..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * Resolves conflicting artifacts by always selecting the newest declaration. Newest is defined as the - * declaration whose version is greater according to ArtifactVersion.compareTo. - * - * @see ArtifactVersion#compareTo - * @since 3.0 - */ -@Named("newest") -@Singleton -@Deprecated -public class NewestConflictResolver implements ConflictResolver { - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict(ResolutionNode node1, ResolutionNode node2) { - try { - ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); - ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); - - return version1.compareTo(version2) > 0 ? node1 : node2; - } catch (OverConstrainedVersionException exception) { - // TODO log message or throw exception? - - return null; - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java deleted file mode 100644 index bd15924812a3..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; - -/** - * Resolves conflicting artifacts by always selecting the oldest declaration. Oldest is defined as the - * declaration whose version is less according to ArtifactVersion.compareTo. - * - * @see ArtifactVersion#compareTo - * @since 3.0 - */ -@Named("oldest") -@Singleton -@Deprecated -public class OldestConflictResolver implements ConflictResolver { - // ConflictResolver methods ----------------------------------------------- - - /* - * @see org.apache.maven.artifact.resolver.conflict.ConflictResolver#resolveConflict(org.apache.maven.artifact.resolver.ResolutionNode, - * org.apache.maven.artifact.resolver.ResolutionNode) - */ - - public ResolutionNode resolveConflict(ResolutionNode node1, ResolutionNode node2) { - try { - ArtifactVersion version1 = node1.getArtifact().getSelectedVersion(); - ArtifactVersion version2 = node2.getArtifact().getSelectedVersion(); - - return version1.compareTo(version2) <= 0 ? node1 : node2; - } catch (OverConstrainedVersionException exception) { - // TODO log message or throw exception? - - return null; - } - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java deleted file mode 100644 index f86ea3bc58bf..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import javax.inject.Inject; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultRepositoryRequest; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.repository.legacy.WagonManager; -import org.codehaus.plexus.logging.AbstractLogEnabled; - -/** - * Describes a version transformation during artifact resolution. - * - * TODO try and refactor to remove abstract methods - not particular happy about current design - */ -@Deprecated -public abstract class AbstractVersionTransformation extends AbstractLogEnabled implements ArtifactTransformation { - @Inject - protected RepositoryMetadataManager repositoryMetadataManager; - - @Inject - protected WagonManager wagonManager; - - public void transformForResolve( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - transformForResolve(artifact, request); - } - - protected String resolveVersion( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws RepositoryMetadataResolutionException { - RepositoryRequest request = new DefaultRepositoryRequest(); - request.setLocalRepository(localRepository); - request.setRemoteRepositories(remoteRepositories); - return resolveVersion(artifact, request); - } - - protected String resolveVersion(Artifact artifact, RepositoryRequest request) - throws RepositoryMetadataResolutionException { - RepositoryMetadata metadata; - // Don't use snapshot metadata for LATEST (which isSnapshot returns true for) - if (!artifact.isSnapshot() || Artifact.LATEST_VERSION.equals(artifact.getBaseVersion())) { - metadata = new ArtifactRepositoryMetadata(artifact); - } else { - metadata = new SnapshotArtifactRepositoryMetadata(artifact); - } - - repositoryMetadataManager.resolve(metadata, request); - - artifact.addMetadata(metadata); - - Metadata repoMetadata = metadata.getMetadata(); - String version = null; - if (repoMetadata != null && repoMetadata.getVersioning() != null) { - version = constructVersion(repoMetadata.getVersioning(), artifact.getBaseVersion()); - } - - if (version == null) { - // use the local copy, or if it doesn't exist - go to the remote repo for it - version = artifact.getBaseVersion(); - } - - // TODO also do this logging for other metadata? - // TODO figure out way to avoid duplicated message - if (getLogger().isDebugEnabled()) { - if (!version.equals(artifact.getBaseVersion())) { - String message = artifact.getArtifactId() + ": resolved to version " + version; - if (artifact.getRepository() != null) { - message += " from repository " + artifact.getRepository().getId(); - } else { - message += " from local repository"; - } - getLogger().debug(message); - } else { - // Locally installed file is newer, don't use the resolved version - getLogger().debug(artifact.getArtifactId() + ": using locally installed snapshot"); - } - } - return version; - } - - protected abstract String constructVersion(Versioning versioning, String baseVersion); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java deleted file mode 100644 index ddda6402f6ec..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - */ -@Deprecated -public interface ArtifactTransformation { - String ROLE = ArtifactTransformation.class.getName(); - - /** - * Take in an artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param request the repositories to check - */ - void transformForResolve(Artifact artifact, RepositoryRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in an artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepositories the repositories to check - * @param localRepository the local repository - */ - void transformForResolve( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in an artifact and return the transformed artifact for locating in the local repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param localRepository the local repository it will be stored in - */ - void transformForInstall(Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException; - - /** - * Take in an artifact and return the transformed artifact for distributing to remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepository the repository to deploy to - * @param localRepository the local repository - */ - void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java deleted file mode 100644 index f86d9a16c3f2..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - * Manages multiple ArtifactTransformation instances and applies them in succession. - */ -@Deprecated -public interface ArtifactTransformationManager { - String ROLE = ArtifactTransformationManager.class.getName(); - - /** - * Take in an artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param request the repositories to check - */ - void transformForResolve(Artifact artifact, RepositoryRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in an artifact and return the transformed artifact for locating in the remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepositories the repositories to check - * @param localRepository the local repository - */ - void transformForResolve( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException; - - /** - * Take in an artifact and return the transformed artifact for locating in the local repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param localRepository the local repository it will be stored in - */ - void transformForInstall(Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException; - - /** - * Take in an artifact and return the transformed artifact for distributing to a remote repository. If no - * transformation has occurred the original artifact is returned. - * - * @param artifact Artifact to be transformed. - * @param remoteRepository the repository to deploy to - * @param localRepository the local repository the metadata is stored in - */ - void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException; - - List getArtifactTransformations(); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java deleted file mode 100644 index 8eef94e9f300..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.installer.ArtifactInstallationException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - */ -@Named -@Singleton -@Deprecated -public class DefaultArtifactTransformationManager implements ArtifactTransformationManager { - - private List artifactTransformations; - - @Inject - public DefaultArtifactTransformationManager(Map artifactTransformations) { - this.artifactTransformations = Stream.of("release", "latest", "snapshot") - .map(artifactTransformations::get) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - } - - public void transformForResolve(Artifact artifact, RepositoryRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException { - for (ArtifactTransformation transform : artifactTransformations) { - transform.transformForResolve(artifact, request); - } - } - - public void transformForResolve( - Artifact artifact, List remoteRepositories, ArtifactRepository localRepository) - throws ArtifactResolutionException, ArtifactNotFoundException { - for (ArtifactTransformation transform : artifactTransformations) { - transform.transformForResolve(artifact, remoteRepositories, localRepository); - } - } - - public void transformForInstall(Artifact artifact, ArtifactRepository localRepository) - throws ArtifactInstallationException { - for (ArtifactTransformation transform : artifactTransformations) { - transform.transformForInstall(artifact, localRepository); - } - } - - public void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException { - for (ArtifactTransformation transform : artifactTransformations) { - transform.transformForDeployment(artifact, remoteRepository, localRepository); - } - } - - public List getArtifactTransformations() { - return artifactTransformations; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java deleted file mode 100644 index 53468900cb0c..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - * Describes a version transformation during artifact resolution - "latest" type - */ -@Named("latest") -@Singleton -@Deprecated -public class LatestArtifactTransformation extends AbstractVersionTransformation { - - public void transformForResolve(Artifact artifact, RepositoryRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException { - if (Artifact.LATEST_VERSION.equals(artifact.getVersion())) { - try { - String version = resolveVersion(artifact, request); - if (Artifact.LATEST_VERSION.equals(version)) { - throw new ArtifactNotFoundException("Unable to determine the latest version", artifact); - } - - artifact.setBaseVersion(version); - artifact.updateVersion(version, request.getLocalRepository()); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactResolutionException(e.getMessage(), artifact, e); - } - } - } - - public void transformForInstall(Artifact artifact, ArtifactRepository localRepository) { - // metadata is added via addPluginArtifactMetadata - } - - public void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) { - // metadata is added via addPluginArtifactMetadata - } - - protected String constructVersion(Versioning versioning, String baseVersion) { - return versioning.getLatest(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java deleted file mode 100644 index abc20e2cd2c9..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - * Change the version RELEASE to the appropriate release version from the remote repository. - * - */ -@Named("release") -@Singleton -@Deprecated -public class ReleaseArtifactTransformation extends AbstractVersionTransformation { - - public void transformForResolve(Artifact artifact, RepositoryRequest request) - throws ArtifactResolutionException, ArtifactNotFoundException { - if (Artifact.RELEASE_VERSION.equals(artifact.getVersion())) { - try { - String version = resolveVersion(artifact, request); - - if (Artifact.RELEASE_VERSION.equals(version)) { - throw new ArtifactNotFoundException("Unable to determine the release version", artifact); - } - - artifact.setBaseVersion(version); - artifact.updateVersion(version, request.getLocalRepository()); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactResolutionException(e.getMessage(), artifact, e); - } - } - } - - public void transformForInstall(Artifact artifact, ArtifactRepository localRepository) { - ArtifactMetadata metadata = createMetadata(artifact); - - artifact.addMetadata(metadata); - } - - public void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) { - ArtifactMetadata metadata = createMetadata(artifact); - - artifact.addMetadata(metadata); - } - - private ArtifactMetadata createMetadata(Artifact artifact) { - Versioning versioning = new Versioning(); - // TODO Should this be changed for MNG-6754 too? - versioning.updateTimestamp(); - versioning.addVersion(artifact.getVersion()); - - if (artifact.isRelease()) { - versioning.setRelease(artifact.getVersion()); - } - - return new ArtifactRepositoryMetadata(artifact, versioning); - } - - protected String constructVersion(Versioning versioning, String baseVersion) { - return versioning.getRelease(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java deleted file mode 100644 index 4f2e5058ab8e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.transform; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.deployer.ArtifactDeploymentException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.RepositoryRequest; -import org.apache.maven.artifact.repository.metadata.Metadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException; -import org.apache.maven.artifact.repository.metadata.Snapshot; -import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.Versioning; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; - -/** - */ -@Named("snapshot") -@Singleton -@Deprecated -public class SnapshotTransformation extends AbstractVersionTransformation { - private static final String DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT = "yyyyMMdd.HHmmss"; - - private static final TimeZone DEFAULT_SNAPSHOT_TIME_ZONE = TimeZone.getTimeZone("Etc/UTC"); - - private String deploymentTimestamp; - - public void transformForResolve(Artifact artifact, RepositoryRequest request) throws ArtifactResolutionException { - // Only select snapshots that are unresolved (eg 1.0-SNAPSHOT, not 1.0-20050607.123456) - if (artifact.isSnapshot() && artifact.getBaseVersion().equals(artifact.getVersion())) { - try { - String version = resolveVersion(artifact, request); - artifact.updateVersion(version, request.getLocalRepository()); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactResolutionException(e.getMessage(), artifact, e); - } - } - } - - public void transformForInstall(Artifact artifact, ArtifactRepository localRepository) { - if (artifact.isSnapshot()) { - Snapshot snapshot = new Snapshot(); - snapshot.setLocalCopy(true); - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata(artifact, snapshot); - - artifact.addMetadata(metadata); - } - } - - public void transformForDeployment( - Artifact artifact, ArtifactRepository remoteRepository, ArtifactRepository localRepository) - throws ArtifactDeploymentException { - if (artifact.isSnapshot()) { - Snapshot snapshot = new Snapshot(); - - // TODO Should this be changed for MNG-6754 too? - snapshot.setTimestamp(getDeploymentTimestamp()); - - // we update the build number anyway so that it doesn't get lost. It requires the timestamp to take effect - try { - int buildNumber = resolveLatestSnapshotBuildNumber(artifact, localRepository, remoteRepository); - - snapshot.setBuildNumber(buildNumber + 1); - } catch (RepositoryMetadataResolutionException e) { - throw new ArtifactDeploymentException( - "Error retrieving previous build number for artifact '" + artifact.getDependencyConflictId() - + "': " + e.getMessage(), - e); - } - - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata(artifact, snapshot); - - artifact.setResolvedVersion( - constructVersion(metadata.getMetadata().getVersioning(), artifact.getBaseVersion())); - - artifact.addMetadata(metadata); - } - } - - public String getDeploymentTimestamp() { - if (deploymentTimestamp == null) { - deploymentTimestamp = getUtcDateFormatter().format(new Date()); - } - return deploymentTimestamp; - } - - protected String constructVersion(Versioning versioning, String baseVersion) { - String version = null; - Snapshot snapshot = versioning.getSnapshot(); - if (snapshot != null) { - if (snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0) { - String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber(); - version = baseVersion.replace(Artifact.SNAPSHOT_VERSION, newVersion); - } else { - version = baseVersion; - } - } - return version; - } - - private int resolveLatestSnapshotBuildNumber( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws RepositoryMetadataResolutionException { - RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata(artifact); - - getLogger().info("Retrieving previous build number from " + remoteRepository.getId()); - repositoryMetadataManager.resolveAlways(metadata, localRepository, remoteRepository); - - int buildNumber = 0; - Metadata repoMetadata = metadata.getMetadata(); - if ((repoMetadata != null) - && (repoMetadata.getVersioning() != null - && repoMetadata.getVersioning().getSnapshot() != null)) { - buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber(); - } - return buildNumber; - } - - public static DateFormat getUtcDateFormatter() { - DateFormat utcDateFormatter = new SimpleDateFormat(DEFAULT_SNAPSHOT_TIMESTAMP_FORMAT); - utcDateFormatter.setCalendar(new GregorianCalendar()); - utcDateFormatter.setTimeZone(DEFAULT_SNAPSHOT_TIME_ZONE); - return utcDateFormatter; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java deleted file mode 100644 index b0a231f3df08..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.Collection; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * Artifact Metadata that is resolved independent of Artifact itself. - * - */ -@Deprecated -public class ArtifactMetadata { - /** - * standard glorified artifact coordinates - */ - protected String groupId; - - protected String artifactId; - protected String version; - protected String type; - protected ArtifactScopeEnum artifactScope; - protected String classifier; - - /** - * explanation: why this MD was chosen over its siblings - * in the resulting structure (classpath for now) - */ - protected String why; - - /** dependencies of the artifact behind this metadata */ - protected Collection dependencies; - - /** metadata URI */ - protected String uri; - - /** is metadata found anywhere */ - protected boolean resolved = false; - - /** does the actual artifact for this metadata exists */ - protected boolean artifactExists = false; - /** artifact URI */ - protected String artifactUri; - - /** error message */ - private String error; - - // ------------------------------------------------------------------ - /** - * - */ - public ArtifactMetadata(String name) { - if (name == null) { - return; - } - int ind1 = name.indexOf(':'); - int ind2 = name.lastIndexOf(':'); - - if (ind1 == -1 || ind2 == -1) { - return; - } - - this.groupId = name.substring(0, ind1); - if (ind1 == ind2) { - this.artifactId = name.substring(ind1 + 1); - } else { - this.artifactId = name.substring(ind1 + 1, ind2); - this.version = name.substring(ind2 + 1); - } - } - - public ArtifactMetadata(String groupId, String name, String version) { - this(groupId, name, version, null); - } - - public ArtifactMetadata(String groupId, String name, String version, String type) { - this(groupId, name, version, type, null); - } - - public ArtifactMetadata(String groupId, String name, String version, String type, ArtifactScopeEnum artifactScope) { - this(groupId, name, version, type, artifactScope, null); - } - - public ArtifactMetadata( - String groupId, - String name, - String version, - String type, - ArtifactScopeEnum artifactScope, - String classifier) { - this(groupId, name, version, type, artifactScope, classifier, null); - } - - public ArtifactMetadata( - String groupId, - String name, - String version, - String type, - ArtifactScopeEnum artifactScope, - String classifier, - String artifactUri) { - this(groupId, name, version, type, artifactScope, classifier, artifactUri, null, true, null); - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactMetadata( - String groupId, - String name, - String version, - String type, - ArtifactScopeEnum artifactScope, - String classifier, - String artifactUri, - String why, - boolean resolved, - String error) { - this.groupId = groupId; - this.artifactId = name; - this.version = version; - this.type = type; - this.artifactScope = artifactScope; - this.classifier = classifier; - this.artifactUri = artifactUri; - this.why = why; - this.resolved = resolved; - this.error = error; - } - - @SuppressWarnings("checkstyle:parameternumber") - public ArtifactMetadata( - String groupId, - String name, - String version, - String type, - String scopeString, - String classifier, - String artifactUri, - String why, - boolean resolved, - String error) { - this( - groupId, - name, - version, - type, - scopeString == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf(scopeString), - classifier, - artifactUri, - why, - resolved, - error); - } - - public ArtifactMetadata(Artifact af) { - /* - if ( af != null ) - { - init( af ); - } - */ - } - // ------------------------------------------------------------------ - // public void init( ArtifactMetadata af ) - // { - // setGroupId( af.getGroupId() ); - // setArtifactId( af.getArtifactId() ); - // setVersion( af.getVersion() ); - // setType( af.getType() ); - // setScope( af.getScope() ); - // setClassifier( af.getClassifier() ); - // //setUri( af.getDownloadUrl() ); - // - // this.resolved = af.isResolved(); - // } - - @Override - public String toString() { - return groupId + ":" + artifactId + ":" + version; - } - - public String toDomainString() { - return groupId + ":" + artifactId; - } - - public String getGroupId() { - return groupId; - } - - public void setGroupId(String groupId) { - this.groupId = groupId; - } - - public String getArtifactId() { - return artifactId; - } - - public void setArtifactId(String name) { - this.artifactId = name; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getType() { - return type; - } - - public String getCheckedType() { - return type == null ? "jar" : type; - } - - public void setType(String type) { - this.type = type; - } - - public ArtifactScopeEnum getArtifactScope() { - return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope; - } - - public void setArtifactScope(ArtifactScopeEnum artifactScope) { - this.artifactScope = artifactScope; - } - - public void setScope(String scope) { - this.artifactScope = scope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : ArtifactScopeEnum.valueOf(scope); - } - - public String getClassifier() { - return classifier; - } - - public void setClassifier(String classifier) { - this.classifier = classifier; - } - - public boolean isResolved() { - return resolved; - } - - public void setResolved(boolean resolved) { - this.resolved = resolved; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getScope() { - return getArtifactScope().getScope(); - } - - public ArtifactScopeEnum getScopeAsEnum() { - return artifactScope == null ? ArtifactScopeEnum.DEFAULT_SCOPE : artifactScope; - } - - public boolean isArtifactExists() { - return artifactExists; - } - - public void setArtifactExists(boolean artifactExists) { - this.artifactExists = artifactExists; - } - - public Collection getDependencies() { - return dependencies; - } - - public void setDependencies(Collection dependencies) { - this.dependencies = dependencies; - } - - public String getArtifactUri() { - return artifactUri; - } - - public void setArtifactUri(String artifactUri) { - this.artifactUri = artifactUri; - } - - public String getWhy() { - return why; - } - - public void setWhy(String why) { - this.why = why; - } - - public String getError() { - return error; - } - - public void setError(String error) { - this.error = error; - } - - public boolean isError() { - return error == null; - } - - public String getDependencyConflictId() { - return groupId + ":" + artifactId; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java deleted file mode 100644 index ad1937a4b19f..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * classpath container that is aware of the classpath scope - * - * - */ -@Deprecated -public class ClasspathContainer implements Iterable { - private List classpath; - - private ArtifactScopeEnum scope; - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer(ArtifactScopeEnum scope) { - this.scope = ArtifactScopeEnum.checkScope(scope); - } - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer(List classpath, ArtifactScopeEnum scope) { - this(scope); - this.classpath = classpath; - } - - // ------------------------------------------------------------------------------------------- - public Iterator iterator() { - return classpath == null ? null : classpath.iterator(); - } - - // ------------------------------------------------------------------------------------------- - public ClasspathContainer add(ArtifactMetadata md) { - if (classpath == null) { - classpath = new ArrayList<>(16); - } - - classpath.add(md); - - return this; - } - - // ------------------------------------------------------------------------------------------- - public List getClasspath() { - return classpath; - } - - // ------------------------------------------------------------------------------------------- - public MetadataTreeNode getClasspathAsTree() throws MetadataResolutionException { - if (classpath == null || classpath.size() < 1) { - return null; - } - - MetadataTreeNode tree = null; - MetadataTreeNode parent = null; - - for (ArtifactMetadata md : classpath) { - MetadataTreeNode node = new MetadataTreeNode(md, parent, md.isResolved(), md.getArtifactScope()); - if (tree == null) { - tree = node; - } - - if (parent != null) { - parent.setNChildren(1); - parent.addChild(0, node); - } - - parent = node; - } - return tree; - } - - public void setClasspath(List classpath) { - this.classpath = classpath; - } - - public ArtifactScopeEnum getScope() { - return scope; - } - - public void setScope(ArtifactScopeEnum scope) { - this.scope = scope; - } - - // ------------------------------------------------------------------------------------------- - @Override - public String toString() { - StringBuilder sb = new StringBuilder(256); - sb.append("[scope=").append(scope.getScope()); - if (classpath != null) { - for (ArtifactMetadata md : classpath) { - sb.append(": ") - .append(md.toString()) - .append('{') - .append(md.getArtifactUri()) - .append('}'); - } - } - sb.append(']'); - return sb.toString(); - } - // ------------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java deleted file mode 100644 index 746ea81a0ff0..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * Helper class to convert a metadata Graph into some form of a classpath - * - * - */ -@Deprecated -public interface ClasspathTransformation { - String ROLE = ClasspathTransformation.class.getName(); - - /** - * Transform Graph into a Collection of metadata objects that - * could serve as a classpath for a particular scope - * - * @param dirtyGraph - dependency graph - * @param scope - which classpath to extract - * @param resolve - whether to resolve artifacts. - * @return Collection of metadata objects in the linked subgraph of the graph which - * contains the graph.getEntry() vertice - */ - ClasspathContainer transform(MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve) - throws MetadataGraphTransformationException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java deleted file mode 100644 index 5a41c607d795..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * default implementation of the metadata classpath transformer - * - * - */ -@Named -@Singleton -@Deprecated -public class DefaultClasspathTransformation implements ClasspathTransformation { - @Inject - GraphConflictResolver conflictResolver; - - // ---------------------------------------------------------------------------------------------------- - public ClasspathContainer transform(MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve) - throws MetadataGraphTransformationException { - try { - if (dirtyGraph == null || dirtyGraph.isEmpty()) { - return null; - } - - MetadataGraph cleanGraph = conflictResolver.resolveConflicts(dirtyGraph, scope); - - if (cleanGraph == null || cleanGraph.isEmpty()) { - return null; - } - - ClasspathContainer cpc = new ClasspathContainer(scope); - if (cleanGraph.isEmptyEdges()) { - // single entry in the classpath, populated from itself - ArtifactMetadata amd = cleanGraph.getEntry().getMd(); - cpc.add(amd); - } else { - ClasspathGraphVisitor v = new ClasspathGraphVisitor(cleanGraph, cpc); - MetadataGraphVertex entry = cleanGraph.getEntry(); - // entry point - v.visit(entry); - } - - return cpc; - } catch (GraphConflictResolutionException e) { - throw new MetadataGraphTransformationException(e); - } - } - - // =================================================================================================== - /** - * Helper class to traverse graph. Required to make the containing method thread-safe - * and yet use class level data to lessen stack usage in recursion - */ - private class ClasspathGraphVisitor { - MetadataGraph graph; - - ClasspathContainer cpc; - - List visited; - - // ----------------------------------------------------------------------- - protected ClasspathGraphVisitor(MetadataGraph cleanGraph, ClasspathContainer cpc) { - this.cpc = cpc; - this.graph = cleanGraph; - - visited = new ArrayList<>(cleanGraph.getVertices().size()); - } - - // ----------------------------------------------------------------------- - protected void visit(MetadataGraphVertex node) // , String version, String artifactUri ) - { - ArtifactMetadata md = node.getMd(); - if (visited.contains(node)) { - return; - } - - cpc.add(md); - // - // TreeSet deps = new TreeSet( - // new Comparator() - // { - // public int compare( MetadataGraphEdge e1 - // , MetadataGraphEdge e2 - // ) - // { - // if( e1.getDepth() == e2.getDepth() ) - // { - // if( e2.getPomOrder() == e1.getPomOrder() ) - // return - // e1.getTarget().toString().compareTo(e2.getTarget().toString() ); - // - // return e2.getPomOrder() - e1.getPomOrder(); - // } - // - // return e2.getDepth() - e1.getDepth(); - // } - // } - // ); - - List exits = graph.getExcidentEdges(node); - - if (exits != null && exits.size() > 0) { - MetadataGraphEdge[] sortedExits = exits.toArray(new MetadataGraphEdge[0]); - Arrays.sort(sortedExits, (e1, e2) -> { - if (e1.getDepth() == e2.getDepth()) { - if (e2.getPomOrder() == e1.getPomOrder()) { - return e1.getTarget() - .toString() - .compareTo(e2.getTarget().toString()); - } - return e2.getPomOrder() - e1.getPomOrder(); - } - return e2.getDepth() - e1.getDepth(); - }); - - for (MetadataGraphEdge e : sortedExits) { - MetadataGraphVertex targetNode = e.getTarget(); - targetNode.getMd().setArtifactScope(e.getScope()); - targetNode.getMd().setWhy(e.getSource().getMd().toString()); - visit(targetNode); - } - } - } - // ----------------------------------------------------------------------- - // ----------------------------------------------------------------------- - } - // ---------------------------------------------------------------------------------------------------- - // ---------------------------------------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java deleted file mode 100644 index 71a66895cdd6..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.codehaus.plexus.component.annotations.Configuration; - -/** - * - */ -@Named -@Singleton -@Deprecated -public class DefaultGraphConflictResolutionPolicy implements GraphConflictResolutionPolicy { - /** - * artifact, closer to the entry point, is selected - */ - @Configuration(name = "closer-first", value = "true") - private boolean closerFirst = true; - - /** - * newer artifact is selected - */ - @Configuration(name = "newer-first", value = "true") - private boolean newerFirst = true; - - public MetadataGraphEdge apply(MetadataGraphEdge e1, MetadataGraphEdge e2) { - int depth1 = e1.getDepth(); - int depth2 = e2.getDepth(); - - if (depth1 == depth2) { - ArtifactVersion v1 = new DefaultArtifactVersion(e1.getVersion()); - ArtifactVersion v2 = new DefaultArtifactVersion(e2.getVersion()); - - if (newerFirst) { - return v1.compareTo(v2) > 0 ? e1 : e2; - } - - return v1.compareTo(v2) > 0 ? e2 : e1; - } - - if (closerFirst) { - return depth1 < depth2 ? e1 : e2; - } - - return depth1 < depth2 ? e2 : e1; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java deleted file mode 100644 index 55bad6743266..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeSet; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * Default conflict resolver.Implements closer newer first policy by default, but could be configured via plexus - * - */ -@Named -@Singleton -@Deprecated -public class DefaultGraphConflictResolver implements GraphConflictResolver { - /** - * artifact, closer to the entry point, is selected - */ - @Inject - protected GraphConflictResolutionPolicy policy; - - // ------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------- - public MetadataGraph resolveConflicts(MetadataGraph graph, ArtifactScopeEnum scope) - throws GraphConflictResolutionException { - if (policy == null) { - throw new GraphConflictResolutionException("no GraphConflictResolutionPolicy injected"); - } - - if (graph == null) { - return null; - } - - final MetadataGraphVertex entry = graph.getEntry(); - if (entry == null) { - return null; - } - - if (graph.isEmpty()) { - throw new GraphConflictResolutionException("graph with an entry, but not vertices do not exist"); - } - - if (graph.isEmptyEdges()) { - return null; // no edges - nothing to worry about - } - - final TreeSet vertices = graph.getVertices(); - - try { - // edge case - single vertex graph - if (vertices.size() == 1) { - return new MetadataGraph(entry); - } - - final ArtifactScopeEnum requestedScope = ArtifactScopeEnum.checkScope(scope); - - MetadataGraph res = new MetadataGraph(vertices.size()); - res.setVersionedVertices(false); - res.setScopedVertices(false); - - MetadataGraphVertex resEntry = res.addVertex(entry.getMd()); - res.setEntry(resEntry); - - res.setScope(requestedScope); - - for (MetadataGraphVertex v : vertices) { - final List ins = graph.getIncidentEdges(v); - final MetadataGraphEdge edge = cleanEdges(v, ins, requestedScope); - - if (edge == null) { // no edges - don't need this vertex anymore - if (entry.equals(v)) { // unless it's an entry point. - // currently processing the entry point - it should not have any entry incident edges - res.getEntry().getMd().setWhy("This is a graph entry point. No links."); - } else { - // System.out.println("--->"+v.getMd().toDomainString() - // +" has been terminated on this entry set\n-------------------\n" - // +ins - // +"\n-------------------\n" - // ); - } - } else { - // System.out.println("+++>"+v.getMd().toDomainString()+" still has "+edge.toString() ); - // fill in domain md with actual version data - ArtifactMetadata md = v.getMd(); - ArtifactMetadata newMd = new ArtifactMetadata( - md.getGroupId(), - md.getArtifactId(), - edge.getVersion(), - md.getType(), - md.getScopeAsEnum(), - md.getClassifier(), - edge.getArtifactUri(), - edge.getSource() == null - ? "" - : edge.getSource().getMd().toString(), - edge.isResolved(), - edge.getTarget() == null - ? null - : edge.getTarget().getMd().getError()); - MetadataGraphVertex newV = res.addVertex(newMd); - MetadataGraphVertex sourceV = res.addVertex(edge.getSource().getMd()); - - res.addEdge(sourceV, newV, edge); - } - } - // System.err.println("Original graph("+graph.getVertices().size()+"):\n"+graph.toString()); - // System.err.println("Cleaned("+requestedScope+") graph("+res.getVertices().size()+"):\n"+res.toString()); - // System.err.println("Linked("+requestedScope+") - // subgraph("+linkedRes.getVertices().size()+"):\n"+linkedRes.toString()); - return findLinkedSubgraph(res); - } catch (MetadataResolutionException e) { - throw new GraphConflictResolutionException(e); - } - } - - // ------------------------------------------------------------------------------------- - private MetadataGraph findLinkedSubgraph(MetadataGraph g) { - if (g.getVertices().size() == 1) { - return g; - } - - List visited = new ArrayList<>(g.getVertices().size()); - visit(g.getEntry(), visited, g); - - List dropList = new ArrayList<>(g.getVertices().size()); - - // collect drop list - for (MetadataGraphVertex v : g.getVertices()) { - if (!visited.contains(v)) { - dropList.add(v); - } - } - - if (dropList.size() < 1) { - return g; - } - - // now - drop vertices - TreeSet vertices = g.getVertices(); - for (MetadataGraphVertex v : dropList) { - vertices.remove(v); - } - - return g; - } - - // ------------------------------------------------------------------------------------- - private void visit(MetadataGraphVertex from, List visited, MetadataGraph graph) { - if (visited.contains(from)) { - return; - } - - visited.add(from); - - List exitList = graph.getExcidentEdges(from); - // String s = "|---> "+from.getMd().toString()+" - "+(exitList == null ? -1 : exitList.size()) + " exit links"; - if (exitList != null && exitList.size() > 0) { - for (MetadataGraphEdge e : graph.getExcidentEdges(from)) { - visit(e.getTarget(), visited, graph); - } - } - } - - // ------------------------------------------------------------------------------------- - private MetadataGraphEdge cleanEdges( - MetadataGraphVertex v, List edges, ArtifactScopeEnum scope) { - if (edges == null || edges.isEmpty()) { - return null; - } - - if (edges.size() == 1) { - MetadataGraphEdge e = edges.get(0); - if (scope.encloses(e.getScope())) { - return e; - } - - return null; - } - - MetadataGraphEdge res = null; - - for (MetadataGraphEdge e : edges) { - if (!scope.encloses(e.getScope())) { - continue; - } - - if (res == null) { - res = e; - } else { - res = policy.apply(e, res); - } - } - - return res; - } - // ------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java deleted file mode 100644 index 68a22c99a45d..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - * - * - */ -@Deprecated -public class GraphConflictResolutionException extends Exception { - private static final long serialVersionUID = 2677613140287940255L; - - public GraphConflictResolutionException() {} - - public GraphConflictResolutionException(String message) { - super(message); - } - - public GraphConflictResolutionException(Throwable cause) { - super(cause); - } - - public GraphConflictResolutionException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java deleted file mode 100644 index 0662dfffed55..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - * MetadataGraph edge selection policy. Complements - * GraphConflictResolver by being injected into it - * - * - */ -@Deprecated -public interface GraphConflictResolutionPolicy { - String ROLE = GraphConflictResolutionPolicy.class.getName(); - - MetadataGraphEdge apply(MetadataGraphEdge e1, MetadataGraphEdge e2); -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java deleted file mode 100644 index e573f82fe0a3..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * Resolves conflicts in the supplied dependency graph. - * Different implementations will implement different conflict resolution policies. - * - */ -@Deprecated -public interface GraphConflictResolver { - String ROLE = GraphConflictResolver.class.getName(); - - /** - * Cleanses the supplied graph by leaving only one directed versioned edge\ - * between any two nodes, if multiple exists. Uses scope relationships, defined - * in ArtifactScopeEnum - * - * @param graph the "dirty" graph to be simplified via conflict resolution - * @param scope scope for which the graph should be resolved - * - * @return resulting "clean" graph for the specified scope - * - * @since 3.0 - */ - MetadataGraph resolveConflicts(MetadataGraph graph, ArtifactScopeEnum scope) - throws GraphConflictResolutionException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java deleted file mode 100644 index 1ed579bc9edb..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * maven dependency metadata graph - * - * - */ -@Deprecated -public class MetadataGraph { - public static final int DEFAULT_VERTICES = 32; - public static final int DEFAULT_EDGES = 64; - - // flags to indicate the granularity of vertices - private boolean versionedVertices = false; - private boolean scopedVertices = false; - /** - * the entry point we started building the graph from - */ - MetadataGraphVertex entry; - - // graph vertices - TreeSet vertices; - - /** - * incident and excident edges per node - */ - Map> incidentEdges; - - Map> excidentEdges; - - /** - * null in dirty graph, actual - * scope for conflict-resolved graph - */ - ArtifactScopeEnum scope; - - // ------------------------------------------------------------------------ - /** - * init graph - */ - public MetadataGraph(int nVertices) { - init(nVertices, 2 * nVertices); - } - - public MetadataGraph(int nVertices, int nEdges) { - init(nVertices, nEdges); - } - // ------------------------------------------------------------------------ - /** - * construct a single vertex - */ - public MetadataGraph(MetadataGraphVertex entry) throws MetadataResolutionException { - checkVertex(entry); - checkVertices(1); - - entry.setCompareVersion(versionedVertices); - entry.setCompareScope(scopedVertices); - - vertices.add(entry); - this.entry = entry; - } - // ------------------------------------------------------------------------ - /** - * construct graph from a "dirty" tree - */ - public MetadataGraph(MetadataTreeNode tree) throws MetadataResolutionException { - this(tree, false, false); - } - // ------------------------------------------------------------------------ - /** - * construct graph from a "dirty" tree - * - * @param tree "dirty" tree root - * @param versionedVertices true if graph nodes should be versioned (different versions -> different nodes) - * @param scopedVertices true if graph nodes should be versioned and scoped - * (different versions and/or scopes -> different nodes) - * - */ - public MetadataGraph(MetadataTreeNode tree, boolean versionedVertices, boolean scopedVertices) - throws MetadataResolutionException { - if (tree == null) { - throw new MetadataResolutionException("tree is null"); - } - - setVersionedVertices(versionedVertices); - setScopedVertices(scopedVertices); - - this.versionedVertices = scopedVertices || versionedVertices; - this.scopedVertices = scopedVertices; - - int count = countNodes(tree); - - init(count, count + (count / 2)); - - processTreeNodes(null, tree, 0, 0); - } - // ------------------------------------------------------------------------ - private void processTreeNodes(MetadataGraphVertex parentVertex, MetadataTreeNode node, int depth, int pomOrder) - throws MetadataResolutionException { - if (node == null) { - return; - } - - MetadataGraphVertex vertex = new MetadataGraphVertex(node.md, versionedVertices, scopedVertices); - if (!vertices.contains(vertex)) { - vertices.add(vertex); - } - - if (parentVertex != null) // then create the edge - { - ArtifactMetadata md = node.getMd(); - MetadataGraphEdge e = - new MetadataGraphEdge(md.version, md.resolved, md.artifactScope, md.artifactUri, depth, pomOrder); - addEdge(parentVertex, vertex, e); - } else { - entry = vertex; - } - - MetadataTreeNode[] kids = node.getChildren(); - if (kids == null || kids.length < 1) { - return; - } - - for (int i = 0; i < kids.length; i++) { - MetadataTreeNode n = kids[i]; - processTreeNodes(vertex, n, depth + 1, i); - } - } - // ------------------------------------------------------------------------ - public MetadataGraphVertex findVertex(ArtifactMetadata md) { - if (md == null || vertices == null || vertices.size() < 1) { - return null; - } - - MetadataGraphVertex v = new MetadataGraphVertex(md); - v.setCompareVersion(versionedVertices); - v.setCompareScope(scopedVertices); - - for (MetadataGraphVertex gv : vertices) { - if (gv.equals(v)) { - return gv; - } - } - - return null; - } - // ------------------------------------------------------------------------ - public MetadataGraphVertex addVertex(ArtifactMetadata md) { - if (md == null) { - return null; - } - - checkVertices(); - - MetadataGraphVertex v = findVertex(md); - if (v != null) { - return v; - } - - v = new MetadataGraphVertex(md); - - v.setCompareVersion(versionedVertices); - v.setCompareScope(scopedVertices); - - vertices.add(v); - return v; - } - // ------------------------------------------------------------------------ - /** - * init graph - */ - private void init(int nVertices, int nEdges) { - int nV = nVertices; - if (nVertices < 1) { - nV = 1; - } - - checkVertices(nV); - - int nE = nVertices; - if (nEdges <= nV) { - nE = 2 * nE; - } - - checkEdges(nE); - } - - private void checkVertices() { - checkVertices(DEFAULT_VERTICES); - } - - private void checkVertices(int nVertices) { - if (vertices == null) { - vertices = new TreeSet<>(); - } - } - - private void checkEdges() { - int count = DEFAULT_EDGES; - - if (vertices != null) { - count = vertices.size() + vertices.size() / 2; - } - - checkEdges(count); - } - - private void checkEdges(int nEdges) { - if (incidentEdges == null) { - incidentEdges = new HashMap<>(nEdges); - } - if (excidentEdges == null) { - excidentEdges = new HashMap<>(nEdges); - } - } - // ------------------------------------------------------------------------ - private static void checkVertex(MetadataGraphVertex v) throws MetadataResolutionException { - if (v == null) { - throw new MetadataResolutionException("null vertex"); - } - if (v.getMd() == null) { - throw new MetadataResolutionException("vertex without metadata"); - } - } - // ------------------------------------------------------------------------ - private static void checkEdge(MetadataGraphEdge e) throws MetadataResolutionException { - if (e == null) { - throw new MetadataResolutionException("badly formed edge"); - } - } - // ------------------------------------------------------------------------ - public List getEdgesBetween(MetadataGraphVertex vFrom, MetadataGraphVertex vTo) { - List edges = getIncidentEdges(vTo); - if (edges == null || edges.isEmpty()) { - return null; - } - - List res = new ArrayList<>(edges.size()); - - for (MetadataGraphEdge e : edges) { - if (e.getSource().equals(vFrom)) { - res.add(e); - } - } - - return res; - } - // ------------------------------------------------------------------------ - public MetadataGraph addEdge(MetadataGraphVertex vFrom, MetadataGraphVertex vTo, MetadataGraphEdge e) - throws MetadataResolutionException { - checkVertex(vFrom); - checkVertex(vTo); - - checkVertices(); - - checkEdge(e); - checkEdges(); - - e.setSource(vFrom); - e.setTarget(vTo); - - vFrom.setCompareVersion(versionedVertices); - vFrom.setCompareScope(scopedVertices); - - List exList = excidentEdges.computeIfAbsent(vFrom, k -> new ArrayList<>()); - - if (!exList.contains(e)) { - exList.add(e); - } - - List inList = incidentEdges.computeIfAbsent(vTo, k -> new ArrayList<>()); - - if (!inList.contains(e)) { - inList.add(e); - } - - return this; - } - // ------------------------------------------------------------------------ - public MetadataGraph removeVertex(MetadataGraphVertex v) { - if (vertices != null && v != null) { - vertices.remove(v); - } - - if (incidentEdges != null) { - incidentEdges.remove(v); - } - - if (excidentEdges != null) { - excidentEdges.remove(v); - } - - return this; - } - // ------------------------------------------------------------------------ - private static int countNodes(MetadataTreeNode tree) { - if (tree == null) { - return 0; - } - - int count = 1; - MetadataTreeNode[] kids = tree.getChildren(); - if (kids == null || kids.length < 1) { - return count; - } - for (MetadataTreeNode n : kids) { - count += countNodes(n); - } - - return count; - } - - // ------------------------------------------------------------------------ - public MetadataGraphVertex getEntry() { - return entry; - } - - public void setEntry(MetadataGraphVertex entry) { - this.entry = entry; - } - - public TreeSet getVertices() { - return vertices; - } - - public List getIncidentEdges(MetadataGraphVertex vertex) { - checkEdges(); - return incidentEdges.get(vertex); - } - - public List getExcidentEdges(MetadataGraphVertex vertex) { - checkEdges(); - return excidentEdges.get(vertex); - } - - public boolean isVersionedVertices() { - return versionedVertices; - } - - public void setVersionedVertices(boolean versionedVertices) { - this.versionedVertices = versionedVertices; - } - - public boolean isScopedVertices() { - return scopedVertices; - } - - public void setScopedVertices(boolean scopedVertices) { - this.scopedVertices = scopedVertices; - - // scoped graph is versioned by definition - if (scopedVertices) { - versionedVertices = true; - } - } - - public ArtifactScopeEnum getScope() { - return scope; - } - - public void setScope(ArtifactScopeEnum scope) { - this.scope = scope; - } - - // ------------------------------------------------------------------------ - public boolean isEmpty() { - return entry == null || vertices == null || vertices.isEmpty(); - } - - // ------------------------------------------------------------------------ - public boolean isEmptyEdges() { - return isEmpty() || incidentEdges == null || incidentEdges.isEmpty(); - } - // ------------------------------------------------------------------------ - @Override - public String toString() { - if (isEmpty()) { - return "empty"; - } - StringBuilder sb = new StringBuilder(512); - for (MetadataGraphVertex v : vertices) { - sb.append("Vertex: ").append(v.getMd().toString()).append('\n'); - List ins = getIncidentEdges(v); - if (ins != null) { - for (MetadataGraphEdge e : ins) { - sb.append(" from : ").append(e.toString()).append('\n'); - } - } else { - sb.append(" no entries\n"); - } - - List outs = getExcidentEdges(v); - if (outs != null) { - for (MetadataGraphEdge e : outs) { - sb.append(" to : ").append(e.toString()).append('\n'); - } - } else { - sb.append(" no exit\n"); - } - - sb.append("-------------------------------------------------\n"); - } - sb.append("=============================================================\n"); - return sb.toString(); - } - - // ------------------------------------------------------------------------ - // ------------------------------------------------------------------------ -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java deleted file mode 100644 index 161b9beef91b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * metadata graph edge - combination of version, scope and depth define - * an edge in the graph - * - * - */ -@Deprecated -public class MetadataGraphEdge { - String version; - ArtifactScopeEnum scope; - int depth = -1; - int pomOrder = -1; - boolean resolved = true; - String artifactUri; - - /** - * capturing where this link came from - * and where it is linked to. - * - * In the first implementation only source used for explanatory function - */ - MetadataGraphVertex source; - - MetadataGraphVertex target; - - // ---------------------------------------------------------------------------- - public MetadataGraphEdge( - String version, boolean resolved, ArtifactScopeEnum scope, String artifactUri, int depth, int pomOrder) { - super(); - this.version = version; - this.scope = scope; - this.artifactUri = artifactUri; - this.depth = depth; - this.resolved = resolved; - this.pomOrder = pomOrder; - } - // ---------------------------------------------------------------------------- - /** - * helper for equals - */ - private static boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } - if (o1 == null || o2 == null) { - return false; // as they are not both null - } - return o1.equals(o2); - } - - // ---------------------------------------------------------------------------- - /** - * used to eliminate exact duplicates in the edge list - */ - @Override - @SuppressWarnings("checkstyle:equalshashcode") - public boolean equals(Object o) { - if (o instanceof MetadataGraphEdge) { - MetadataGraphEdge e = (MetadataGraphEdge) o; - - return objectsEqual(version, e.version) - && ArtifactScopeEnum.checkScope(scope) - .getScope() - .equals(ArtifactScopeEnum.checkScope(e.scope).getScope()) - && depth == e.depth; - } - return false; - } - - // ---------------------------------------------------------------------------- - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public ArtifactScopeEnum getScope() { - return scope; - } - - public void setScope(ArtifactScopeEnum scope) { - this.scope = scope; - } - - public int getDepth() { - return depth; - } - - public void setDepth(int depth) { - this.depth = depth; - } - - public boolean isResolved() { - return resolved; - } - - public void setResolved(boolean resolved) { - this.resolved = resolved; - } - - public int getPomOrder() { - return pomOrder; - } - - public void setPomOrder(int pomOrder) { - this.pomOrder = pomOrder; - } - - public String getArtifactUri() { - return artifactUri; - } - - public void setArtifactUri(String artifactUri) { - this.artifactUri = artifactUri; - } - - public MetadataGraphVertex getSource() { - return source; - } - - public void setSource(MetadataGraphVertex source) { - this.source = source; - } - - public MetadataGraphVertex getTarget() { - return target; - } - - public void setTarget(MetadataGraphVertex target) { - this.target = target; - } - - @Override - public String toString() { - return "[ " + "FROM:(" - + (source == null ? "no source" : (source.md == null ? "no source MD" : source.md.toString())) + ") " - + "TO:(" + (target == null ? "no target" : (target.md == null ? "no target MD" : target.md.toString())) - + ") " + "version=" + version + ", scope=" + (scope == null ? "null" : scope.getScope()) + ", depth=" - + depth + "]"; - } - // ---------------------------------------------------------------------------- - // ---------------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java deleted file mode 100644 index 85e79fef60d0..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - */ -@Deprecated -public class MetadataGraphTransformationException extends Exception { - - private static final long serialVersionUID = -4029897098314019152L; - - public MetadataGraphTransformationException() {} - - public MetadataGraphTransformationException(String message) { - super(message); - } - - public MetadataGraphTransformationException(Throwable cause) { - super(cause); - } - - public MetadataGraphTransformationException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java deleted file mode 100644 index ee8a3b575714..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * metadata graph vertice - just a wrapper around artifact's metadata - * - */ -@Deprecated -public class MetadataGraphVertex implements Comparable { - ArtifactMetadata md; - - // indications to use these in comparison - private boolean compareVersion = false; - private boolean compareScope = false; - - public MetadataGraphVertex(ArtifactMetadata md) { - super(); - this.md = md; - } - - public MetadataGraphVertex(ArtifactMetadata md, boolean compareVersion, boolean compareScope) { - this(md); - this.compareVersion = compareVersion; - this.compareScope = compareScope; - } - - public ArtifactMetadata getMd() { - return md; - } - - public void setMd(ArtifactMetadata md) { - this.md = md; - } - - // --------------------------------------------------------------------- - public boolean isCompareVersion() { - return compareVersion; - } - - public void setCompareVersion(boolean compareVersion) { - this.compareVersion = compareVersion; - } - - public boolean isCompareScope() { - return compareScope; - } - - public void setCompareScope(boolean compareScope) { - this.compareScope = compareScope; - } - - // --------------------------------------------------------------------- - @Override - public String toString() { - return "[" + (md == null ? "no metadata" : md.toString()) + "]"; - } - - // --------------------------------------------------------------------- - private static int compareStrings(String s1, String s2) { - if (s1 == null && s2 == null) { - return 0; - } - - if (s1 == null /* && s2 != null */) { - return -1; - } - - if ( - /* s1 != null && */ s2 == null) { - return 1; - } - - return s1.compareTo(s2); - } - - // --------------------------------------------------------------------- - public int compareTo(MetadataGraphVertex vertex) { - if (vertex == null || vertex.getMd() == null) { - return 1; - } - - ArtifactMetadata vmd = vertex.getMd(); - - if (vmd == null) { - if (md == null) { - return 0; - } else { - return 1; - } - } - - int g = compareStrings(md.groupId, vmd.groupId); - - if (g == 0) { - int a = compareStrings(md.artifactId, vmd.artifactId); - if (a == 0) { - if (compareVersion) { - int v = compareStrings(md.version, vmd.version); - if (v == 0) { - if (compareScope) { - String s1 = ArtifactScopeEnum.checkScope(md.artifactScope) - .getScope(); - String s2 = ArtifactScopeEnum.checkScope(vmd.artifactScope) - .getScope(); - return s1.compareTo(s2); - } else { - return 0; - } - } else { - return v; - } - } else { - return 0; - } - } else { - return a; - } - } - - return g; - } - - // --------------------------------------------------------------------- - @Override - public boolean equals(Object vo) { - if (!(vo instanceof MetadataGraphVertex)) { - return false; - } - return compareTo((MetadataGraphVertex) vo) == 0; - } - - // --------------------------------------------------------------------- - - @Override - public int hashCode() { - if (md == null) { - return super.hashCode(); - } - StringBuilder hashString = new StringBuilder(128); - hashString.append(md.groupId).append('|'); - hashString.append(md.artifactId).append('|'); - - if (compareVersion) { - hashString.append(md.version).append('|'); - } - - if (compareScope) { - hashString.append(md.getArtifactScope()).append('|'); - } - - return hashString.toString().hashCode(); - - // BASE64Encoder b64 = new BASE64Encoder(); - // return b64.encode( hashString.toString().getBytes() ).hashCode(); - } - - // --------------------------------------------------------------------- - // --------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java deleted file mode 100644 index 21d48366bdf9..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.Collection; - -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * - * - */ -@Deprecated -public class MetadataResolution { - /** resolved MD */ - private ArtifactMetadata artifactMetadata; - - /** repositories, added by this POM */ - private Collection metadataRepositories; - // ------------------------------------------------------------------- - public MetadataResolution(ArtifactMetadata artifactMetadata) { - this.artifactMetadata = artifactMetadata; - } - // ------------------------------------------------------------------- - public MetadataResolution(ArtifactMetadata artifactMetadata, Collection metadataRepositories) { - this(artifactMetadata); - this.metadataRepositories = metadataRepositories; - } - // ------------------------------------------------------------------- - public Collection getMetadataRepositories() { - return metadataRepositories; - } - - public void setMetadataRepositories(Collection metadataRepositories) { - this.metadataRepositories = metadataRepositories; - } - // ------------------------------------------------------------------- - public ArtifactMetadata getArtifactMetadata() { - return artifactMetadata; - } - - public void setArtifactMetadata(ArtifactMetadata artifactMetadata) { - this.artifactMetadata = artifactMetadata; - } - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java deleted file mode 100644 index ab18144c17c4..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - * MetadataResolutionException - */ -@Deprecated -public class MetadataResolutionException extends Exception { - - public MetadataResolutionException() { - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException(String message) { - super(message); - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException(Throwable cause) { - super(cause); - // TODO Auto-generated constructor stub - } - - public MetadataResolutionException(String message, Throwable cause) { - super(message, cause); - // TODO Auto-generated constructor stub - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java deleted file mode 100644 index ec2bbecd6dee..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; - -@Deprecated -public class MetadataResolutionRequest { - protected ArtifactMetadata query; - protected ArtifactRepository localRepository; - protected List remoteRepositories; - - // -------------------------------------------------------------------- - public MetadataResolutionRequest() {} - - // -------------------------------------------------------------------- - public MetadataResolutionRequest( - ArtifactMetadata query, ArtifactRepository localRepository, List remoteRepositories) { - this.query = query; - this.localRepository = localRepository; - this.remoteRepositories = remoteRepositories; - } - - // -------------------------------------------------------------------- - public ArtifactMetadata getQuery() { - return query; - } - - public void setQuery(ArtifactMetadata query) { - this.query = query; - } - - public ArtifactRepository getLocalRepository() { - return localRepository; - } - - public void setLocalRepository(ArtifactRepository localRepository) { - this.localRepository = localRepository; - } - - public List getRemoteRepositories() { - return remoteRepositories; - } - - public void setRemoteRepositories(List remoteRepositories) { - this.remoteRepositories = remoteRepositories; - } - // -------------------------------------------------------------------- - // -------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java deleted file mode 100644 index 927464b7c46c..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - * MetadataResolutionRequestTypeEnum - */ -@Deprecated -public enum MetadataResolutionRequestTypeEnum { - tree(1), - graph(2), - classpathCompile(3), - classpathTest(4), - classpathRuntime(5), - versionedGraph(6), - scopedGraph(7); - - private int id; - - // Constructor - MetadataResolutionRequestTypeEnum(int id) { - this.id = id; - } - - int getId() { - return id; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java deleted file mode 100644 index e5bd8f14ed65..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.ArtifactScopeEnum; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; - -/** - * This object is tinted with ClasspathTransformation and GraphConflictResolver. - * Get rid of them after debugging - * - */ -@Deprecated -public class MetadataResolutionResult { - MetadataTreeNode treeRoot; - - /** - * these components are initialized on demand by - * explicit call of the initTreeProcessing() - */ - ClasspathTransformation classpathTransformation; - - GraphConflictResolver conflictResolver; - - // ---------------------------------------------------------------------------- - public MetadataResolutionResult() {} - // ---------------------------------------------------------------------------- - public MetadataResolutionResult(MetadataTreeNode root) { - this.treeRoot = root; - } - // ---------------------------------------------------------------------------- - public MetadataTreeNode getTree() { - return treeRoot; - } - // ---------------------------------------------------------------------------- - public void setTree(MetadataTreeNode root) { - this.treeRoot = root; - } - - public void initTreeProcessing(PlexusContainer plexus) throws ComponentLookupException { - classpathTransformation = plexus.lookup(ClasspathTransformation.class); - conflictResolver = plexus.lookup(GraphConflictResolver.class); - } - // ---------------------------------------------------------------------------- - public MetadataGraph getGraph() throws MetadataResolutionException { - return treeRoot == null ? null : new MetadataGraph(treeRoot); - } - // ---------------------------------------------------------------------------- - public MetadataGraph getGraph(ArtifactScopeEnum scope) - throws MetadataResolutionException, GraphConflictResolutionException { - if (treeRoot == null) { - return null; - } - - if (conflictResolver == null) { - return null; - } - - return conflictResolver.resolveConflicts(getGraph(), scope); - } - // ---------------------------------------------------------------------------- - public MetadataGraph getGraph(MetadataResolutionRequestTypeEnum requestType) - throws MetadataResolutionException, GraphConflictResolutionException { - if (requestType == null) { - return null; - } - - if (treeRoot == null) { - return null; - } - - if (conflictResolver == null) { - return null; - } - - if (requestType.equals(MetadataResolutionRequestTypeEnum.classpathCompile)) { - return conflictResolver.resolveConflicts(getGraph(), ArtifactScopeEnum.compile); - } else if (requestType.equals(MetadataResolutionRequestTypeEnum.classpathRuntime)) { - return conflictResolver.resolveConflicts(getGraph(), ArtifactScopeEnum.runtime); - } else if (requestType.equals(MetadataResolutionRequestTypeEnum.classpathTest)) { - return conflictResolver.resolveConflicts(getGraph(), ArtifactScopeEnum.test); - } else if (requestType.equals(MetadataResolutionRequestTypeEnum.graph)) { - return getGraph(); - } else if (requestType.equals(MetadataResolutionRequestTypeEnum.versionedGraph)) { - return new MetadataGraph(getTree(), true, false); - } else if (requestType.equals(MetadataResolutionRequestTypeEnum.scopedGraph)) { - return new MetadataGraph(getTree(), true, true); - } - return null; - } - // ---------------------------------------------------------------------------- - public ClasspathContainer getClasspath(ArtifactScopeEnum scope) - throws MetadataGraphTransformationException, MetadataResolutionException { - if (classpathTransformation == null) { - return null; - } - - MetadataGraph dirtyGraph = getGraph(); - if (dirtyGraph == null) { - return null; - } - - return classpathTransformation.transform(dirtyGraph, scope, false); - } - - // ---------------------------------------------------------------------------- - public MetadataTreeNode getClasspathTree(ArtifactScopeEnum scope) - throws MetadataGraphTransformationException, MetadataResolutionException { - ClasspathContainer cpc = getClasspath(scope); - if (cpc == null) { - return null; - } - - return cpc.getClasspathAsTree(); - } - // ---------------------------------------------------------------------------- - // ---------------------------------------------------------------------------- -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java deleted file mode 100644 index dd7d51ef54cd..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -/** - * Error while retrieving repository metadata from the repository. - * - */ -@Deprecated -public class MetadataRetrievalException extends Exception { - - private ArtifactMetadata artifact; - - public MetadataRetrievalException(String message) { - this(message, null, null); - } - - public MetadataRetrievalException(Throwable cause) { - this(null, cause, null); - } - - public MetadataRetrievalException(String message, Throwable cause) { - this(message, cause, null); - } - - public MetadataRetrievalException(String message, Throwable cause, ArtifactMetadata artifact) { - super(message, cause); - - this.artifact = artifact; - } - - public ArtifactMetadata getArtifactMetadata() { - return artifact; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java deleted file mode 100644 index bab22f70000d..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; - -/** - * Provides some metadata operations, like querying the remote repository for a list of versions available for an - * artifact. - * - */ -@Deprecated -public interface MetadataSource { - String ROLE = MetadataSource.class.getName(); - - MetadataResolution retrieve( - ArtifactMetadata artifact, ArtifactRepository localRepository, List remoteRepositories) - throws MetadataRetrievalException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java b/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java deleted file mode 100644 index 7fbe882ad759..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.ArtifactScopeEnum; - -/** - * metadata [dirty] Tree - * - * - */ -@Deprecated -public class MetadataTreeNode { - ArtifactMetadata md; // this node - - MetadataTreeNode parent; // papa - - /** default # of children. Used for tree creation optimization only */ - int nChildren = 8; - - MetadataTreeNode[] children; // of cause - - public int getNChildren() { - return nChildren; - } - - public void setNChildren(int children) { - nChildren = children; - } - - // ------------------------------------------------------------------------ - public MetadataTreeNode() {} - // ------------------------------------------------------------------------ - public MetadataTreeNode(ArtifactMetadata md, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope) { - if (md != null) { - md.setArtifactScope(ArtifactScopeEnum.checkScope(scope)); - md.setResolved(resolved); - } - - this.md = md; - this.parent = parent; - } - // ------------------------------------------------------------------------ - public MetadataTreeNode(Artifact af, MetadataTreeNode parent, boolean resolved, ArtifactScopeEnum scope) { - this(new ArtifactMetadata(af), parent, resolved, scope); - } - - // ------------------------------------------------------------------------ - public void addChild(int index, MetadataTreeNode kid) { - if (kid == null) { - return; - } - - if (children == null) { - children = new MetadataTreeNode[nChildren]; - } - - children[index % nChildren] = kid; - } - - // ------------------------------------------------------------------ - @Override - public String toString() { - return md == null ? "no metadata" : md.toString(); - } - - // ------------------------------------------------------------------ - public String graphHash() throws MetadataResolutionException { - if (md == null) { - throw new MetadataResolutionException( - "treenode without metadata, parent: " + (parent == null ? "null" : parent.toString())); - } - - return md.groupId + ":" + md.artifactId; - } - - // ------------------------------------------------------------------------ - public boolean hasChildren() { - return children != null; - } - // ------------------------------------------------------------------------ - public ArtifactMetadata getMd() { - return md; - } - - public void setMd(ArtifactMetadata md) { - this.md = md; - } - - public MetadataTreeNode getParent() { - return parent; - } - - public void setParent(MetadataTreeNode parent) { - this.parent = parent; - } - - public MetadataTreeNode[] getChildren() { - return children; - } - - public void setChildren(MetadataTreeNode[] children) { - this.children = children; - } - // ------------------------------------------------------------------------ - // ------------------------------------------------------------------------ - -} diff --git a/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java b/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java deleted file mode 100644 index c669fcc4493e..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.settings; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.properties.internal.SystemProperties; -import org.apache.maven.settings.building.DefaultSettingsBuildingRequest; -import org.apache.maven.settings.building.SettingsBuilder; -import org.apache.maven.settings.building.SettingsBuildingException; -import org.apache.maven.settings.building.SettingsBuildingRequest; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - */ -@Deprecated -@Named -@Singleton -public class DefaultMavenSettingsBuilder extends AbstractLogEnabled implements MavenSettingsBuilder { - - private final SettingsBuilder settingsBuilder; - - @Inject - public DefaultMavenSettingsBuilder(SettingsBuilder settingsBuilder) { - this.settingsBuilder = settingsBuilder; - } - - public Settings buildSettings() throws IOException, XmlPullParserException { - File userSettingsFile = getFile( - "${user.home}/.m2/settings.xml", "user.home", MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION); - - return buildSettings(userSettingsFile); - } - - public Settings buildSettings(boolean useCachedSettings) throws IOException, XmlPullParserException { - return buildSettings(); - } - - public Settings buildSettings(File userSettingsFile) throws IOException, XmlPullParserException { - File globalSettingsFile = getFile( - "${maven.conf}/settings.xml", "maven.conf", MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION); - - SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); - request.setUserSettingsFile(userSettingsFile); - request.setGlobalSettingsFile(globalSettingsFile); - request.setSystemProperties(SystemProperties.getSystemProperties()); - return build(request); - } - - public Settings buildSettings(File userSettingsFile, boolean useCachedSettings) - throws IOException, XmlPullParserException { - return buildSettings(userSettingsFile); - } - - private Settings build(SettingsBuildingRequest request) throws IOException, XmlPullParserException { - try { - return settingsBuilder.build(request).getEffectiveSettings(); - } catch (SettingsBuildingException e) { - throw new IOException(e.getMessage(), e); - } - } - - /** @since 2.1 */ - public Settings buildSettings(MavenExecutionRequest request) throws IOException, XmlPullParserException { - SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); - settingsRequest.setUserSettingsFile(request.getUserSettingsFile()); - settingsRequest.setProjectSettingsFile(request.getProjectSettingsFile()); - settingsRequest.setGlobalSettingsFile(request.getGlobalSettingsFile()); - settingsRequest.setUserProperties(request.getUserProperties()); - settingsRequest.setSystemProperties(request.getSystemProperties()); - - return build(settingsRequest); - } - - private File getFile(String pathPattern, String basedirSysProp, String altLocationSysProp) { - // ------------------------------------------------------------------------------------- - // Alright, here's the justification for all the regexp wizardry below... - // - // Continuum and other server-like apps may need to locate the user-level and - // global-level settings somewhere other than ${user.home} and ${maven.home}, - // respectively. Using a simple replacement of these patterns will allow them - // to specify the absolute path to these files in a customized components.xml - // file. Ideally, we'd do full pattern-evaluation against the sysprops, but this - // is a first step. There are several replacements below, in order to normalize - // the path character before we operate on the string as a regex input, and - // in order to avoid surprises with the File construction... - // ------------------------------------------------------------------------------------- - - String path = System.getProperty(altLocationSysProp); - - if (path == null || path.isEmpty()) { - // TODO This replacing shouldn't be necessary as user.home should be in the - // context of the container and thus the value would be interpolated by Plexus - String basedir = System.getProperty(basedirSysProp); - if (basedir == null) { - basedir = System.getProperty("user.dir"); - } - - basedir = basedir.replace("\\", "/"); - basedir = basedir.replace("$", "\\$"); - - // basedirSysProp is non regexp and basedir too - path = pathPattern.replace("${" + basedirSysProp + "}", basedir); - path = path.replace("\\", "/"); - // --------------------------------------------------------------------------------- - // I'm not sure if this last regexp was really intended to disallow the usage of - // network paths as user.home directory. Unfortunately it did. I removed it and - // have not detected any problems yet. - // --------------------------------------------------------------------------------- - // path = path.replaceAll( "//", "/" ); - - } - return new File(path).getAbsoluteFile(); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java b/maven-compat/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java deleted file mode 100644 index ea39c20e507b..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/settings/MavenSettingsBuilder.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.settings; - -import java.io.File; -import java.io.IOException; - -import org.apache.maven.execution.MavenExecutionRequest; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - */ -@Deprecated -public interface MavenSettingsBuilder { - - String ROLE = MavenSettingsBuilder.class.getName(); - - String ALT_USER_SETTINGS_XML_LOCATION = "org.apache.maven.user-settings"; - String ALT_GLOBAL_SETTINGS_XML_LOCATION = "org.apache.maven.global-settings"; - String ALT_LOCAL_REPOSITORY_LOCATION = "maven.repo.local"; - - Settings buildSettings(MavenExecutionRequest request) throws IOException, XmlPullParserException; - - /** - * @return a Settings object from the user settings file. - * @throws IOException if any - * @throws XmlPullParserException if any - */ - Settings buildSettings() throws IOException, XmlPullParserException; - - /** - * @param useCachedSettings if true, doesn't reload the user settings - * @return a Settings object from the user settings file. - * @throws IOException if any - * @throws XmlPullParserException if any - */ - Settings buildSettings(boolean useCachedSettings) throws IOException, XmlPullParserException; - - /** - * @param userSettingsFile a given user settings file - * @return a Settings object from the user settings file. - * @throws IOException if any - * @throws XmlPullParserException if any - */ - Settings buildSettings(File userSettingsFile) throws IOException, XmlPullParserException; - - /** - * @param userSettingsFile a given user settings file - * @param useCachedSettings if true, doesn't reload the user settings - * @return a Settings object from the user settings file. - * @throws IOException if any - * @throws XmlPullParserException if any - */ - Settings buildSettings(File userSettingsFile, boolean useCachedSettings) throws IOException, XmlPullParserException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java b/maven-compat/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java deleted file mode 100644 index e78fd2ca8ad1..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/toolchain/DefaultToolchainsBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.toolchain; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.InputStream; -import java.nio.file.Files; - -import org.apache.maven.toolchain.model.PersistedToolchains; -import org.apache.maven.toolchain.v4.MavenToolchainsStaxReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @deprecated instead use {@link org.apache.maven.toolchain.building.DefaultToolchainsBuilder} - */ -@Deprecated -@Named("default") -@Singleton -public class DefaultToolchainsBuilder implements ToolchainsBuilder { - private final Logger logger = LoggerFactory.getLogger(getClass()); - - public PersistedToolchains build(File userToolchainsFile) throws MisconfiguredToolchainException { - PersistedToolchains toolchains = null; - - if (userToolchainsFile != null && userToolchainsFile.isFile()) { - try (InputStream in = Files.newInputStream(userToolchainsFile.toPath())) { - toolchains = new PersistedToolchains(new MavenToolchainsStaxReader().read(in)); - } catch (Exception e) { - throw new MisconfiguredToolchainException( - "Cannot read toolchains file at " + userToolchainsFile.getAbsolutePath(), e); - } - - } else if (userToolchainsFile != null) { - logger.debug("Toolchains configuration was not found at {}", userToolchainsFile); - } - - return toolchains; - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java b/maven-compat/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java deleted file mode 100644 index 2f16b8f6ce41..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/toolchain/ToolchainsBuilder.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.toolchain; - -import java.io.File; - -import org.apache.maven.toolchain.model.PersistedToolchains; - -/** - * Builds the toolchains model from a previously configured filesystem path to the toolchains file. - * Note: This is an internal component whose interface can change without prior notice. - * - * @deprecated use {@link org.apache.maven.toolchain.building.ToolchainsBuilder} instead - */ -@Deprecated -public interface ToolchainsBuilder { - - /** - * Builds the toolchains model from the configured toolchain files. - * - * @param userToolchainsFile The path to the toolchains file, may be null to disable parsing. - * @return The toolchains model or null if no toolchain file was configured or the configured file does - * not exist. - * @throws MisconfiguredToolchainException If the toolchain file exists but cannot be parsed. - */ - PersistedToolchains build(File userToolchainsFile) throws MisconfiguredToolchainException; -} diff --git a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java deleted file mode 100644 index 1378ab248b42..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.usability.plugin; - -/** - * ExpressionDocumentationException - */ -@Deprecated -public class ExpressionDocumentationException extends Exception { - static final long serialVersionUID = 1; - - public ExpressionDocumentationException(String message, Throwable cause) { - super(message, cause); - } - - public ExpressionDocumentationException(String message) { - super(message); - } -} diff --git a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java deleted file mode 100644 index 55b1a4ac1700..000000000000 --- a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.usability.plugin; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader; -import org.codehaus.plexus.util.xml.pull.XmlPullParserException; - -/** - * ExpressionDocumenter - */ -@Deprecated -public class ExpressionDocumenter { - - private static final String[] EXPRESSION_ROOTS = {"project", "settings", "session", "plugin", "rootless"}; - - private static final String EXPRESSION_DOCO_ROOTPATH = "META-INF/maven/plugin-expressions/"; - - private static Map expressionDocumentation; - - public static Map load() throws ExpressionDocumentationException { - if (expressionDocumentation == null) { - expressionDocumentation = new HashMap<>(); - - ClassLoader docLoader = initializeDocLoader(); - - for (String root : EXPRESSION_ROOTS) { - try (InputStream docStream = - docLoader.getResourceAsStream(EXPRESSION_DOCO_ROOTPATH + root + ".paramdoc.xml")) { - if (docStream != null) { - Map doco = parseExpressionDocumentation(docStream); - - expressionDocumentation.putAll(doco); - } - } catch (IOException e) { - throw new ExpressionDocumentationException( - "Failed to read documentation for expression root: " + root, e); - } catch (XmlPullParserException e) { - throw new ExpressionDocumentationException( - "Failed to parse documentation for expression root: " + root, e); - } - } - } - - return expressionDocumentation; - } - - /** - * - * - * project.distributionManagementArtifactRepository - * - * - * some-repo - * scp://host/path - * - * - * some-snap-repo - * scp://host/snapshot-path - * - * - * ]]> - * - * - * - * - * @throws IOException - * @throws XmlPullParserException - */ - private static Map parseExpressionDocumentation(InputStream docStream) - throws IOException, XmlPullParserException { - ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader(); - - ExpressionDocumentation documentation = paramdocReader.read(docStream, true); - - List expressions = documentation.getExpressions(); - - Map bySyntax = new HashMap<>(); - - if (expressions != null && !expressions.isEmpty()) { - for (Expression expression : expressions) { - bySyntax.put(expression.getSyntax(), expression); - } - } - - return bySyntax; - } - - private static ClassLoader initializeDocLoader() throws ExpressionDocumentationException { - String myResourcePath = ExpressionDocumenter.class.getName().replace('.', '/') + ".class"; - - URL myResource = ExpressionDocumenter.class.getClassLoader().getResource(myResourcePath); - - assert myResource != null : "The resource is this class itself loaded by its own classloader and must exist"; - - String myClasspathEntry = myResource.getPath(); - - myClasspathEntry = myClasspathEntry.substring(0, myClasspathEntry.length() - (myResourcePath.length() + 2)); - - if (myClasspathEntry.startsWith("file:")) { - myClasspathEntry = myClasspathEntry.substring("file:".length()); - } - - URL docResource; - try { - docResource = new File(myClasspathEntry).toURL(); - } catch (MalformedURLException e) { - throw new ExpressionDocumentationException( - "Cannot construct expression documentation classpath" + " resource base.", e); - } - - return new URLClassLoader(new URL[] {docResource}); - } -} diff --git a/maven-compat/src/main/mdo/paramdoc.mdo b/maven-compat/src/main/mdo/paramdoc.mdo deleted file mode 100644 index ab253316db5c..000000000000 --- a/maven-compat/src/main/mdo/paramdoc.mdo +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - paramdoc - Paramdoc - - - - package - org.apache.maven.usability.plugin - - - - - 1.0.0 - ExpressionDocumentation - The root of a parameter plugin expression document. - - - 1.0.0 - expressions - The list of plugin parameter expressions described by this - document. - - Expression - * - - - - - - 1.0.0 - - - - - - 1.0.0 - Expression - A plugin parameter expression supported by Maven - - - 1.0.0 - syntax - The syntax of the expression - String - true - - - 1.0.0 - description - The description of what this expression references, and what it's generally used for. - String - true - - - 1.0.0 - configuration - The place and syntax used to change the value of this expression. - String - - - 1.0.0 - cliOptions - The command-line switches used to change the value of this expression. - Properties - - String - * - - - - 1.0.0 - apiMethods - The programmatic methods used to change the value of this expression. - Properties - - String - * - - - - 1.0.0 - deprecation - A preferred alternative to this expression, in the case where it's deprecated. - String - - - 1.0.0 - ban - A preferred alternative to this expression, in the case where it's banned from use. - String - - - 1.0.0 - editable - Whether the value of this expression can be changed. - boolean - true - - - - - diff --git a/maven-compat/src/main/mdo/profiles.mdo b/maven-compat/src/main/mdo/profiles.mdo deleted file mode 100644 index 2843e806e1f6..000000000000 --- a/maven-compat/src/main/mdo/profiles.mdo +++ /dev/null @@ -1,400 +0,0 @@ - - - - profiles - Profiles - Deprecated in Maven 2 Project-local overrides to the build process based on detected or user-provided environmental parameters. - This is the model specification for ${basedir}/profiles.xml. - ]]> - - - package - org.apache.maven.profiles - - - - - ProfilesRoot - 1.0.0 - Root element of the profiles.xml file. - - - profiles - 1.0.0 - - - Profile - * - - - - activeProfiles - 1.0.0 - - - String - * - - - - - - Profile - 1.0.0 - - - - id - true - 1.0.0 - String - The ID of this build profile, for activation - purposes. - - - activation - 1.0.0 - - - Activation - - - - properties - Extended configuration specific to this profile goes - here. - Properties - - String - * - - - - repositories - 1.0.0 - - - - Repository - * - - - - pluginRepositories - 1.0.0 - - - Repository - * - - - - - - - Activation - 1.0.0 - - - - activeByDefault - 1.0.0 - boolean - Flag specifying whether this profile is active as a default. - - - jdk - 1.0.0 - String - - - - os - 1.0.0 - - - ActivationOS - - - - property - 1.0.0 - - - ActivationProperty - - - - file - 1.0.0 - - - ActivationFile - - - - - - - - RepositoryBase - 1.0.0 - - - - id - 1.0.0 - - String - - - name - 1.0.0 - - String - - - url - 1.0.0 - - String - - - layout - 1.0.0 - The type of layout this repository uses for locating and storing artifacts - can be "legacy" or - "default". - String - default - - - - - 1.0.0 - - - - - - Repository - RepositoryBase - 1.0.0 - - Repository contains the information needed for establishing connections with remote repository - - - - releases - 1.0.0 - How to handle downloading of releases from this repository - - RepositoryPolicy - - - - snapshots - 1.0.0 - How to handle downloading of snapshots from this repository - - RepositoryPolicy - - - - - - - 1.0.0 - - - - - - - RepositoryPolicy - 1.0.0 - Download policy - - - enabled - 1.0.0 - Whether to use this repository for downloading this type of artifact - boolean - true - - - updatePolicy - 1.0.0 - - The frequency for downloading updates - can be "always", "daily" (default), "interval:XXX" (in minutes) or - "never" (only if it doesn't exist locally). - - String - - - checksumPolicy - 1.0.0 - - What to do when verification of an artifact checksum fails. Valid values are "fail" (default for Maven 4 and - above), "warn" (default for Maven 2 and 3) or "ignore". - - String - - - - - ActivationProperty - 1.0.0 - - - - name - 1.0.0 - String - true - The name of the property to be used to activate a profile - - - value - 1.0.0 - String - The value of the property to be used to activate a profile - - - - - ActivationFile - 1.0.0 - - - - missing - 1.0.0 - String - The name of the file that should be missing to activate a profile - - - exists - 1.0.0 - String - The name of the file that should exist to activate a profile - - - - - ActivationOS - 1.0.0 - - - - name - 1.0.0 - String - The name of the OS to be used to activate a profile - - - family - 1.0.0 - String - The general family of the OS to be used to activate a profile (e.g. 'windows') - - - arch - 1.0.0 - String - The architecture of the OS to be used to activate a profile - - - version - 1.0.0 - String - The version of the OS to be used to activate a profile - - - - - diff --git a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml b/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml deleted file mode 100644 index 9acebefc4d8e..000000000000 --- a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - project.distributionManagementArtifactRepository - - - - - repo - Repository Name - scp://host/path/to/repo - - - - repo - Repository Name - scp://host/path/to/repo - - - ]]> - This is the ArtifactRepository used to deploy artifacts built by this - Maven. - - - - project.artifact - - project.group -project-artifact -0.0.0.0 -type - ]]> - This is the Artifact instance created from the essential project - attributes: groupId, artifactId, version, and packaging (with a default packaging of - 'jar'). - - - - project.parent - - - project.group - project-artifact - 0.0.0.0 - - ]]> - This is the MavenProject instance for the parent of the current POM. - - - - project.file - This is the File instance that refers to the location of the current POM on - disk. - - - - project.artifacts - - - ... - - ]]> - - - - - project.parentArtifact - - - project.group - project-artifact - 0.0.0.0 - - ]]> - This is the Artifact instance for the parent of the current POM. - - - - project.pluginArtifacts - - - - ... - - - ]]> - - - - - project.remoteArtifactRepositories - - - ... - - ]]> - - - - - project.pluginArtifactRepositories - - - ... - - ]]> - - - - - project.attachedArtifacts - - - - - \ No newline at end of file diff --git a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml b/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml deleted file mode 100644 index 27f03435c329..000000000000 --- a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - localRepository - - /path/to/local/repository - ]]> - The ArtifactRepository instance referencing the local artifact - repository. - - - -Dmaven.repo.local=/path/to/local/repo - Override the local repository location on a per-build basis. - - - - - reactorProjects - This is the current list of projects being built by - Maven. - - - diff --git a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml b/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml deleted file mode 100644 index 36c61e8ba02f..000000000000 --- a/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - settings.offline - - true - ]]> - - - - - settings.interactiveMode - - true - ]]> - - - - - diff --git a/maven-compat/src/main/resources/META-INF/maven/plugin.xml b/maven-compat/src/main/resources/META-INF/maven/plugin.xml deleted file mode 100644 index da5a62c092e0..000000000000 --- a/maven-compat/src/main/resources/META-INF/maven/plugin.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - Maven Internal State-Management Plugins - org.apache.maven.plugins.internal - maven-state-management - 2.1 - statemgmt - false - true - - - start-fork - Setup the appropriate build state to initiate a forked execution. - false - false - false - false - false - true - org.apache.maven.lifecycle.statemgmt.StartForkedExecutionMojo - java - per-lookup - once-per-session - - - project - org.apache.maven.project.MavenProject - true - false - The current MavenProject instance, which will have a new executionProject set after execution. - - - session - org.apache.maven.execution.MavenSession - true - false - The current MavenSession instance, which will handle the fork context. - - - forkId - int - true - true - The current fork identifier. - - - - - - ${forkId} - - - - end-fork - Restore the non-fork currentProject instance, for use in the forking mojo. - false - false - false - false - false - true - org.apache.maven.lifecycle.statemgmt.EndForkedExecutionMojo - java - per-lookup - once-per-session - - - session - org.apache.maven.execution.MavenSession - true - false - The current MavenSession instance, which will handle the fork context. - - - forkId - int - true - true - The current fork identifier. - - - - - ${forkId} - - - - clear-fork-context - Tear down any build state used during the previous forked execution. - false - false - false - false - false - true - org.apache.maven.lifecycle.statemgmt.ClearForkedContextMojo - java - per-lookup - once-per-session - - - project - org.apache.maven.project.MavenProject - true - false - The current MavenProject instance, which will have the current executionProject cleared after execution. - - - forkId - int - true - true - The current fork identifier. - - - - - ${forkId} - - - - resolve-late-bound-plugin - Resolve a late-bound plugin during a build, right before it is to be used. - false - false - false - false - false - true - org.apache.maven.lifecycle.statemgmt.ResolveLateBoundPluginMojo - java - per-lookup - once-per-session - - - project - org.apache.maven.project.MavenProject - true - false - The current MavenProject instance, for building a new MojoBinding instance. - - - session - org.apache.maven.execution.MavenSession - true - false - The current MavenSession instance, which will handle the fork context. - - - groupId - java.lang.String - true - true - The plugin's groupId. - - - artifactId - java.lang.String - true - true - The plugin's artifactId. - - - version - java.lang.String - false - true - The plugin's version. - - - goal - java.lang.String - true - true - The mojo's goal that we're looking for, as an extra validation step. - - - - - - ${groupId} - ${artifactId} - ${version} - ${goal} - - - - org.apache.maven.plugin.loader.PluginLoader - pluginLoader - - - org.apache.maven.lifecycle.binding.MojoBindingFactory - bindingFactory - - - - - \ No newline at end of file diff --git a/maven-compat/src/site/apt/index.apt b/maven-compat/src/site/apt/index.apt deleted file mode 100644 index a288cdcc3d2e..000000000000 --- a/maven-compat/src/site/apt/index.apt +++ /dev/null @@ -1,32 +0,0 @@ -~~ Licensed to the Apache Software Foundation (ASF) under one -~~ or more contributor license agreements. See the NOTICE file -~~ distributed with this work for additional information -~~ regarding copyright ownership. The ASF licenses this file -~~ to you under the Apache License, Version 2.0 (the -~~ "License"); you may not use this file except in compliance -~~ with the License. You may obtain a copy of the License at -~~ -~~ http://www.apache.org/licenses/LICENSE-2.0 -~~ -~~ Unless required by applicable law or agreed to in writing, -~~ software distributed under the License is distributed on an -~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -~~ KIND, either express or implied. See the License for the -~~ specific language governing permissions and limitations -~~ under the License. - - ----- - Introduction - ----- - Hervé Boutemy - ----- - 2016-05-29 - ----- - -Maven Compat - - Maven2 classes maintained as compatibility layer for plugins that need to keep Maven2 compatibility. - - Plugins should avoid these classes and be updated to use only Maven3 dependencies (and require Maven3): see - {{{https://cwiki.apache.org/confluence/display/MAVEN/Plugin+migration+to+Maven3+dependencies} Plugin migration to Maven3 dependencies}} - documentation to get hints on how to make the update. diff --git a/maven-compat/src/site/site.xml b/maven-compat/src/site/site.xml deleted file mode 100644 index 78e98089a647..000000000000 --- a/maven-compat/src/site/site.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - ${project.scm.url} - - - - - - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java deleted file mode 100644 index 36c9110f9ec7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import javax.inject.Inject; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.DefaultMavenExecutionResult; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.internal.impl.DefaultRepositoryFactory; -import org.apache.maven.internal.impl.DefaultSession; -import org.apache.maven.internal.impl.InternalSession; -import org.apache.maven.model.Build; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Exclusion; -import org.apache.maven.model.Model; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.model.RepositoryPolicy; -import org.apache.maven.project.DefaultProjectBuildingRequest; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingRequest; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.repository.internal.MavenRepositorySystemUtils; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.codehaus.plexus.util.FileUtils; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider; -import org.eclipse.aether.internal.impl.DefaultRemoteRepositoryManager; -import org.eclipse.aether.internal.impl.DefaultUpdatePolicyAnalyzer; -import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; -import org.eclipse.aether.repository.LocalRepository; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.mockito.Mockito.mock; - -@PlexusTest -@Deprecated -public abstract class AbstractCoreMavenComponentTestCase { - - @Inject - protected PlexusContainer container; - - @Inject - protected RepositorySystem repositorySystem; - - @Inject - protected org.apache.maven.project.ProjectBuilder projectBuilder; - - protected abstract String getProjectsDirectory(); - - protected PlexusContainer getContainer() { - return container; - } - - protected File getProject(String name) throws Exception { - File source = new File(new File(getBasedir(), getProjectsDirectory()), name); - File target = new File(new File(getBasedir(), "target"), name); - FileUtils.copyDirectoryStructureIfModified(source, target); - return new File(target, "pom.xml"); - } - - protected MavenExecutionRequest createMavenExecutionRequest(File pom) throws Exception { - MavenExecutionRequest request = new DefaultMavenExecutionRequest() - .setPom(pom) - .setProjectPresent(true) - .setShowErrors(true) - .setPluginGroups(Arrays.asList("org.apache.maven.plugins")) - .setLocalRepository(getLocalRepository()) - .setRemoteRepositories(getRemoteRepositories()) - .setPluginArtifactRepositories(getPluginArtifactRepositories()) - .setGoals(Arrays.asList("package")); - - if (pom != null) { - request.setMultiModuleProjectDirectory(pom.getParentFile()); - } - - return request; - } - - // layer the creation of a project builder configuration with a request, but this will need to be - // a Maven subclass because we don't want to couple maven to the project builder which we need to - // separate. - protected MavenSession createMavenSession(File pom) throws Exception { - return createMavenSession(pom, new Properties()); - } - - protected MavenSession createMavenSession(File pom, Properties executionProperties) throws Exception { - return createMavenSession(pom, executionProperties, false); - } - - protected MavenSession createMavenSession(File pom, Properties executionProperties, boolean includeModules) - throws Exception { - MavenExecutionRequest request = createMavenExecutionRequest(pom); - - ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest() - .setLocalRepository(request.getLocalRepository()) - .setRemoteRepositories(request.getRemoteRepositories()) - .setPluginArtifactRepositories(request.getPluginArtifactRepositories()) - .setSystemProperties(executionProperties) - .setUserProperties(new Properties()); - - initRepoSession(configuration); - - MavenSession session = new MavenSession( - getContainer(), configuration.getRepositorySession(), request, new DefaultMavenExecutionResult()); - DefaultSession iSession = new DefaultSession( - session, - mock(org.eclipse.aether.RepositorySystem.class), - null, - null, - new SimpleLookup(List.of(new DefaultRepositoryFactory(new DefaultRemoteRepositoryManager( - new DefaultUpdatePolicyAnalyzer(), new DefaultChecksumPolicyProvider())))), - null); - InternalSession.associate(session.getRepositorySession(), iSession); - session.setSession(iSession); - - List projects = new ArrayList<>(); - - if (pom != null) { - MavenProject project = projectBuilder.build(pom, configuration).getProject(); - - projects.add(project); - if (includeModules) { - for (String module : project.getModules()) { - File modulePom = new File(pom.getParentFile(), module); - if (modulePom.isDirectory()) { - modulePom = new File(modulePom, "pom.xml"); - } - projects.add(projectBuilder.build(modulePom, configuration).getProject()); - } - } - } else { - MavenProject project = createStubMavenProject(); - project.setRemoteArtifactRepositories(request.getRemoteRepositories()); - project.setPluginArtifactRepositories(request.getPluginArtifactRepositories()); - projects.add(project); - } - - session.setProjects(projects); - session.setAllProjects(session.getProjects()); - - return session; - } - - protected void initRepoSession(ProjectBuildingRequest request) throws Exception { - File localRepoDir = new File(request.getLocalRepository().getBasedir()); - LocalRepository localRepo = new LocalRepository(localRepoDir); - DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); - session.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory().newInstance(session, localRepo)); - request.setRepositorySession(session); - } - - protected MavenProject createStubMavenProject() { - Model model = new Model(); - model.setGroupId("org.apache.maven.test"); - model.setArtifactId("maven-test"); - model.setVersion("1.0"); - return new MavenProject(model); - } - - protected List getRemoteRepositories() throws InvalidRepositoryException { - File repoDir = new File(getBasedir(), "src/test/remote-repo").getAbsoluteFile(); - - RepositoryPolicy policy = new RepositoryPolicy(); - policy.setEnabled(true); - policy.setChecksumPolicy("ignore"); - policy.setUpdatePolicy("always"); - - Repository repository = new Repository(); - repository.setId(MavenRepositorySystem.DEFAULT_REMOTE_REPO_ID); - repository.setUrl("file://" + repoDir.toURI().getPath()); - repository.setReleases(policy); - repository.setSnapshots(policy); - - return Arrays.asList(repositorySystem.buildArtifactRepository(repository)); - } - - protected List getPluginArtifactRepositories() throws InvalidRepositoryException { - return getRemoteRepositories(); - } - - protected ArtifactRepository getLocalRepository() throws InvalidRepositoryException { - File repoDir = new File(getBasedir(), "target/local-repo").getAbsoluteFile(); - - return repositorySystem.createLocalRepository(repoDir); - } - - protected class ProjectBuilder { - private MavenProject project; - - public ProjectBuilder(MavenProject project) { - this.project = project; - } - - public ProjectBuilder(String groupId, String artifactId, String version) { - Model model = new Model(); - model.setModelVersion("4.0.0"); - model.setGroupId(groupId); - model.setArtifactId(artifactId); - model.setVersion(version); - model.setBuild(new Build()); - project = new MavenProject(model); - } - - public ProjectBuilder setGroupId(String groupId) { - project.setGroupId(groupId); - return this; - } - - public ProjectBuilder setArtifactId(String artifactId) { - project.setArtifactId(artifactId); - return this; - } - - public ProjectBuilder setVersion(String version) { - project.setVersion(version); - return this; - } - - // Dependencies - // - public ProjectBuilder addDependency(String groupId, String artifactId, String version, String scope) { - return addDependency(groupId, artifactId, version, scope, (Exclusion) null); - } - - public ProjectBuilder addDependency( - String groupId, String artifactId, String version, String scope, Exclusion exclusion) { - return addDependency(groupId, artifactId, version, scope, null, exclusion); - } - - public ProjectBuilder addDependency( - String groupId, String artifactId, String version, String scope, String systemPath) { - return addDependency(groupId, artifactId, version, scope, systemPath, null); - } - - public ProjectBuilder addDependency( - String groupId, - String artifactId, - String version, - String scope, - String systemPath, - Exclusion exclusion) { - Dependency d = new Dependency(); - d.setGroupId(groupId); - d.setArtifactId(artifactId); - d.setVersion(version); - d.setScope(scope); - - if (systemPath != null && scope.equals(Artifact.SCOPE_SYSTEM)) { - d.setSystemPath(systemPath); - } - - if (exclusion != null) { - d.addExclusion(exclusion); - } - - project.getDependencies().add(d); - - return this; - } - - // Plugins - // - public ProjectBuilder addPlugin(Plugin plugin) { - project.getBuildPlugins().add(plugin); - return this; - } - - public MavenProject get() { - return project; - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java b/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java deleted file mode 100644 index aad5b3c2f0db..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven; - -import javax.inject.Inject; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; -import org.junit.jupiter.api.Test; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.endsWith; -import static org.junit.jupiter.api.Assertions.assertEquals; - -@Deprecated -class ProjectDependenciesResolverTest extends AbstractCoreMavenComponentTestCase { - @Inject - private ProjectDependenciesResolver resolver; - - protected String getProjectsDirectory() { - return "src/test/projects/project-dependencies-resolver"; - } - - /* - @Test - public void testExclusionsInDependencies() - throws Exception - { - MavenSession session = createMavenSession( null ); - MavenProject project = session.getCurrentProject(); - - Exclusion exclusion = new Exclusion(); - exclusion.setGroupId( "org.apache.maven.its" ); - exclusion.setArtifactId( "a" ); - - new ProjectBuilder( project ).addDependency( "org.apache.maven.its", "b", "0.1", Artifact.SCOPE_RUNTIME, - exclusion ); - - Set artifactDependencies = - resolver.resolve( project, Collections.singleton( Artifact.SCOPE_COMPILE ), session ); - assertEquals( 0, artifactDependencies.size() ); - - artifactDependencies = resolver.resolve( project, Collections.singleton( Artifact.SCOPE_RUNTIME ), session ); - assertEquals( 1, artifactDependencies.size() ); - assertEquals( "b", artifactDependencies.iterator().next().getArtifactId() ); - } - */ - - @Test - void testSystemScopeDependencies() throws Exception { - MavenSession session = createMavenSession(null); - MavenProject project = session.getCurrentProject(); - - new ProjectBuilder(project) - .addDependency( - "com.mycompany", - "system-dependency", - "1.0", - Artifact.SCOPE_SYSTEM, - new File(getBasedir(), "pom.xml").getAbsolutePath()); - - Set artifactDependencies = - resolver.resolve(project, Collections.singleton(Artifact.SCOPE_COMPILE), session); - assertEquals(1, artifactDependencies.size()); - } - - @Test - void testSystemScopeDependencyIsPresentInTheCompileClasspathElements() throws Exception { - File pom = getProject("it0063"); - - Properties eps = new Properties(); - eps.setProperty("jre.home", new File(pom.getParentFile(), "jdk/jre").getPath()); - - MavenSession session = createMavenSession(pom, eps); - MavenProject project = session.getCurrentProject(); - - project.setArtifacts(resolver.resolve(project, Collections.singleton(Artifact.SCOPE_COMPILE), session)); - - List elements = project.getCompileClasspathElements(); - assertEquals(2, elements.size()); - - @SuppressWarnings("deprecation") - List artifacts = project.getCompileArtifacts(); - assertEquals(1, artifacts.size()); - assertThat(artifacts.get(0).getFile().getName(), endsWith("tools.jar")); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java deleted file mode 100644 index 545e26908048..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact; - -import javax.inject.Inject; -import javax.inject.Named; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.api.DependencyScope; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.DefaultMavenExecutionResult; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.internal.impl.DefaultLookup; -import org.apache.maven.internal.impl.DefaultSessionFactory; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.repository.internal.artifact.FatArtifactTraverser; -import org.apache.maven.repository.internal.scopes.Maven4ScopeManagerConfiguration; -import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; -import org.apache.maven.rtinfo.RuntimeInformation; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.collection.DependencyGraphTransformer; -import org.eclipse.aether.collection.DependencyManager; -import org.eclipse.aether.collection.DependencySelector; -import org.eclipse.aether.collection.DependencyTraverser; -import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; -import org.eclipse.aether.internal.impl.scope.ManagedDependencyContextRefiner; -import org.eclipse.aether.internal.impl.scope.ManagedScopeDeriver; -import org.eclipse.aether.internal.impl.scope.ManagedScopeSelector; -import org.eclipse.aether.internal.impl.scope.OptionalDependencySelector; -import org.eclipse.aether.internal.impl.scope.ScopeDependencySelector; -import org.eclipse.aether.internal.impl.scope.ScopeManagerImpl; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.util.graph.manager.ClassicDependencyManager; -import org.eclipse.aether.util.graph.selector.AndDependencySelector; -import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector; -import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer; -import org.eclipse.aether.util.graph.transformer.ConflictResolver; -import org.eclipse.aether.util.graph.transformer.NearestVersionSelector; -import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector; -import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy; -import org.junit.jupiter.api.BeforeEach; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - */ -@PlexusTest -@Deprecated -public abstract class AbstractArtifactComponentTestCase // extends PlexusTestCase - { - @Inject - protected ArtifactFactory artifactFactory; - - @Inject - protected ArtifactRepositoryFactory artifactRepositoryFactory; - - @Inject - LegacySupport legacySupport; - - @Inject - @Named("default") - ArtifactRepositoryLayout repoLayout; - - @Inject - PlexusContainer container; - - public PlexusContainer getContainer() { - return container; - } - - @BeforeEach - public void setUp() throws Exception { - RepositorySystemSession repoSession = initRepoSession(); - MavenSession session = new MavenSession( - getContainer(), repoSession, new DefaultMavenExecutionRequest(), new DefaultMavenExecutionResult()); - session.setSession(new DefaultSessionFactory( - getContainer().lookup(RepositorySystem.class), - getContainer().lookup(MavenRepositorySystem.class), - new DefaultLookup(getContainer()), - getContainer().lookup(RuntimeInformation.class)) - .newSession(session)); - - legacySupport.setSession(session); - } - - protected abstract String component(); - - /** - * Return an existing file, not a directory - causes creation to fail. - * - * @throws Exception - */ - protected ArtifactRepository badLocalRepository() throws Exception { - String path = "target/test-repositories/" + component() + "/bad-local-repository"; - - File f = new File(getBasedir(), path); - - f.createNewFile(); - - return artifactRepositoryFactory.createArtifactRepository( - "test", "file://" + f.getPath(), repoLayout, null, null); - } - - protected String getRepositoryLayout() { - return "default"; - } - - protected ArtifactRepository localRepository() throws Exception { - String path = "target/test-repositories/" + component() + "/local-repository"; - - File f = new File(getBasedir(), path); - - return artifactRepositoryFactory.createArtifactRepository( - "local", "file://" + f.getPath(), repoLayout, null, null); - } - - protected ArtifactRepository remoteRepository() throws Exception { - String path = "target/test-repositories/" + component() + "/remote-repository"; - - File f = new File(getBasedir(), path); - - return artifactRepositoryFactory.createArtifactRepository( - "test", - "file://" + f.getPath(), - repoLayout, - new ArtifactRepositoryPolicy(), - new ArtifactRepositoryPolicy()); - } - - protected ArtifactRepository badRemoteRepository() throws Exception { - return artifactRepositoryFactory.createArtifactRepository( - "test", "http://foo.bar/repository", repoLayout, null, null); - } - - protected void assertRemoteArtifactPresent(Artifact artifact) throws Exception { - ArtifactRepository remoteRepo = remoteRepository(); - - String path = remoteRepo.pathOf(artifact); - - File file = new File(remoteRepo.getBasedir(), path); - - assertTrue(file.exists(), "Remote artifact " + file + " should be present."); - } - - protected void assertLocalArtifactPresent(Artifact artifact) throws Exception { - ArtifactRepository localRepo = localRepository(); - - String path = localRepo.pathOf(artifact); - - File file = new File(localRepo.getBasedir(), path); - - assertTrue(file.exists(), "Local artifact " + file + " should be present."); - } - - protected void assertRemoteArtifactNotPresent(Artifact artifact) throws Exception { - ArtifactRepository remoteRepo = remoteRepository(); - - String path = remoteRepo.pathOf(artifact); - - File file = new File(remoteRepo.getBasedir(), path); - - assertFalse(file.exists(), "Remote artifact " + file + " should not be present."); - } - - protected void assertLocalArtifactNotPresent(Artifact artifact) throws Exception { - ArtifactRepository localRepo = localRepository(); - - String path = localRepo.pathOf(artifact); - - File file = new File(localRepo.getBasedir(), path); - - assertFalse(file.exists(), "Local artifact " + file + " should not be present."); - } - - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- - - protected List remoteRepositories() throws Exception { - List remoteRepositories = new ArrayList<>(); - - remoteRepositories.add(remoteRepository()); - - return remoteRepositories; - } - - // ---------------------------------------------------------------------- - // Test artifact generation for unit tests - // ---------------------------------------------------------------------- - - protected Artifact createLocalArtifact(String artifactId, String version) throws Exception { - Artifact artifact = createArtifact(artifactId, version); - - createArtifact(artifact, localRepository()); - - return artifact; - } - - protected Artifact createRemoteArtifact(String artifactId, String version) throws Exception { - Artifact artifact = createArtifact(artifactId, version); - - createArtifact(artifact, remoteRepository()); - - return artifact; - } - - protected void createLocalArtifact(Artifact artifact) throws Exception { - createArtifact(artifact, localRepository()); - } - - protected void createRemoteArtifact(Artifact artifact) throws Exception { - createArtifact(artifact, remoteRepository()); - } - - protected void createArtifact(Artifact artifact, ArtifactRepository repository) throws Exception { - String path = repository.pathOf(artifact); - - File artifactFile = new File(repository.getBasedir(), path); - - if (!artifactFile.getParentFile().exists()) { - artifactFile.getParentFile().mkdirs(); - } - try (Writer writer = new OutputStreamWriter(new FileOutputStream(artifactFile), StandardCharsets.ISO_8859_1)) { - writer.write(artifact.getId()); - } - - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(artifact.getId().getBytes()); - byte[] digest = md.digest(); - - String md5path = repository.pathOf(artifact) + ".md5"; - File md5artifactFile = new File(repository.getBasedir(), md5path); - try (Writer writer = - new OutputStreamWriter(new FileOutputStream(md5artifactFile), StandardCharsets.ISO_8859_1)) { - writer.append(printHexBinary(digest)); - } - } - - protected Artifact createArtifact(String artifactId, String version) throws Exception { - return createArtifact(artifactId, version, "jar"); - } - - protected Artifact createArtifact(String artifactId, String version, String type) throws Exception { - return createArtifact("org.apache.maven", artifactId, version, type); - } - - protected Artifact createArtifact(String groupId, String artifactId, String version, String type) throws Exception { - Artifact a = artifactFactory.createBuildArtifact(groupId, artifactId, version, type); - - return a; - } - - protected void deleteLocalArtifact(Artifact artifact) throws Exception { - deleteArtifact(artifact, localRepository()); - } - - protected void deleteArtifact(Artifact artifact, ArtifactRepository repository) throws Exception { - String path = repository.pathOf(artifact); - - File artifactFile = new File(repository.getBasedir(), path); - - if (artifactFile.exists()) { - if (!artifactFile.delete()) { - throw new IOException("Failure while attempting to delete artifact " + artifactFile); - } - } - } - - protected DefaultRepositorySystemSession initRepoSession() throws Exception { - DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(h -> false); - session.setScopeManager(new ScopeManagerImpl(Maven4ScopeManagerConfiguration.INSTANCE)); - session.setArtifactDescriptorPolicy(new SimpleArtifactDescriptorPolicy(true, true)); - DependencyTraverser depTraverser = new FatArtifactTraverser(); - session.setDependencyTraverser(depTraverser); - - DependencyManager depManager = new ClassicDependencyManager(true, session.getScopeManager()); - session.setDependencyManager(depManager); - - DependencySelector depFilter = new AndDependencySelector( - ScopeDependencySelector.legacy( - null, Arrays.asList(DependencyScope.TEST.id(), DependencyScope.PROVIDED.id())), - OptionalDependencySelector.fromDirect(), - new ExclusionDependencySelector()); - session.setDependencySelector(depFilter); - - ScopeManagerImpl scopeManager = new ScopeManagerImpl(Maven4ScopeManagerConfiguration.INSTANCE); - session.setScopeManager(scopeManager); - DependencyGraphTransformer transformer = new ConflictResolver( - new NearestVersionSelector(), new ManagedScopeSelector(scopeManager), - new SimpleOptionalitySelector(), new ManagedScopeDeriver(scopeManager)); - transformer = - new ChainedDependencyGraphTransformer(transformer, new ManagedDependencyContextRefiner(scopeManager)); - session.setDependencyGraphTransformer(transformer); - - LocalRepository localRepo = new LocalRepository(localRepository().getBasedir()); - session.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory().newInstance(session, localRepo)); - return session; - } - - private static final char[] hexCode = "0123456789ABCDEF".toCharArray(); - - private static String printHexBinary(byte[] data) { - StringBuilder r = new StringBuilder(data.length * 2); - for (byte b : data) { - r.append(hexCode[(b >> 4) & 0xF]); - r.append(hexCode[(b & 0xF)]); - } - return r.toString(); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java deleted file mode 100644 index 0435e1195252..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.deployer; - -import javax.inject.Inject; - -import java.io.File; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; - -import org.apache.maven.artifact.AbstractArtifactComponentTestCase; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.session.scope.internal.SessionScope; -import org.junit.jupiter.api.Test; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.mock; - -/** - */ -@Deprecated -class ArtifactDeployerTest extends AbstractArtifactComponentTestCase { - @Inject - private ArtifactDeployer artifactDeployer; - - @Inject - private SessionScope sessionScope; - - protected String component() { - return "deployer"; - } - - @Test - void testArtifactInstallation() throws Exception { - sessionScope.enter(); - try { - sessionScope.seed(MavenSession.class, mock(MavenSession.class)); - - String artifactBasedir = new File(getBasedir(), "src/test/resources/artifact-install").getAbsolutePath(); - - Artifact artifact = createArtifact("artifact", "1.0"); - - File file = new File(artifactBasedir, "artifact-1.0.jar"); - assertEquals("dummy", new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8).trim()); - - artifactDeployer.deploy(file, artifact, remoteRepository(), localRepository()); - - ArtifactRepository remoteRepository = remoteRepository(); - File deployedFile = new File(remoteRepository.getBasedir(), remoteRepository.pathOf(artifact)); - assertTrue(deployedFile.exists()); - assertEquals("dummy", new String(Files.readAllBytes(deployedFile.toPath()), StandardCharsets.UTF_8).trim()); - } finally { - sessionScope.exit(); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java deleted file mode 100644 index f3ffe61b3f86..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.deployer; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.Collections; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.ResolutionGroup; - -@Named("classpath") -@Singleton -@Deprecated -public class SimpleArtifactMetadataSource implements ArtifactMetadataSource { - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) { - throw new UnsupportedOperationException("Cannot retrieve metadata in this test case"); - } - - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) { - return Collections.singletonList(new DefaultArtifactVersion("10.1.3")); - } - - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) { - return Collections.singletonList(new DefaultArtifactVersion("10.1.3")); - } - - public ResolutionGroup retrieve(MetadataResolutionRequest request) { - return retrieve(request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java deleted file mode 100644 index 634e7f7462ef..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.factory; - -import javax.inject.Inject; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -@PlexusTest -@Deprecated -class DefaultArtifactFactoryTest { - - @Inject - ArtifactFactory factory; - - @Test - void testPropagationOfSystemScopeRegardlessOfInheritedScope() { - Artifact artifact = factory.createDependencyArtifact( - "test-grp", "test-artifact", VersionRange.createFromVersion("1.0"), "type", null, "system", "provided"); - Artifact artifact2 = factory.createDependencyArtifact( - "test-grp", "test-artifact-2", VersionRange.createFromVersion("1.0"), "type", null, "system", "test"); - Artifact artifact3 = factory.createDependencyArtifact( - "test-grp", - "test-artifact-3", - VersionRange.createFromVersion("1.0"), - "type", - null, - "system", - "runtime"); - Artifact artifact4 = factory.createDependencyArtifact( - "test-grp", - "test-artifact-4", - VersionRange.createFromVersion("1.0"), - "type", - null, - "system", - "compile"); - - // this one should never happen in practice... - Artifact artifact5 = factory.createDependencyArtifact( - "test-grp", "test-artifact-5", VersionRange.createFromVersion("1.0"), "type", null, "system", "system"); - - assertEquals("system", artifact.getScope()); - assertEquals("system", artifact2.getScope()); - assertEquals("system", artifact3.getScope()); - assertEquals("system", artifact4.getScope()); - assertEquals("system", artifact5.getScope()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java deleted file mode 100644 index 0d24d73bcbc1..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.installer; - -import javax.inject.Inject; - -import java.io.File; - -import org.apache.maven.artifact.AbstractArtifactComponentTestCase; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.session.scope.internal.SessionScope; -import org.junit.jupiter.api.Test; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.mockito.Mockito.mock; - -/** - */ -@Deprecated -class ArtifactInstallerTest extends AbstractArtifactComponentTestCase { - @Inject - private ArtifactInstaller artifactInstaller; - - @Inject - private SessionScope sessionScope; - - protected String component() { - return "installer"; - } - - @Test - void testArtifactInstallation() throws Exception { - sessionScope.enter(); - try { - sessionScope.seed(MavenSession.class, mock(MavenSession.class)); - - String artifactBasedir = new File(getBasedir(), "src/test/resources/artifact-install").getAbsolutePath(); - - Artifact artifact = createArtifact("artifact", "1.0"); - - File source = new File(artifactBasedir, "artifact-1.0.jar"); - - artifactInstaller.install(source, artifact, localRepository()); - - assertLocalArtifactPresent(artifact); - } finally { - sessionScope.exit(); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/metadata/SwitchableMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/artifact/metadata/SwitchableMetadataSource.java deleted file mode 100644 index 1185c3937b59..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/metadata/SwitchableMetadataSource.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.eclipse.sisu.Priority; - -@Singleton -@Priority(10) -@Named -@Deprecated -public class SwitchableMetadataSource implements ArtifactMetadataSource { - private ArtifactMetadataSource delegate; - - @Inject - public SwitchableMetadataSource(@Named("test") ArtifactMetadataSource delegate) { - this.delegate = delegate; - } - - public void setDelegate(ArtifactMetadataSource delegate) { - this.delegate = delegate; - } - - @Override - public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException { - return delegate.retrieve(request); - } - - @Override - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - return delegate.retrieve(artifact, localRepository, remoteRepositories); - } - - @Override - public List retrieveAvailableVersions(MetadataResolutionRequest request) - throws ArtifactMetadataRetrievalException { - return delegate.retrieveAvailableVersions(request); - } - - @Override - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - return delegate.retrieveAvailableVersions(artifact, localRepository, remoteRepositories); - } - - @Override - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException { - return delegate.retrieveAvailableVersionsFromDeploymentRepository(artifact, localRepository, remoteRepository); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java deleted file mode 100644 index 6747ac894e0f..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; - -@Named("test") -@Singleton -@Deprecated -public class TestMetadataSource implements ArtifactMetadataSource { - @Inject - private ArtifactFactory factory; - - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - Set dependencies = new HashSet<>(); - - if ("g".equals(artifact.getArtifactId())) { - Artifact a = null; - try { - a = factory.createBuildArtifact("org.apache.maven", "h", "1.0", "jar"); - dependencies.add(a); - } catch (Exception e) { - throw new ArtifactMetadataRetrievalException("Error retrieving metadata", e, a); - } - } - - if ("i".equals(artifact.getArtifactId())) { - Artifact a = null; - try { - a = factory.createBuildArtifact("org.apache.maven", "j", "1.0-SNAPSHOT", "jar"); - dependencies.add(a); - } catch (Exception e) { - throw new ArtifactMetadataRetrievalException("Error retrieving metadata", e, a); - } - } - - return new ResolutionGroup(artifact, dependencies, remoteRepositories); - } - - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException { - return retrieve(request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } - - public List retrieveAvailableVersions(MetadataResolutionRequest request) - throws ArtifactMetadataRetrievalException { - return retrieveAvailableVersions( - request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java deleted file mode 100644 index 8296fe50c0a7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.repository; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@Deprecated -class MavenArtifactRepositoryTest { - private static class MavenArtifactRepositorySubclass extends MavenArtifactRepository { - String id; - - public MavenArtifactRepositorySubclass(String id) { - this.id = id; - } - - @Override - public String getId() { - return id; - } - } - - @Test - void testHashCodeEquals() { - MavenArtifactRepositorySubclass r1 = new MavenArtifactRepositorySubclass("foo"); - MavenArtifactRepositorySubclass r2 = new MavenArtifactRepositorySubclass("foo"); - MavenArtifactRepositorySubclass r3 = new MavenArtifactRepositorySubclass("bar"); - - assertTrue(r1.hashCode() == r2.hashCode()); - assertFalse(r1.hashCode() == r3.hashCode()); - - assertTrue(r1.equals(r2)); - assertTrue(r2.equals(r1)); - - assertFalse(r1.equals(r3)); - assertFalse(r3.equals(r1)); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java deleted file mode 100644 index 385660370138..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.Arrays; -import java.util.List; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Test the artifact resolution exception message - * - */ -class ArtifactResolutionExceptionTest { - private static final String LS = System.lineSeparator(); - - @Test - void testMissingArtifactMessageFormat() { - String message = "Missing artifact"; - String indentation = " "; - String groupId = "aGroupId"; - String artifactId = "anArtifactId"; - String version = "aVersion"; - String type = "jar"; - String classifier = "aClassifier"; - String downloadUrl = "http://somewhere.com/download"; - List path = Arrays.asList("dependency1", "dependency2"); - String expected = "Missing artifact" + LS + LS + " Try downloading the file manually from: " + LS - + " http://somewhere.com/download" + LS + LS + " Then, install it using the command: " + LS - + " mvn install:install-file -DgroupId=aGroupId -DartifactId=anArtifactId -Dversion=aVersion " - + "-Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" + LS + LS - + " Alternatively, if you host your own repository you can deploy the file there: " + LS - + " mvn deploy:deploy-file -DgroupId=aGroupId -DartifactId=anArtifactId" - + " -Dversion=aVersion -Dclassifier=aClassifier -Dpackaging=jar -Dfile=/path/to/file" - + " -Durl=[url] -DrepositoryId=[id]" + LS + LS + " Path to dependency: " + LS + " \t1) dependency1" - + LS + " \t2) dependency2" + LS + LS; - String actual = AbstractArtifactResolutionException.constructMissingArtifactMessage( - message, indentation, groupId, artifactId, version, type, classifier, downloadUrl, path); - assertEquals(expected, actual); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java deleted file mode 100644 index d2f204d8ea03..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import javax.inject.Inject; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.AbstractArtifactComponentTestCase; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -// It would be cool if there was a hook that I could use to set up a test environment. -// I want to set up a local/remote repositories for testing but I don't want to have -// to change them when I change the layout of the repositories. So I want to generate -// the structure I want to test by using the artifact handler manager which dictates -// the layout used for a particular artifact type. - -/** - */ -@Deprecated -class ArtifactResolverTest extends AbstractArtifactComponentTestCase { - @Inject - private ArtifactResolver artifactResolver; - - private Artifact projectArtifact; - - @BeforeEach - @Override - public void setUp() throws Exception { - super.setUp(); - - projectArtifact = createLocalArtifact("project", "3.0"); - } - - @Override - protected DefaultRepositorySystemSession initRepoSession() throws Exception { - DefaultRepositorySystemSession session = super.initRepoSession(); - session.setWorkspaceReader(new TestMavenWorkspaceReader()); - return session; - } - - @Override - protected String component() { - return "resolver"; - } - - @Test - void testResolutionOfASingleArtifactWhereTheArtifactIsPresentInTheLocalRepository() throws Exception { - Artifact a = createLocalArtifact("a", "1.0"); - - artifactResolver.resolve(a, remoteRepositories(), localRepository()); - - assertLocalArtifactPresent(a); - } - - @Test - void testResolutionOfASingleArtifactWhereTheArtifactIsNotPresentLocallyAndMustBeRetrievedFromTheRemoteRepository() - throws Exception { - Artifact b = createRemoteArtifact("b", "1.0-SNAPSHOT"); - deleteLocalArtifact(b); - artifactResolver.resolve(b, remoteRepositories(), localRepository()); - assertLocalArtifactPresent(b); - } - - @Override - protected Artifact createArtifact(String groupId, String artifactId, String version, String type) throws Exception { - // for the anonymous classes - return super.createArtifact(groupId, artifactId, version, type); - } - - @Test - void testTransitiveResolutionWhereAllArtifactsArePresentInTheLocalRepository() throws Exception { - Artifact g = createLocalArtifact("g", "1.0"); - - Artifact h = createLocalArtifact("h", "1.0"); - - ArtifactResolutionResult result = artifactResolver.resolveTransitively( - Collections.singleton(g), projectArtifact, remoteRepositories(), localRepository(), null); - - printErrors(result); - - assertEquals(2, result.getArtifacts().size()); - - assertTrue(result.getArtifacts().contains(g)); - - assertTrue(result.getArtifacts().contains(h)); - - assertLocalArtifactPresent(g); - - assertLocalArtifactPresent(h); - } - - @Test - void - testTransitiveResolutionWhereAllArtifactsAreNotPresentInTheLocalRepositoryAndMustBeRetrievedFromTheRemoteRepository() - throws Exception { - Artifact i = createRemoteArtifact("i", "1.0-SNAPSHOT"); - deleteLocalArtifact(i); - - Artifact j = createRemoteArtifact("j", "1.0-SNAPSHOT"); - deleteLocalArtifact(j); - - ArtifactResolutionResult result = artifactResolver.resolveTransitively( - Collections.singleton(i), projectArtifact, remoteRepositories(), localRepository(), null); - - printErrors(result); - - assertEquals(2, result.getArtifacts().size()); - - assertTrue(result.getArtifacts().contains(i)); - - assertTrue(result.getArtifacts().contains(j)); - - assertLocalArtifactPresent(i); - - assertLocalArtifactPresent(j); - } - - @Test - void testResolutionFailureWhenArtifactNotPresentInRemoteRepository() throws Exception { - Artifact k = createArtifact("k", "1.0"); - - assertThrows( - ArtifactNotFoundException.class, - () -> artifactResolver.resolve(k, remoteRepositories(), localRepository()), - "Resolution succeeded when it should have failed"); - } - - @Test - void testResolutionOfAnArtifactWhereOneRemoteRepositoryIsBadButOneIsGood() throws Exception { - Artifact l = createRemoteArtifact("l", "1.0-SNAPSHOT"); - deleteLocalArtifact(l); - - List repositories = new ArrayList<>(); - repositories.add(remoteRepository()); - repositories.add(badRemoteRepository()); - - artifactResolver.resolve(l, repositories, localRepository()); - - assertLocalArtifactPresent(l); - } - - public void testReadRepoFromModel() throws Exception { - Artifact m = createArtifact(TestMavenWorkspaceReader.ARTIFACT_ID, TestMavenWorkspaceReader.VERSION); - ArtifactMetadataSource source = getContainer().lookup(ArtifactMetadataSource.class, "maven"); - ResolutionGroup group = source.retrieve(m, localRepository(), new ArrayList<>()); - List repositories = group.getResolutionRepositories(); - assertEquals(1, repositories.size(), "There should be one repository!"); - ArtifactRepository repository = repositories.get(0); - assertEquals(TestMavenWorkspaceReader.REPO_ID, repository.getId()); - assertEquals(TestMavenWorkspaceReader.REPO_URL, repository.getUrl()); - } - - @Test - void testTransitiveResolutionOrder() throws Exception { - Artifact m = createLocalArtifact("m", "1.0"); - - Artifact n = createLocalArtifact("n", "1.0"); - - ArtifactMetadataSource mds = new ArtifactMetadataSource() { - @Override - public ResolutionGroup retrieve( - Artifact artifact, - ArtifactRepository localRepository, - List remoteRepositories) { - Set dependencies = new HashSet<>(); - - return new ResolutionGroup(artifact, dependencies, remoteRepositories); - } - - @Override - public List retrieveAvailableVersions( - Artifact artifact, - ArtifactRepository localRepository, - List remoteRepositories) { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - @Override - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - @Override - public ResolutionGroup retrieve(MetadataResolutionRequest request) { - return retrieve(request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } - - @Override - public List retrieveAvailableVersions(MetadataResolutionRequest request) { - return retrieveAvailableVersions( - request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } - }; - - ArtifactResolutionResult result = null; - - Set set = new LinkedHashSet<>(); - set.add(n); - set.add(m); - - result = artifactResolver.resolveTransitively( - set, projectArtifact, remoteRepositories(), localRepository(), mds); - - printErrors(result); - - Iterator i = result.getArtifacts().iterator(); - assertEquals(n, i.next(), "n should be first"); - assertEquals(m, i.next(), "m should be second"); - - // inverse order - set = new LinkedHashSet<>(); - set.add(m); - set.add(n); - - result = artifactResolver.resolveTransitively( - set, projectArtifact, remoteRepositories(), localRepository(), mds); - - printErrors(result); - - i = result.getArtifacts().iterator(); - assertEquals(m, i.next(), "m should be first"); - assertEquals(n, i.next(), "n should be second"); - } - - private void printErrors(ArtifactResolutionResult result) { - if (result.hasMissingArtifacts()) { - for (Artifact artifact : result.getMissingArtifacts()) { - System.err.println("Missing: " + artifact); - } - } - - if (result.hasExceptions()) { - for (Exception e : result.getExceptions()) { - e.printStackTrace(); - } - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java deleted file mode 100644 index 83110198a0b3..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import javax.inject.Inject; - -import java.util.Collections; - -import org.apache.maven.artifact.AbstractArtifactComponentTestCase; -import org.apache.maven.artifact.Artifact; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -@Deprecated -class DefaultArtifactResolverTest extends AbstractArtifactComponentTestCase { - @Inject - private ArtifactResolver artifactResolver; - - private Artifact projectArtifact; - - @BeforeEach - @Override - public void setUp() throws Exception { - super.setUp(); - projectArtifact = createLocalArtifact("project", "3.0"); - } - - @Override - protected String component() { - return "resolver"; - } - - @Test - void testMNG4738() throws Exception { - Artifact g = createLocalArtifact("g", "1.0"); - createLocalArtifact("h", "1.0"); - artifactResolver.resolveTransitively( - Collections.singleton(g), projectArtifact, remoteRepositories(), localRepository(), null); - - // we want to see all top-level thread groups - ThreadGroup tg = Thread.currentThread().getThreadGroup(); - while (tg.getParent() == null) { - tg = tg.getParent(); - } - - ThreadGroup[] tgList = new ThreadGroup[tg.activeGroupCount()]; - tg.enumerate(tgList); - - boolean seen = false; - - for (ThreadGroup aTgList : tgList) { - if (!aTgList.getName().equals(DefaultArtifactResolver.DaemonThreadCreator.THREADGROUP_NAME)) { - continue; - } - - seen = true; - - tg = aTgList; - Thread[] ts = new Thread[tg.activeCount()]; - tg.enumerate(ts); - - for (Thread active : ts) { - String name = active.getName(); - boolean daemon = active.isDaemon(); - assertTrue(daemon, name + " is no daemon Thread."); - } - } - - assertTrue(seen, "Could not find ThreadGroup: " + DefaultArtifactResolver.DaemonThreadCreator.THREADGROUP_NAME); - } - - @Test - void testLookup() throws Exception { - ArtifactResolver resolver = getContainer().lookup(ArtifactResolver.class, "default"); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java deleted file mode 100644 index 9ee3cc27a8c7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.io.File; -import java.io.InputStream; - -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authorization.AuthorizationException; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.providers.file.FileWagon; -import org.apache.maven.wagon.resource.Resource; - -/** - * Wagon used for test cases that annotate some methods. Note that this is not a thread-safe implementation. - */ -public class TestFileWagon extends FileWagon { - private TestTransferListener testTransferListener; - private boolean insideGet; - - @Deprecated - protected void getTransfer(Resource resource, File destination, InputStream input, boolean closeInput, int maxSize) - throws TransferFailedException { - addTransfer("getTransfer " + resource.getName()); - super.getTransfer(resource, destination, input, closeInput, maxSize); - } - - public void get(String resourceName, File destination) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { - addTransfer("get " + resourceName); - - insideGet = true; - - super.get(resourceName, destination); - - insideGet = false; - } - - private void addTransfer(String resourceName) { - if (testTransferListener != null) { - testTransferListener.addTransfer(resourceName); - } - } - - public boolean getIfNewer(String resourceName, File destination, long timestamp) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { - if (!insideGet) { - addTransfer("getIfNewer " + resourceName); - } - return super.getIfNewer(resourceName, destination, timestamp); - } - - public void addTransferListener(TransferListener listener) { - if (listener instanceof TestTransferListener) { - testTransferListener = (TestTransferListener) listener; - } - super.addTransferListener(listener); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestMavenWorkspaceReader.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestMavenWorkspaceReader.java deleted file mode 100644 index 432584fbad6c..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestMavenWorkspaceReader.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.io.File; -import java.util.Collections; -import java.util.List; - -import org.apache.maven.model.Model; -import org.apache.maven.model.Repository; -import org.apache.maven.repository.internal.MavenWorkspaceReader; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.repository.WorkspaceRepository; - -public class TestMavenWorkspaceReader implements MavenWorkspaceReader { - - static final String REPO_LAYOUT = "test"; - - static final String REPO_URL = "https://test/me"; - - static final String REPO_ID = "custom"; - - static final String GROUP_ID = "org.apache.maven"; - - static final String ARTIFACT_ID = "this.is.a.test"; - - static final String VERSION = "99.99"; - - private static final WorkspaceRepository WORKSPACE_REPOSITORY = new WorkspaceRepository(REPO_LAYOUT); - - @Override - public WorkspaceRepository getRepository() { - return WORKSPACE_REPOSITORY; - } - - @Override - public File findArtifact(Artifact artifact) { - return null; - } - - @Override - public List findVersions(Artifact artifact) { - return Collections.emptyList(); - } - - @Override - public Model findModel(Artifact artifact) { - if (GROUP_ID.equals(artifact.getGroupId()) - && ARTIFACT_ID.equals(artifact.getArtifactId()) - && VERSION.equals(artifact.getVersion())) { - Model m = new Model(); - m.setArtifactId(ARTIFACT_ID); - m.setGroupId(GROUP_ID); - m.setVersion(VERSION); - Repository repository = new Repository(); - repository.setId(REPO_ID); - repository.setUrl(REPO_URL); - repository.setLayout(REPO_LAYOUT); - m.getRepositories().add(repository); - return m; - } - return null; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java deleted file mode 100644 index 2709cc53b432..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.wagon.observers.AbstractTransferListener; - -public class TestTransferListener extends AbstractTransferListener { - - private final List transfers = new ArrayList<>(); - - public List getTransfers() { - return transfers; - } - - public void addTransfer(String name) { - transfers.add(name); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java deleted file mode 100644 index fe0343c857cb..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import java.util.Arrays; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Tests {@link AndArtifactFilter}. - * - */ -class AndArtifactFilterTest { - - private ArtifactFilter newSubFilter() { - return artifact -> false; - } - - @Test - void testEquals() { - AndArtifactFilter filter1 = new AndArtifactFilter(); - - AndArtifactFilter filter2 = new AndArtifactFilter(Arrays.asList(newSubFilter())); - - assertFalse(filter1.equals(null)); - assertTrue(filter1.equals(filter1)); - assertEquals(filter1.hashCode(), filter1.hashCode()); - - assertFalse(filter1.equals(filter2)); - assertFalse(filter2.equals(filter1)); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java deleted file mode 100644 index 53a26db4ea12..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import java.util.Arrays; -import java.util.List; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - */ -class FilterHashEqualsTest { - - @Test - void testIncludesExcludesArtifactFilter() { - List patterns = Arrays.asList("c", "d", "e"); - - IncludesArtifactFilter f1 = new IncludesArtifactFilter(patterns); - - IncludesArtifactFilter f2 = new IncludesArtifactFilter(patterns); - - assertTrue(f1.equals(f2)); - assertTrue(f2.equals(f1)); - assertTrue(f1.hashCode() == f2.hashCode()); - - IncludesArtifactFilter f3 = new IncludesArtifactFilter(Arrays.asList("d", "c", "e")); - assertTrue(f1.equals(f3)); - assertTrue(f1.hashCode() == f3.hashCode()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java deleted file mode 100644 index 6c8cda6802bc..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import java.util.Arrays; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Tests {@link OrArtifactFilter}. - * - */ -@Deprecated -class OrArtifactFilterTest { - - private ArtifactFilter newSubFilter() { - return artifact -> false; - } - - @Test - void testEquals() { - OrArtifactFilter filter1 = new OrArtifactFilter(); - - OrArtifactFilter filter2 = new OrArtifactFilter(Arrays.asList(newSubFilter())); - - assertFalse(filter1.equals(null)); - assertTrue(filter1.equals(filter1)); - assertEquals(filter1.hashCode(), filter1.hashCode()); - - assertFalse(filter1.equals(filter2)); - assertFalse(filter2.equals(filter1)); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java deleted file mode 100644 index 6a52c1ab184e..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.resolver.filter; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DefaultArtifact; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Tests {@link ScopeArtifactFilter}. - * - */ -class ScopeArtifactFilterTest { - - private Artifact newArtifact(String scope) { - return new DefaultArtifact("g", "a", "1.0", scope, "jar", "", null); - } - - @Test - void testInclude_Compile() { - ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_COMPILE); - - assertTrue(filter.include(newArtifact(Artifact.SCOPE_COMPILE))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_SYSTEM))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_PROVIDED))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_RUNTIME))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_TEST))); - } - - @Test - void testInclude_CompilePlusRuntime() { - ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_COMPILE_PLUS_RUNTIME); - - assertTrue(filter.include(newArtifact(Artifact.SCOPE_COMPILE))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_SYSTEM))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_PROVIDED))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_RUNTIME))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_TEST))); - } - - @Test - void testInclude_Runtime() { - ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME); - - assertTrue(filter.include(newArtifact(Artifact.SCOPE_COMPILE))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_SYSTEM))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_PROVIDED))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_RUNTIME))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_TEST))); - } - - @Test - void testInclude_RuntimePlusSystem() { - ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME_PLUS_SYSTEM); - - assertTrue(filter.include(newArtifact(Artifact.SCOPE_COMPILE))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_SYSTEM))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_PROVIDED))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_RUNTIME))); - assertFalse(filter.include(newArtifact(Artifact.SCOPE_TEST))); - } - - @Test - void testInclude_Test() { - ScopeArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_TEST); - - assertTrue(filter.include(newArtifact(Artifact.SCOPE_COMPILE))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_SYSTEM))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_PROVIDED))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_RUNTIME))); - assertTrue(filter.include(newArtifact(Artifact.SCOPE_TEST))); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java b/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java deleted file mode 100644 index 47372855ca2d..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.testutils; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.codehaus.plexus.util.FileUtils; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@Deprecated -public class TestFileManager { - - public static final String TEMP_DIR_PATH = System.getProperty("java.io.tmpdir"); - - private List filesToDelete = new ArrayList<>(); - - private final String baseFilename; - - private final String fileSuffix; - - private StackTraceElement callerInfo; - - private Thread cleanupWarning; - - private boolean warnAboutCleanup = false; - - public TestFileManager(String baseFilename, String fileSuffix) { - this.baseFilename = baseFilename; - this.fileSuffix = fileSuffix; - - initializeCleanupMonitoring(); - } - - private void initializeCleanupMonitoring() { - callerInfo = new NullPointerException().getStackTrace()[2]; - - Runnable warning = this::maybeWarnAboutCleanUp; - - cleanupWarning = new Thread(warning); - - Runtime.getRuntime().addShutdownHook(cleanupWarning); - } - - private void maybeWarnAboutCleanUp() { - if (warnAboutCleanup) { - System.out.println("[WARNING] TestFileManager from: " + callerInfo.getClassName() + " not cleaned up!"); - } - } - - public void markForDeletion(File toDelete) { - filesToDelete.add(toDelete); - warnAboutCleanup = true; - } - - public synchronized File createTempDir() { - try { - Thread.sleep(20); - } catch (InterruptedException e) { - // ignore - } - - File dir = new File(TEMP_DIR_PATH, baseFilename + System.currentTimeMillis()); - - dir.mkdirs(); - markForDeletion(dir); - - return dir; - } - - public synchronized File createTempFile() throws IOException { - File tempFile = File.createTempFile(baseFilename, fileSuffix); - tempFile.deleteOnExit(); - markForDeletion(tempFile); - - return tempFile; - } - - public void cleanUp() throws IOException { - for (Iterator it = filesToDelete.iterator(); it.hasNext(); ) { - File file = (File) it.next(); - - if (file.exists()) { - if (file.isDirectory()) { - FileUtils.deleteDirectory(file); - } else { - file.delete(); - } - } - - it.remove(); - } - - warnAboutCleanup = false; - } - - public void assertFileExistence(File dir, String filename, boolean shouldExist) { - File file = new File(dir, filename); - - if (shouldExist) { - assertTrue(file.exists()); - } else { - assertFalse(file.exists()); - } - } - - public void assertFileContents(File dir, String filename, String contentsTest, String encoding) throws IOException { - assertFileExistence(dir, filename, true); - - File file = new File(dir, filename); - - String contents = FileUtils.fileRead(file, encoding); - - assertEquals(contentsTest, contents); - } - - public File createFile(File dir, String filename, String contents, String encoding) throws IOException { - File file = new File(dir, filename); - - file.getParentFile().mkdirs(); - - FileUtils.fileWrite(file.getPath(), encoding, contents); - - markForDeletion(file); - - return file; - } - - public String getFileContents(File file, String encoding) throws IOException { - return FileUtils.fileRead(file, encoding); - } - - protected void finalize() throws Throwable { - maybeWarnAboutCleanUp(); - - super.finalize(); - } - - public File createFile(String filename, String content, String encoding) throws IOException { - File dir = createTempDir(); - return createFile(dir, filename, content, encoding); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java deleted file mode 100644 index 4e76243abe66..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.artifact.transform; - -import javax.inject.Inject; - -import java.util.List; - -import org.apache.maven.repository.legacy.resolver.transform.ArtifactTransformation; -import org.apache.maven.repository.legacy.resolver.transform.ArtifactTransformationManager; -import org.apache.maven.repository.legacy.resolver.transform.LatestArtifactTransformation; -import org.apache.maven.repository.legacy.resolver.transform.ReleaseArtifactTransformation; -import org.apache.maven.repository.legacy.resolver.transform.SnapshotTransformation; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@PlexusTest -@Deprecated -class TransformationManagerTest { - @Inject - ArtifactTransformationManager tm; - - @Test - void testTransformationManager() { - List tms = tm.getArtifactTransformations(); - - assertEquals(3, tms.size()); - - assertTrue( - tms.get(0) instanceof ReleaseArtifactTransformation, - "We expected the release transformation and got " + tms.get(0)); - - assertTrue( - tms.get(1) instanceof LatestArtifactTransformation, - "We expected the latest transformation and got " + tms.get(1)); - - assertTrue( - tms.get(2) instanceof SnapshotTransformation, - "We expected the snapshot transformation and got " + tms.get(2)); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java b/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java deleted file mode 100644 index 68a1d16d6828..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.profiles.manager; - -import javax.inject.Inject; - -import java.util.List; -import java.util.Properties; - -import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationProperty; -import org.apache.maven.model.Profile; -import org.apache.maven.profiles.DefaultProfileManager; -import org.apache.maven.profiles.ProfileManager; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@PlexusTest -@Deprecated -class DefaultProfileManagerTest { - - @Inject - PlexusContainer container; - - protected PlexusContainer getContainer() { - return container; - } - - @Test - void testShouldActivateDefaultProfile() throws Exception { - Profile notActivated = new Profile(); - notActivated.setId("notActivated"); - - Activation nonActivation = new Activation(); - - nonActivation.setJdk("19.2"); - - notActivated.setActivation(nonActivation); - - Profile defaultActivated = new Profile(); - defaultActivated.setId("defaultActivated"); - - Activation defaultActivation = new Activation(); - - defaultActivation.setActiveByDefault(true); - - defaultActivated.setActivation(defaultActivation); - - Properties props = System.getProperties(); - - ProfileManager profileManager = new DefaultProfileManager(getContainer(), props); - - profileManager.addProfile(notActivated); - profileManager.addProfile(defaultActivated); - - List active = profileManager.getActiveProfiles(); - - assertNotNull(active); - assertEquals(1, active.size()); - assertEquals("defaultActivated", ((Profile) active.get(0)).getId()); - } - - @Test - void testShouldNotActivateDefaultProfile() throws Exception { - Profile syspropActivated = new Profile(); - syspropActivated.setId("syspropActivated"); - - Activation syspropActivation = new Activation(); - - ActivationProperty syspropProperty = new ActivationProperty(); - syspropProperty.setName("java.version"); - - syspropActivation.setProperty(syspropProperty); - - syspropActivated.setActivation(syspropActivation); - - Profile defaultActivated = new Profile(); - defaultActivated.setId("defaultActivated"); - - Activation defaultActivation = new Activation(); - - defaultActivation.setActiveByDefault(true); - - defaultActivated.setActivation(defaultActivation); - - Properties props = System.getProperties(); - - ProfileManager profileManager = new DefaultProfileManager(getContainer(), props); - - profileManager.addProfile(syspropActivated); - profileManager.addProfile(defaultActivated); - - List active = profileManager.getActiveProfiles(); - - assertNotNull(active); - assertEquals(1, active.size()); - assertEquals("syspropActivated", ((Profile) active.get(0)).getId()); - } - - @Test - void testShouldNotActivateReversalOfPresentSystemProperty() throws Exception { - Profile syspropActivated = new Profile(); - syspropActivated.setId("syspropActivated"); - - Activation syspropActivation = new Activation(); - - ActivationProperty syspropProperty = new ActivationProperty(); - syspropProperty.setName("!java.version"); - - syspropActivation.setProperty(syspropProperty); - - syspropActivated.setActivation(syspropActivation); - - Properties props = System.getProperties(); - - ProfileManager profileManager = new DefaultProfileManager(getContainer(), props); - - profileManager.addProfile(syspropActivated); - - List active = profileManager.getActiveProfiles(); - - assertNotNull(active); - assertEquals(0, active.size()); - } - - @Test - void testShouldOverrideAndActivateInactiveProfile() throws Exception { - Profile syspropActivated = new Profile(); - syspropActivated.setId("syspropActivated"); - - Activation syspropActivation = new Activation(); - - ActivationProperty syspropProperty = new ActivationProperty(); - syspropProperty.setName("!java.version"); - - syspropActivation.setProperty(syspropProperty); - - syspropActivated.setActivation(syspropActivation); - - Properties props = System.getProperties(); - - ProfileManager profileManager = new DefaultProfileManager(getContainer(), props); - - profileManager.addProfile(syspropActivated); - - profileManager.explicitlyActivate("syspropActivated"); - - List active = profileManager.getActiveProfiles(); - - assertNotNull(active); - assertEquals(1, active.size()); - assertEquals("syspropActivated", ((Profile) active.get(0)).getId()); - } - - @Test - void testShouldOverrideAndDeactivateActiveProfile() throws Exception { - Profile syspropActivated = new Profile(); - syspropActivated.setId("syspropActivated"); - - Activation syspropActivation = new Activation(); - - ActivationProperty syspropProperty = new ActivationProperty(); - syspropProperty.setName("java.version"); - - syspropActivation.setProperty(syspropProperty); - - syspropActivated.setActivation(syspropActivation); - - Properties props = System.getProperties(); - - ProfileManager profileManager = new DefaultProfileManager(getContainer(), props); - - profileManager.addProfile(syspropActivated); - - profileManager.explicitlyDeactivate("syspropActivated"); - - List active = profileManager.getActiveProfiles(); - - assertNotNull(active); - assertEquals(0, active.size()); - } - - @Test - @Disabled - void testOsActivationProfile() throws Exception { - /* - Profile osActivated = new Profile(); - osActivated.setId( "os-profile" ); - - Activation osActivation = new Activation(); - - ActivationOS activationOS = new ActivationOS(); - - activationOS.setName( "!dddd" ); - - osActivation.setOs( activationOS ); - - osActivated.setActivation( osActivation ); - - Properties props = System.getProperties(); - ProfileActivationContext ctx = new ProfileActivationContext( props, false ); - - ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); - - profileManager.addProfile( osActivated ); - - List active = profileManager.getActiveProfiles( null ); - - assertNotNull( active ); - assertEquals( 1, active.size() ); - */ - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java deleted file mode 100644 index 68d6827b7a7f..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Inject; - -import java.io.File; -import java.io.FileNotFoundException; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Arrays; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.DefaultMavenExecutionResult; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.internal.impl.DefaultLookup; -import org.apache.maven.internal.impl.DefaultSession; -import org.apache.maven.internal.impl.InternalSession; -import org.apache.maven.model.building.ModelBuildingException; -import org.apache.maven.model.building.ModelProblem; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.repository.internal.MavenRepositorySystemUtils; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.junit.jupiter.api.BeforeEach; - -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.Mockito.mock; - -/** - */ -@PlexusTest -@Deprecated -public abstract class AbstractMavenProjectTestCase { - protected ProjectBuilder projectBuilder; - - @Inject - protected RepositorySystem repositorySystem; - - @Inject - protected PlexusContainer container; - - public PlexusContainer getContainer() { - return container; - } - - @BeforeEach - public void setUp() throws Exception { - if (getContainer().hasComponent(ProjectBuilder.class, "test")) { - projectBuilder = getContainer().lookup(ProjectBuilder.class, "test"); - } else { - // default over to the main project builder... - projectBuilder = getContainer().lookup(ProjectBuilder.class); - } - } - - protected ProjectBuilder getProjectBuilder() { - return projectBuilder; - } - - // ---------------------------------------------------------------------- - // Local repository - // ---------------------------------------------------------------------- - - protected File getLocalRepositoryPath() throws FileNotFoundException, URISyntaxException { - File markerFile = getFileForClasspathResource("local-repo/marker.txt"); - - return markerFile.getAbsoluteFile().getParentFile(); - } - - protected static File getFileForClasspathResource(String resource) - throws FileNotFoundException, URISyntaxException { - ClassLoader cloader = Thread.currentThread().getContextClassLoader(); - - URL resourceUrl = cloader.getResource(resource); - - if (resourceUrl == null) { - throw new FileNotFoundException("Unable to find: " + resource); - } - - return new File(resourceUrl.toURI()); - } - - protected ArtifactRepository getLocalRepository() throws Exception { - ArtifactRepositoryLayout repoLayout = getContainer().lookup(ArtifactRepositoryLayout.class); - - ArtifactRepository r = repositorySystem.createArtifactRepository( - "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null); - - return r; - } - - // ---------------------------------------------------------------------- - // Project building - // ---------------------------------------------------------------------- - - protected MavenProject getProjectWithDependencies(File pom) throws Exception { - ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); - configuration.setLocalRepository(getLocalRepository()); - configuration.setRemoteRepositories(Arrays.asList(new ArtifactRepository[] {})); - configuration.setProcessPlugins(false); - configuration.setResolveDependencies(true); - initRepoSession(configuration); - - try { - return projectBuilder.build(pom, configuration).getProject(); - } catch (Exception e) { - Throwable cause = e.getCause(); - if (cause instanceof ModelBuildingException) { - String message = "In: " + pom + "\n\n"; - for (ModelProblem problem : ((ModelBuildingException) cause).getProblems()) { - message += problem + "\n"; - } - System.out.println(message); - fail(message); - } - - throw e; - } - } - - protected MavenProject getProject(File pom) throws Exception { - ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest(); - configuration.setLocalRepository(getLocalRepository()); - initRepoSession(configuration); - - return projectBuilder.build(pom, configuration).getProject(); - } - - protected void initRepoSession(ProjectBuildingRequest request) { - File localRepo = new File(request.getLocalRepository().getBasedir()); - DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession(); - session.setLocalRepositoryManager(new LegacyLocalRepositoryManager(localRepo)); - request.setRepositorySession(session); - - DefaultMavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); - MavenSession msession = - new MavenSession(getContainer(), session, mavenExecutionRequest, new DefaultMavenExecutionResult()); - DefaultSession iSession = new DefaultSession( - msession, - mock(org.eclipse.aether.RepositorySystem.class), - null, - null, - new DefaultLookup(container), - null); - InternalSession.associate(session, iSession); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java b/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java deleted file mode 100644 index 5c7986d0b4fa..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.FileNotFoundException; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.impl.ArtifactResolver; -import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.ArtifactResult; -import org.eclipse.aether.transfer.ArtifactNotFoundException; - -/** - */ -@Named("classpath") -@Singleton -@Deprecated -public class ClasspathArtifactResolver implements ArtifactResolver { - - public List resolveArtifacts( - RepositorySystemSession session, Collection requests) - throws ArtifactResolutionException { - List results = new ArrayList<>(); - - for (ArtifactRequest request : requests) { - ArtifactResult result = new ArtifactResult(request); - results.add(result); - - Artifact artifact = request.getArtifact(); - if ("maven-test".equals(artifact.getGroupId())) { - String scope = artifact.getArtifactId().substring("scope-".length()); - - try { - artifact = artifact.setFile(ProjectClasspathTestType.getFileForClasspathResource( - ProjectClasspathTestType.dir + "transitive-" + scope + "-dep.xml")); - result.setArtifact(artifact); - } catch (FileNotFoundException | URISyntaxException e) { - throw new IllegalStateException("Missing test POM for " + artifact, e); - } - } else { - result.addException(new ArtifactNotFoundException(artifact, (RemoteRepository) null)); - throw new ArtifactResolutionException(results); - } - } - - return results; - } - - public ArtifactResult resolveArtifact(RepositorySystemSession session, ArtifactRequest request) - throws ArtifactResolutionException { - return resolveArtifacts(session, Collections.singleton(request)).get(0); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleBindingsInjector.java b/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleBindingsInjector.java deleted file mode 100644 index 513bb0236ba7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleBindingsInjector.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.apache.maven.api.Lifecycle; -import org.apache.maven.api.Packaging; -import org.apache.maven.api.Type; -import org.apache.maven.api.annotations.Nonnull; -import org.apache.maven.api.di.Inject; -import org.apache.maven.api.di.Named; -import org.apache.maven.api.di.Priority; -import org.apache.maven.api.di.Singleton; -import org.apache.maven.api.model.Plugin; -import org.apache.maven.api.model.PluginContainer; -import org.apache.maven.api.model.PluginExecution; -import org.apache.maven.api.services.LifecycleRegistry; -import org.apache.maven.api.services.PackagingRegistry; -import org.apache.maven.internal.impl.model.DefaultLifecycleBindingsInjector; - -import static org.apache.maven.api.Lifecycle.DEFAULT; - -@Singleton -@Named -@Priority(5) -@Deprecated -public class EmptyLifecycleBindingsInjector extends DefaultLifecycleBindingsInjector { - - private static LifecycleRegistry lifecycleRegistry; - private static PackagingRegistry packagingRegistry; - - private static final LifecycleRegistry emptyLifecycleRegistry = new LifecycleRegistry() { - - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } - - @Override - public Optional lookup(String id) { - return Optional.empty(); - } - }; - - private static final PackagingRegistry emptyPackagingRegistry = new PackagingRegistry() { - @Override - public Optional lookup(String id) { - return Optional.of(new Packaging() { - @Override - public String id() { - return id; - } - - @Override - public Type type() { - return null; - } - - @Override - public Map plugins() { - if ("JAR".equals(id)) { - return Map.of( - DEFAULT, - PluginContainer.newBuilder() - .plugins(List.of( - newPlugin("maven-compiler-plugin", "compile", "testCompile"), - newPlugin("maven-resources-plugin", "resources", "testResources"), - newPlugin("maven-surefire-plugin", "test"), - newPlugin("maven-jar-plugin", "jar"), - newPlugin("maven-install-plugin", "install"), - newPlugin("maven-deploy-plugin", "deploy"))) - .build()); - } else { - return Map.of(); - } - } - }); - } - }; - - @Inject - public EmptyLifecycleBindingsInjector(LifecycleRegistry lifecycleRegistry, PackagingRegistry packagingRegistry) { - super(new WrapperLifecycleRegistry(), new WrapperPackagingRegistry()); - EmptyLifecycleBindingsInjector.lifecycleRegistry = lifecycleRegistry; - EmptyLifecycleBindingsInjector.packagingRegistry = packagingRegistry; - } - - public static void useEmpty() { - lifecycleRegistry = emptyLifecycleRegistry; - packagingRegistry = emptyPackagingRegistry; - } - - private static Plugin newPlugin(String artifactId, String... goals) { - return Plugin.newBuilder() - .groupId("org.apache.maven.plugins") - .artifactId(artifactId) - .executions(Arrays.stream(goals) - .map(goal -> PluginExecution.newBuilder() - .id("default-" + goal) - .goals(List.of(goal)) - .build()) - .toList()) - .build(); - } - - static class WrapperLifecycleRegistry implements LifecycleRegistry { - @Override - @Nonnull - public Optional lookup(String id) { - return getDelegate().lookup(id); - } - - @Override - public Iterator iterator() { - return getDelegate().iterator(); - } - - protected LifecycleRegistry getDelegate() { - return lifecycleRegistry; - } - } - - static class WrapperPackagingRegistry implements PackagingRegistry { - @Override - public Optional lookup(String id) { - return getDelegate().lookup(id); - } - - private PackagingRegistry getDelegate() { - return packagingRegistry; - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java b/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java deleted file mode 100644 index 44900c5cd29a..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.lifecycle.DefaultLifecycles; -import org.apache.maven.lifecycle.LifecycleExecutor; -import org.apache.maven.lifecycle.MavenExecutionPlan; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.plugin.MojoExecution; - -/** - * A stub implementation that assumes an empty lifecycle to bypass interaction with the plugin manager and to avoid - * plugin artifact resolution from repositories. - * - */ -@Deprecated -public class EmptyLifecycleExecutor implements LifecycleExecutor { - - public MavenExecutionPlan calculateExecutionPlan(MavenSession session, String... tasks) { - return new MavenExecutionPlan(null, new DefaultLifecycles()); - } - - public MavenExecutionPlan calculateExecutionPlan(MavenSession session, boolean setup, String... tasks) { - return new MavenExecutionPlan(null, new DefaultLifecycles()); - } - - public void execute(MavenSession session) {} - - public Set getPluginsBoundByDefaultToAllLifecycles(String packaging) { - Set plugins; - - // NOTE: The upper-case packaging name is intentional, that's a special hinting mode used for certain tests - if ("JAR".equals(packaging)) { - plugins = new LinkedHashSet<>(); - - plugins.add(newPlugin("maven-compiler-plugin", "compile", "testCompile")); - plugins.add(newPlugin("maven-resources-plugin", "resources", "testResources")); - plugins.add(newPlugin("maven-surefire-plugin", "test")); - plugins.add(newPlugin("maven-jar-plugin", "jar")); - plugins.add(newPlugin("maven-install-plugin", "install")); - plugins.add(newPlugin("maven-deploy-plugin", "deploy")); - } else { - plugins = Collections.emptySet(); - } - - return plugins; - } - - private Plugin newPlugin(String artifactId, String... goals) { - Plugin plugin = new Plugin(); - - plugin.setGroupId("org.apache.maven.plugins"); - plugin.setArtifactId(artifactId); - - for (String goal : goals) { - PluginExecution pluginExecution = new PluginExecution(); - pluginExecution.setId("default-" + goal); - pluginExecution.addGoal(goal); - plugin.addExecution(pluginExecution); - } - - return plugin; - } - - public void calculateForkedExecutions(MojoExecution mojoExecution, MavenSession session) {} - - public List executeForkedExecutions(MojoExecution mojoExecution, MavenSession session) { - return Collections.emptyList(); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java b/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java deleted file mode 100644 index 4b489783b0f3..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.io.File; - -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.metadata.Metadata; -import org.eclipse.aether.repository.LocalArtifactRegistration; -import org.eclipse.aether.repository.LocalArtifactRequest; -import org.eclipse.aether.repository.LocalArtifactResult; -import org.eclipse.aether.repository.LocalMetadataRegistration; -import org.eclipse.aether.repository.LocalMetadataRequest; -import org.eclipse.aether.repository.LocalMetadataResult; -import org.eclipse.aether.repository.LocalRepository; -import org.eclipse.aether.repository.LocalRepositoryManager; -import org.eclipse.aether.repository.RemoteRepository; - -/** - */ -@Deprecated -public class LegacyLocalRepositoryManager implements LocalRepositoryManager { - - private final LocalRepository repository; - - public LegacyLocalRepositoryManager(File basedir) { - this.repository = new LocalRepository(basedir.getAbsoluteFile(), "legacy"); - } - - public LocalRepository getRepository() { - return repository; - } - - public String getPathForLocalArtifact(Artifact artifact) { - StringBuilder path = new StringBuilder(128); - - path.append(artifact.getGroupId()).append('/'); - - path.append(artifact.getExtension()).append("s/"); - - path.append(artifact.getArtifactId()).append('-').append(artifact.getVersion()); - - if (!artifact.getClassifier().isEmpty()) { - path.append('-').append(artifact.getClassifier()); - } - - path.append('.').append(artifact.getExtension()); - - return path.toString(); - } - - public String getPathForRemoteArtifact(Artifact artifact, RemoteRepository repository, String context) { - return getPathForLocalArtifact(artifact); - } - - public String getPathForLocalMetadata(Metadata metadata) { - return getPath(metadata, "local"); - } - - public String getPathForRemoteMetadata(Metadata metadata, RemoteRepository repository, String context) { - return getPath(metadata, getRepositoryKey(repository, context)); - } - - String getRepositoryKey(RemoteRepository repository, String context) { - return repository.getId(); - } - - private String getPath(Metadata metadata, String repositoryKey) { - StringBuilder path = new StringBuilder(128); - - if (!metadata.getGroupId().isEmpty()) { - path.append(metadata.getGroupId().replace('.', '/')).append('/'); - - if (!metadata.getArtifactId().isEmpty()) { - path.append(metadata.getArtifactId()).append('/'); - - if (!metadata.getVersion().isEmpty()) { - path.append(metadata.getVersion()).append('/'); - } - } - } - - path.append(insertRepositoryKey(metadata.getType(), repositoryKey)); - - return path.toString(); - } - - private String insertRepositoryKey(String filename, String repositoryKey) { - String result; - int idx = filename.indexOf('.'); - if (idx < 0) { - result = filename + '-' + repositoryKey; - } else { - result = filename.substring(0, idx) + '-' + repositoryKey + filename.substring(idx); - } - return result; - } - - public LocalArtifactResult find(RepositorySystemSession session, LocalArtifactRequest request) { - String path = getPathForLocalArtifact(request.getArtifact()); - File file = new File(getRepository().getBasedir(), path); - - LocalArtifactResult result = new LocalArtifactResult(request); - if (file.isFile()) { - result.setFile(file); - result.setAvailable(true); - } - - return result; - } - - public void add(RepositorySystemSession session, LocalArtifactRegistration request) { - // noop - } - - public LocalMetadataResult find(RepositorySystemSession session, LocalMetadataRequest request) { - LocalMetadataResult result = new LocalMetadataResult(request); - - String path; - - Metadata metadata = request.getMetadata(); - String context = request.getContext(); - RemoteRepository remote = request.getRepository(); - - if (remote != null) { - path = getPathForRemoteMetadata(metadata, remote, context); - } else { - path = getPathForLocalMetadata(metadata); - } - - File file = new File(getRepository().getBasedir(), path); - if (file.isFile()) { - result.setFile(file); - } - - return result; - } - - public void add(RepositorySystemSession session, LocalMetadataRegistration request) { - // noop - } - - public String toString() { - return String.valueOf(getRepository()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTestType.java b/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTestType.java deleted file mode 100644 index dc21aa03a3e2..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTestType.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import java.io.File; -import java.lang.reflect.Field; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.internal.impl.resolver.DefaultArtifactDescriptorReader; -import org.eclipse.aether.impl.ArtifactDescriptorReader; -import org.eclipse.aether.impl.ArtifactResolver; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; - -@Deprecated -class ProjectClasspathTestType extends AbstractMavenProjectTestCase { - static final String dir = "projects/scope/"; - - @Override - @BeforeEach - public void setUp() throws Exception { - super.setUp(); - - ArtifactResolver resolver = getContainer().lookup(ArtifactResolver.class, "classpath"); - DefaultArtifactDescriptorReader pomReader = - (DefaultArtifactDescriptorReader) getContainer().lookup(ArtifactDescriptorReader.class); - Field field = DefaultArtifactDescriptorReader.class.getDeclaredField("artifactResolver"); - field.setAccessible(true); - field.set(pomReader, resolver); - - projectBuilder = getContainer().lookup(ProjectBuilder.class, "classpath"); - } - - @Test - void testProjectClasspath() throws Exception { - File f = getFileForClasspathResource(dir + "project-with-scoped-dependencies.xml"); - - MavenProject project = getProjectWithDependencies(f); - - Artifact artifact; - - assertNotNull(project, "Test project can't be null!"); - - checkArtifactIdScope(project, "provided", "provided"); - checkArtifactIdScope(project, "test", "test"); - checkArtifactIdScope(project, "compile", "compile"); - checkArtifactIdScope(project, "runtime", "runtime"); - checkArtifactIdScope(project, "default", "compile"); - - // check all transitive deps of a test dependency are test, except test and provided which is skipped - artifact = getArtifact(project, "maven-test-test", "scope-provided"); - assertNull(artifact, "Check no provided dependencies are transitive"); - artifact = getArtifact(project, "maven-test-test", "scope-test"); - assertNull(artifact, "Check no test dependencies are transitive"); - - artifact = getArtifact(project, "maven-test-test", "scope-compile"); - assertNotNull(artifact); - - System.out.println("a = " + artifact); - System.out.println("b = " + artifact.getScope()); - assertEquals("test", artifact.getScope(), "Check scope"); - artifact = getArtifact(project, "maven-test-test", "scope-default"); - assertEquals("test", artifact.getScope(), "Check scope"); - artifact = getArtifact(project, "maven-test-test", "scope-runtime"); - assertEquals("test", artifact.getScope(), "Check scope"); - - // check all transitive deps of a provided dependency are provided scope, except for test - checkGroupIdScope(project, "provided", "maven-test-provided"); - artifact = getArtifact(project, "maven-test-provided", "scope-runtime"); - assertEquals("provided", artifact.getScope(), "Check scope"); - - // check all transitive deps of a runtime dependency are runtime scope, except for test - checkGroupIdScope(project, "runtime", "maven-test-runtime"); - artifact = getArtifact(project, "maven-test-runtime", "scope-runtime"); - assertEquals("runtime", artifact.getScope(), "Check scope"); - - // check all transitive deps of a compile dependency are compile scope, except for runtime and test - checkGroupIdScope(project, "compile", "maven-test-compile"); - artifact = getArtifact(project, "maven-test-compile", "scope-runtime"); - assertEquals("runtime", artifact.getScope(), "Check scope"); - - // check all transitive deps of a default dependency are compile scope, except for runtime and test - checkGroupIdScope(project, "compile", "maven-test-default"); - artifact = getArtifact(project, "maven-test-default", "scope-runtime"); - assertEquals("runtime", artifact.getScope(), "Check scope"); - } - - private void checkGroupIdScope(MavenProject project, String scopeValue, String groupId) { - Artifact artifact; - artifact = getArtifact(project, groupId, "scope-compile"); - assertEquals(scopeValue, artifact.getScope(), "Check scope"); - artifact = getArtifact(project, groupId, "scope-test"); - assertNull(artifact, "Check test dependency is not transitive"); - artifact = getArtifact(project, groupId, "scope-provided"); - assertNull(artifact, "Check provided dependency is not transitive"); - artifact = getArtifact(project, groupId, "scope-default"); - assertEquals(scopeValue, artifact.getScope(), "Check scope"); - } - - private void checkArtifactIdScope(MavenProject project, String scope, String scopeValue) { - String artifactId = "scope-" + scope; - Artifact artifact = getArtifact(project, "maven-test", artifactId); - assertNotNull(artifact); - assertEquals(scopeValue, artifact.getScope(), "Check scope"); - } - - private Artifact getArtifact(MavenProject project, String groupId, String artifactId) { - System.out.println("[ Looking for " + groupId + ":" + artifactId + " ]"); - for (Artifact a : project.getArtifacts()) { - System.out.println(a.toString()); - if (artifactId.equals(a.getArtifactId()) && a.getGroupId().equals(groupId)) { - System.out.println("RETURN"); - return a; - } - } - System.out.println("Return null"); - return null; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java b/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java deleted file mode 100644 index 7c71ee046075..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.resolver.DefaultArtifactResolver; - -@Named("classpath") -@Singleton -@Deprecated -public class TestArtifactResolver extends DefaultArtifactResolver { - private ArtifactMetadataSource source; - - @Inject - public TestArtifactResolver(final @Named("classpath") ArtifactMetadataSource source) { - this.source = source; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java b/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java deleted file mode 100644 index d5769e6b524c..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.repository.legacy.LegacyRepositorySystem; - -@Named("classpath") -@Singleton -@Deprecated -public class TestMavenRepositorySystem extends LegacyRepositorySystem { - @Inject - private ArtifactResolver artifactResolver; -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java b/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java deleted file mode 100644 index cfda6e1caccf..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.util.Collections; - -import org.apache.maven.api.services.ModelBuilder; -import org.apache.maven.api.services.model.ModelProcessor; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.model.root.RootLocator; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.impl.RemoteRepositoryManager; - -@Named("classpath") -@Singleton -@Deprecated -public class TestProjectBuilder extends DefaultProjectBuilder { - @Inject - public TestProjectBuilder( - ModelBuilder modelBuilder, - ModelProcessor modelProcessor, - ProjectBuildingHelper projectBuildingHelper, - MavenRepositorySystem repositorySystem, - RepositorySystem repoSystem, - RemoteRepositoryManager repositoryManager, - ProjectDependenciesResolver dependencyResolver, - RootLocator rootLocator) { - super( - modelBuilder, - modelProcessor, - projectBuildingHelper, - repositorySystem, - repoSystem, - repositoryManager, - dependencyResolver, - rootLocator); - } - - @Override - public ProjectBuildingResult build(File pomFile, ProjectBuildingRequest configuration) - throws ProjectBuildingException { - ProjectBuildingResult result = super.build(pomFile, configuration); - - result.getProject().setRemoteArtifactRepositories(Collections.emptyList()); - - return result; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java b/maven-compat/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java deleted file mode 100644 index 20938963639a..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import java.util.Arrays; -import java.util.Collections; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter; -import org.apache.maven.repository.DelegatingLocalArtifactRepository; -import org.apache.maven.repository.RepositorySystem; -import org.apache.maven.repository.TestRepositorySystem; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotSame; - -/** - */ -@Deprecated -class DefaultMavenMetadataCacheTest { - private RepositorySystem repositorySystem; - - @BeforeEach - void setUp() { - repositorySystem = new TestRepositorySystem(); - } - - @Test - void testCacheKey() throws Exception { - Artifact a1 = repositorySystem.createArtifact("testGroup", "testArtifact", "1.2.3", "jar"); - @SuppressWarnings("deprecation") - ArtifactRepository lr1 = new DelegatingLocalArtifactRepository(repositorySystem.createDefaultLocalRepository()); - ArtifactRepository rr1 = repositorySystem.createDefaultRemoteRepository(); - a1.setDependencyFilter(new ExcludesArtifactFilter(Arrays.asList("foo"))); - - Artifact a2 = repositorySystem.createArtifact("testGroup", "testArtifact", "1.2.3", "jar"); - @SuppressWarnings("deprecation") - ArtifactRepository lr2 = new DelegatingLocalArtifactRepository(repositorySystem.createDefaultLocalRepository()); - ArtifactRepository rr2 = repositorySystem.createDefaultRemoteRepository(); - a2.setDependencyFilter(new ExcludesArtifactFilter(Arrays.asList("foo"))); - - // sanity checks - assertNotSame(a1, a2); - assertNotSame(lr1, lr2); - assertNotSame(rr1, rr2); - - DefaultMavenMetadataCache.CacheKey k1 = - new DefaultMavenMetadataCache.CacheKey(a1, false, lr1, Collections.singletonList(rr1)); - DefaultMavenMetadataCache.CacheKey k2 = - new DefaultMavenMetadataCache.CacheKey(a2, false, lr2, Collections.singletonList(rr2)); - - assertEquals(k1.hashCode(), k2.hashCode()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java b/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java deleted file mode 100644 index bb6d4a258326..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.artifact; - -import javax.inject.Inject; - -import org.apache.maven.repository.RepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -@PlexusTest -@Deprecated -class MavenMetadataSourceTest { - @Inject - private RepositorySystem repositorySystem; - - @Inject - PlexusContainer container; - - @Test - @Disabled - void testShouldNotCarryExclusionsOverFromDependencyToDependency() throws Exception { - /* - Dependency dep1 = new Dependency(); - dep1.setGroupId( "test" ); - dep1.setArtifactId( "test-artifact" ); - dep1.setVersion( "1" ); - dep1.setType( "jar" ); - - Exclusion exc = new Exclusion(); - exc.setGroupId( "test" ); - exc.setArtifactId( "test-artifact3" ); - - dep1.addExclusion( exc ); - - Dependency dep2 = new Dependency(); - dep2.setGroupId( "test" ); - dep2.setArtifactId( "test-artifact2" ); - dep2.setVersion( "1" ); - dep2.setType( "jar" ); - - List deps = new ArrayList<>(); - deps.add( dep1 ); - deps.add( dep2 ); - - ArtifactFactory factory = container.lookup( ArtifactFactory.class ); - - ArtifactFilter dependencyFilter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE ); - - MavenProject project = new MavenProject( new Model() ); - - Set result = project.createArtifacts( dependencyFilter ); - - for (Iterator it = result.iterator(); it.hasNext(); ) - { - Artifact artifact = it.next(); - - if ( "test-artifact2".equals( artifact.getArtifactId() ) ) - { - ArtifactFilter filter = artifact.getDependencyFilter(); - - assertSame( dependencyFilter, filter ); - } - } - */ - } - - @Test - @Disabled("TODO restore these if it makes sense") - void testShouldUseCompileScopeIfDependencyScopeEmpty() throws Exception { - /* - String groupId = "org.apache.maven"; - String artifactId = "maven-model"; - - Dependency dep = new Dependency(); - - dep.setGroupId( groupId ); - dep.setArtifactId( artifactId ); - dep.setVersion( "2.0-alpha-3" ); - - Model model = new Model(); - - model.addDependency( dep ); - - MavenProject project = new MavenProject( model, repositorySystem ); - - project.setArtifacts( project.createArtifacts( null ) ); - - String key = ArtifactUtils.versionlessKey( groupId, artifactId ); - - Map artifactMap = project.getArtifactMap(); - - assertNotNull( artifactMap, "artifact-map should not be null." ); - assertEquals( 1, artifactMap.size(), "artifact-map should contain 1 element." ); - - Artifact artifact = (Artifact) artifactMap.get( key ); - - assertNotNull( artifact, "dependency artifact not found in map." ); - assertEquals( Artifact.SCOPE_COMPILE, artifact.getScope(), "dependency artifact has wrong scope." ); - - //check for back-propagation of default scope. - assertEquals( Artifact.SCOPE_COMPILE, dep.getScope(), "default scope NOT back-propagated to dependency." ); - */ - } - - @Test - @Disabled - void testShouldUseInjectedTestScopeFromDependencyManagement() throws Exception { - /* - String groupId = "org.apache.maven"; - String artifactId = "maven-model"; - - Dependency dep = new Dependency(); - - dep.setGroupId( groupId ); - dep.setArtifactId( artifactId ); - dep.setVersion( "2.0-alpha-3" ); - - Model model = new Model(); - - model.addDependency( dep ); - - Dependency mgd = new Dependency(); - mgd.setGroupId( groupId ); - mgd.setArtifactId( artifactId ); - mgd.setScope( Artifact.SCOPE_TEST ); - - DependencyManagement depMgmt = new DependencyManagement(); - - depMgmt.addDependency( mgd ); - - model.setDependencyManagement( depMgmt ); - - MavenProject project = new MavenProject( model, repositorySystem ); - - TestModelDefaultsInjector injector = new TestModelDefaultsInjector(); - - injector.injectDefaults( model ); - - project.setArtifacts( project.createArtifacts( null ) ); - - String key = ArtifactUtils.versionlessKey( groupId, artifactId ); - - Map artifactMap = project.getArtifactMap(); - - assertNotNull( artifactMap, "artifact-map should not be null." ); - assertEquals( 1, artifactMap.size(), "artifact-map should contain 1 element." ); - - Artifact artifact = (Artifact) artifactMap.get( key ); - - assertNotNull( artifact, "dependency artifact not found in map." ); - assertEquals( "dependency artifact has wrong scope.", Artifact.SCOPE_TEST, artifact.getScope() ); - - //check for back-propagation of default scope. - assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_TEST, dep.getScope() ); - */ - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java deleted file mode 100644 index af9c2804abc7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance; - -import java.io.File; - -import org.apache.maven.project.AbstractMavenProjectTestCase; -import org.apache.maven.project.EmptyLifecycleBindingsInjector; -import org.junit.jupiter.api.BeforeEach; - -import static org.codehaus.plexus.testing.PlexusExtension.getTestFile; - -/** - */ -@Deprecated -public abstract class AbstractProjectInheritanceTestCase extends AbstractMavenProjectTestCase { - protected String getTestSeries() { - String className = getClass().getPackage().getName(); - - return className.substring(className.lastIndexOf('.') + 1); - } - - protected File projectFile(String name) { - return projectFile("maven", name); - } - - protected File projectFile(String groupId, String artifactId) { - return new File(getLocalRepositoryPath(), "/" + groupId + "/poms/" + artifactId + "-1.0.pom"); - } - - // ---------------------------------------------------------------------- - // The local repository for this category of tests - // ---------------------------------------------------------------------- - - protected File getLocalRepositoryPath() { - return getTestFile("src/test/resources/inheritance-repo/" + getTestSeries()); - } - - @Override - @BeforeEach - public void setUp() throws Exception { - super.setUp(); - EmptyLifecycleBindingsInjector.useEmpty(); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java deleted file mode 100644 index 88f0ddcc3581..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t00; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testProjectInheritance() throws Exception { - MavenProject p4 = getProject(projectFile("p4")); - - assertEquals("p4", p4.getName()); - - // ---------------------------------------------------------------------- - // Value inherited from p3 - // ---------------------------------------------------------------------- - - assertEquals("2000", p4.getInceptionYear()); - - // ---------------------------------------------------------------------- - // Value taken from p2 - // ---------------------------------------------------------------------- - - assertEquals("mailing-list", p4.getMailingLists().get(0).getName()); - - // ---------------------------------------------------------------------- - // Value taken from p1 - // ---------------------------------------------------------------------- - - assertEquals("scm-url/p2/p3/p4", p4.getScm().getUrl()); - - // ---------------------------------------------------------------------- - // Value taken from p4 - // ---------------------------------------------------------------------- - - assertEquals("Codehaus", p4.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Value taken from super model - // ---------------------------------------------------------------------- - - assertEquals("4.0.0", p4.getModelVersion()); - - assertEquals("4.0.0", p4.getModelVersion()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java deleted file mode 100644 index 28a5b945c756..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t01; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * A test which demonstrates maven's recursive inheritance where - * we are testing to make sure that elements stated in a model are - * not clobbered by the same elements elsewhere in the lineage. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testProjectInheritance() throws Exception { - // ---------------------------------------------------------------------- - // Check p0 value for org name - // ---------------------------------------------------------------------- - - MavenProject p0 = getProject(projectFile("maven.t01", "p0")); - - assertEquals("p0-org", p0.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Check p1 value for org name - // ---------------------------------------------------------------------- - - MavenProject p1 = getProject(projectFile("maven.t01", "p1")); - - assertEquals("p1-org", p1.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Check p2 value for org name - // ---------------------------------------------------------------------- - - MavenProject p2 = getProject(projectFile("maven.t01", "p2")); - - assertEquals("p2-org", p2.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Check p2 value for org name - // ---------------------------------------------------------------------- - - MavenProject p3 = getProject(projectFile("maven.t01", "p3")); - - assertEquals("p3-org", p3.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Check p4 value for org name - // ---------------------------------------------------------------------- - - MavenProject p4 = getProject(projectFile("maven.t01", "p4")); - - assertEquals("p4-org", p4.getOrganization().getName()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java deleted file mode 100644 index 6d682ad24452..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t02; - -import java.io.File; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.model.Build; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.PluginExecution; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p4 inherits from p3 - // p3 inherits from p2 - // p2 inherits from p1 - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - @DisabledOnOs(OS.WINDOWS) // need to investigate why it fails on windows - void testProjectInheritance() throws Exception { - File localRepo = getLocalRepositoryPath(); - - System.out.println("Local repository is at: " + localRepo.getAbsolutePath()); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom1 = new File(pom0.getParentFile(), "p1/pom.xml"); - File pom2 = new File(pom1.getParentFile(), "p2/pom.xml"); - File pom3 = new File(pom2.getParentFile(), "p3/pom.xml"); - File pom4 = new File(pom3.getParentFile(), "p4/pom.xml"); - File pom5 = new File(pom4.getParentFile(), "p5/pom.xml"); - - System.out.println("Location of project-4's POM: " + pom4.getPath()); - - // load everything... - MavenProject project0 = getProject(pom0); - MavenProject project1 = getProject(pom1); - MavenProject project2 = getProject(pom2); - MavenProject project3 = getProject(pom3); - MavenProject project4 = getProject(pom4); - MavenProject project5 = getProject(pom5); - - assertEquals("p4", project4.getName()); - - // ---------------------------------------------------------------------- - // Value inherited from p3 - // ---------------------------------------------------------------------- - - assertEquals("2000", project4.getInceptionYear()); - - // ---------------------------------------------------------------------- - // Value taken from p2 - // ---------------------------------------------------------------------- - - assertEquals("mailing-list", project4.getMailingLists().get(0).getName()); - - // ---------------------------------------------------------------------- - // Value taken from p1 - // ---------------------------------------------------------------------- - - assertEquals("scm-url/p2/p3/p4", project4.getScm().getUrl()); - - // ---------------------------------------------------------------------- - // Value taken from p4 - // ---------------------------------------------------------------------- - - assertEquals("Codehaus", project4.getOrganization().getName()); - - // ---------------------------------------------------------------------- - // Value taken from super model - // ---------------------------------------------------------------------- - - assertEquals("4.0.0", project4.getModelVersion()); - - Build build = project4.getBuild(); - List plugins = build.getPlugins(); - - Map validPluginCounts = new HashMap<>(); - - String testPluginArtifactId = "maven-compiler-plugin"; - - // this is the plugin we're looking for. - validPluginCounts.put(testPluginArtifactId, 0); - - // these are injected if -DperformRelease=true - validPluginCounts.put("maven-deploy-plugin", 0); - validPluginCounts.put("maven-javadoc-plugin", 0); - validPluginCounts.put("maven-source-plugin", 0); - - Plugin testPlugin = null; - - for (Plugin plugin : plugins) { - String pluginArtifactId = plugin.getArtifactId(); - - assertTrue(validPluginCounts.containsKey(pluginArtifactId), "Illegal plugin found: " + pluginArtifactId); - - if (pluginArtifactId.equals(testPluginArtifactId)) { - testPlugin = plugin; - } - - Integer count = validPluginCounts.get(pluginArtifactId); - - assertEquals(0, (int) count, "Multiple copies of plugin: " + pluginArtifactId + " found in POM."); - - count = count + 1; - - validPluginCounts.put(pluginArtifactId, count); - } - - assertNotNull(testPlugin); - - List executions = testPlugin.getExecutions(); - - assertEquals(1, executions.size()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java deleted file mode 100644 index 8dcb7cccbeac..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t03; - -import java.io.File; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * A test which demonstrates maven's recursive inheritance where - * a distinct value is taken from each parent contributing to - * the final model of the project being assembled. There is no - * overriding going on amongst the models being used in this test: - * each model in the lineage is providing a value that is not present - * anywhere else in the lineage. We are just making sure that values - * down in the lineage are bubbling up where they should. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testProjectInheritance() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load everything... - MavenProject project0 = getProject(pom0); - MavenProject project1 = getProject(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java deleted file mode 100644 index 14eca5480ea9..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t04; - -import java.io.File; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Verifies the version of a dependency listed in a parent's - * dependencyManagement section is chosen over another version of the same - * dependency, listed transitively. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // p1 has a depMgmt section that specifies versions 1.0 of jars "a" & "b" - // jar "a" has a transitive dependency on 2.0 of jar "b", but maven should - // prefer to use version 1.0. - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagementOverridesTransitiveDependencyVersion() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - Set set = project1.getArtifacts(); - assertNotNull(set, "No artifacts"); - assertTrue(set.size() > 0, "No Artifacts"); - assertTrue(set.size() == 3, "Set size should be 3, is " + set.size()); - - for (Object aSet : set) { - Artifact artifact = (Artifact) aSet; - System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + (artifact.isOptional() ? "true" : "false")); - assertTrue( - artifact.getVersion().equals("1.0"), "Incorrect version for " + artifact.getDependencyConflictId()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java deleted file mode 100644 index 31a86862ace4..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t05; - -import java.io.File; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A test which demonstrates maven's dependency management - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagement() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load everything... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - Set set = project1.getArtifacts(); - assertNotNull(set, "No artifacts"); - assertTrue(set.size() > 0, "No Artifacts"); - - for (Object aSet : set) { - Artifact artifact = (Artifact) aSet; - System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Scope: " + artifact.getScope()); - assertTrue( - artifact.getVersion().equals("1.0"), "Incorrect version for " + artifact.getDependencyConflictId()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java deleted file mode 100644 index 783ea333b9fe..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t06; - -import java.io.File; -import java.util.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A test which demonstrates maven's dependency management - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagement() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load everything... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - Set set = project1.getArtifacts(); - assertNotNull(set, "No artifacts"); - assertTrue(set.size() > 0, "No Artifacts"); - Iterator iter = set.iterator(); - assertTrue(set.size() == 4, "Set size should be 4, is " + set.size()); - - while (iter.hasNext()) { - Artifact artifact = (Artifact) iter.next(); - System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + (artifact.isOptional() ? "true" : "false")); - assertTrue( - artifact.getVersion().equals("1.0"), "Incorrect version for " + artifact.getDependencyConflictId()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java deleted file mode 100644 index 2d1bc2a94023..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t07; - -import java.io.File; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A test which demonstrates maven's dependency management - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagement() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load everything... - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - System.out.println("Project " + project1.getId() + " " + project1); - Set set = project1.getArtifacts(); - assertNotNull(set, "No artifacts"); - assertTrue(set.size() > 0, "No Artifacts"); - assertTrue(set.size() == 3, "Set size should be 3, is " + set.size()); - - for (Object aSet : set) { - Artifact artifact = (Artifact) aSet; - assertFalse(artifact.getArtifactId().equals("t07-d")); - System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + (artifact.isOptional() ? "true" : "false")); - assertTrue( - artifact.getVersion().equals("1.0"), "Incorrect version for " + artifact.getDependencyConflictId()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java deleted file mode 100644 index e44d7b65e33a..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t08; - -import java.io.File; -import java.util.Iterator; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * A test which demonstrates maven's dependency management - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagement() throws Exception { - File localRepo = getLocalRepositoryPath(); - File pom0 = new File(localRepo, "p0/pom.xml"); - - File pom0Basedir = pom0.getParentFile(); - - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load everything... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - System.out.println("Project " + project1.getId() + " " + project1); - Set set = project1.getArtifacts(); - assertNotNull(set, "No artifacts"); - assertTrue(set.size() > 0, "No Artifacts"); - Iterator iter = set.iterator(); - assertTrue(set.size() == 4, "Set size should be 4, is " + set.size()); - - while (iter.hasNext()) { - Artifact artifact = (Artifact) iter.next(); - System.out.println("Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() - + " Optional=" + (artifact.isOptional() ? "true" : "false")); - assertTrue( - artifact.getVersion().equals("1.0"), "Incorrect version for " + artifact.getDependencyConflictId()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java deleted file mode 100644 index 6d81bd401e57..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t09; - -import java.io.File; -import java.util.Map; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Verifies exclusions listed in dependencyManagement are valid for - * transitive dependencies. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - /** - * How the test project is set up: - * - * 1. dependencyManagement lists dependencies on a & b, - * with an exclusion on c in b. - * 2. the child project lists a dependency on project a only - * 3. a depends on b (which is transitive to the child project), - * and b depends on c. - * - * We should see that the resulting size of collected artifacts is two: - * a & b only. - */ - @Test - void testDependencyManagementExclusionsExcludeTransitively() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertNotNull(project1.getParent(), "Parent is null"); - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - Map map = project1.getArtifactMap(); - - assertNotNull(map, "No artifacts"); - assertTrue(map.size() > 0, "No Artifacts"); - assertTrue(map.size() == 2, "Set size should be 2, is " + map.size()); - - assertTrue(map.containsKey("maven-test:t09-a"), "maven-test:t09-a is not in the project"); - assertTrue(map.containsKey("maven-test:t09-b"), "maven-test:t09-b is not in the project"); - assertFalse(map.containsKey("maven-test:t09-c"), "maven-test:t09-c is in the project"); - } - - /** - * Setup exactly the same as the above test, except that the child project - * now depends upon d, which has a transitive dependency on c. Even though - * we did list an exclusion on c, it was only from within the context of - * project b. We will pick up project c in this case because no - * restrictions were placed on d. This demonstrates that a, b, c, & d will - * all be collected. - * - * @throws Exception - */ - @Test - void testDependencyManagementExclusionDoesNotOverrideGloballyForTransitives() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom2 = new File(pom0Basedir, "p2/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project2 = getProjectWithDependencies(pom2); - - assertEquals(pom0Basedir, project2.getParent().getBasedir()); - Map map = project2.getArtifactMap(); - assertNotNull(map, "No artifacts"); - assertTrue(map.size() > 0, "No Artifacts"); - assertTrue(map.size() == 4, "Set size should be 4, is " + map.size()); - - assertTrue(map.containsKey("maven-test:t09-a"), "maven-test:t09-a is not in the project"); - assertTrue(map.containsKey("maven-test:t09-b"), "maven-test:t09-b is not in the project"); - assertTrue(map.containsKey("maven-test:t09-c"), "maven-test:t09-c is not in the project"); - assertTrue(map.containsKey("maven-test:t09-d"), "maven-test:t09-d is not in the project"); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java deleted file mode 100644 index b7416cdd5454..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t10; - -import java.io.File; -import java.util.Map; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Verifies scope inheritance of direct and transitive dependencies. - * - * Should show three behaviors: - * - * 1. dependencyManagement should override the scope of transitive dependencies. - * 2. Direct dependencies should override the scope of dependencyManagement. - * 3. Direct dependencies should inherit scope from dependencyManagement when - * they do not explicitly state a scope. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagementOverridesTransitiveDependencyVersion() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - System.out.println("Project " + project1.getId() + " " + project1); - Map map = project1.getArtifactMap(); - assertNotNull(map, "No artifacts"); - assertTrue(map.size() > 0, "No Artifacts"); - assertTrue(map.size() == 3, "Set size should be 3, is " + map.size()); - - Artifact a = (Artifact) map.get("maven-test:t10-a"); - Artifact b = (Artifact) map.get("maven-test:t10-b"); - Artifact c = (Artifact) map.get("maven-test:t10-c"); - - assertNotNull(a); - assertNotNull(b); - assertNotNull(c); - - // inherited from depMgmt - System.out.println(a.getScope()); - assertTrue(a.getScope().equals("test"), "Incorrect scope for " + a.getDependencyConflictId()); - - // transitive dep, overridden b depMgmt - assertTrue(b.getScope().equals("runtime"), "Incorrect scope for " + b.getDependencyConflictId()); - - // direct dep, overrides depMgmt - assertTrue(c.getScope().equals("runtime"), "Incorrect scope for " + c.getDependencyConflictId()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java deleted file mode 100644 index 0462f3bb8d5e..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t11; - -import java.io.File; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -/** - * Verifies scope of root project is preserved regardless of parent dependency management. - * - * @see MNG-2919 - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testDependencyManagementDoesNotOverrideScopeOfCurrentArtifact() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - assertEquals(pom0Basedir, project1.getParent().getBasedir()); - assertNull( - project1.getArtifact().getScope(), - "dependencyManagement has overwritten the scope of the currently building child project"); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java deleted file mode 100644 index 0e268e4ec31f..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t12; - -import java.io.File; -import java.util.Map; - -import org.apache.maven.model.Plugin; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; - -/** - * Verifies that plugin execution sections in the parent POM that have - * inherit == false are not inherited to the child POM. - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testFalsePluginExecutionInheritValue() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "p1/pom.xml"); - - getProjectWithDependencies(pom0); - MavenProject project1 = getProjectWithDependencies(pom1); - - Map pluginMap = project1.getBuild().getPluginsAsMap(); - Plugin compilerPlugin = (Plugin) pluginMap.get("org.apache.maven.plugins:maven-compiler-plugin"); - - assertNotNull(compilerPlugin); - - Map executionMap = compilerPlugin.getExecutionsAsMap(); - assertNull( - executionMap.get("test"), - "Plugin execution: 'test' should NOT exist in the compiler plugin specification for the child project!"); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java deleted file mode 100644 index b519533f43c8..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.inheritance.t12scm; - -import java.io.File; - -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Verifies SCM inheritance uses modules statement from parent. - * - */ -@Deprecated -class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase { - // ---------------------------------------------------------------------- - // - // p1 inherits from p0 - // p0 inherits from super model - // - // or we can show it graphically as: - // - // p1 ---> p0 --> super model - // - // ---------------------------------------------------------------------- - - @Test - void testScmInfoCalculatedCorrectlyOnParentAndChildRead() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom0 = new File(localRepo, "p0/pom.xml"); - File pom0Basedir = pom0.getParentFile(); - File pom1 = new File(pom0Basedir, "modules/p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project0 = getProject(pom0); - MavenProject project1 = getProject(pom1); - - System.out.println("\n\n"); - System.out.println("Parent SCM URL is: " + project0.getScm().getUrl()); - System.out.println("Child SCM URL is: " + project1.getScm().getUrl()); - System.out.println(); - System.out.println("Parent SCM connection is: " + project0.getScm().getConnection()); - System.out.println("Child SCM connection is: " + project1.getScm().getConnection()); - System.out.println(); - System.out.println( - "Parent SCM developer connection is: " + project0.getScm().getDeveloperConnection()); - System.out.println( - "Child SCM developer connection is: " + project1.getScm().getDeveloperConnection()); - - assertEquals(project1.getScm().getUrl(), project0.getScm().getUrl() + "/modules/p1"); - assertEquals(project1.getScm().getConnection(), project0.getScm().getConnection() + "/modules/p1"); - assertEquals( - project1.getScm().getDeveloperConnection(), project0.getScm().getDeveloperConnection() + "/modules/p1"); - } - - @Test - void testScmInfoCalculatedCorrectlyOnChildOnlyRead() throws Exception { - File localRepo = getLocalRepositoryPath(); - - File pom1 = new File(localRepo, "p0/modules/p1/pom.xml"); - - // load the child project, which inherits from p0... - MavenProject project1 = getProject(pom1); - - System.out.println("\n\n"); - System.out.println("Child SCM URL is: " + project1.getScm().getUrl()); - System.out.println("Child SCM connection is: " + project1.getScm().getConnection()); - System.out.println( - "Child SCM developer connection is: " + project1.getScm().getDeveloperConnection()); - - assertEquals("http://host/viewer?path=/p0/modules/p1", project1.getScm().getUrl()); - assertEquals("scm:svn:http://host/p0/modules/p1", project1.getScm().getConnection()); - assertEquals("scm:svn:https://host/p0/modules/p1", project1.getScm().getDeveloperConnection()); - } - - // public void testScmInfoCalculatedCorrectlyOnChildReadFromLocalRepository() - // throws Exception - // { - // File localRepo = getLocalRepositoryPath(); - // - // ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.class ); - // Artifact artifact = factory.createProjectArtifact( "maven", "p1", "1.0" ); - // - // ArtifactRepositoryFactory repoFactory = (ArtifactRepositoryFactory) lookup( - // ArtifactRepositoryFactory.class ); - // ArtifactRepository localArtifactRepo = repoFactory.createLocalRepository( localRepo ); - // - // MavenProject project1 = getProjectBuilder().buildFromRepository( artifact, Collections.EMPTY_LIST, - // localArtifactRepo ); - // - // System.out.println( "\n\n" ); - // System.out.println( "Child SCM URL is: " + project1.getScm().getUrl() ); - // System.out.println( "Child SCM connection is: " + project1.getScm().getConnection() ); - // System.out.println( "Child SCM developer connection is: " - // + project1.getScm().getDeveloperConnection() ); - // - // assertEquals( project1.getScm().getUrl(), "http://host/viewer?path=/p0/modules/p1" ); - // assertEquals( project1.getScm().getConnection(), "scm:svn:http://host/p0/modules/p1" ); - // assertEquals( project1.getScm().getDeveloperConnection(), - // "scm:svn:https://host/p0/modules/p1" ); - // } - -} diff --git a/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java b/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java deleted file mode 100644 index d194a78e9c71..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.project.path; - -import java.io.File; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -@Deprecated -class DefaultPathTranslatorTest { - - @Test - void testAlignToBasedirWhereBasedirExpressionIsTheCompleteValue() { - File basedir = new File(System.getProperty("java.io.tmpdir"), "test").getAbsoluteFile(); - - String aligned = new DefaultPathTranslator().alignToBaseDirectory("${basedir}", basedir); - - assertEquals(basedir.getAbsolutePath(), aligned); - } - - @Test - void testAlignToBasedirWhereBasedirExpressionIsTheValuePrefix() { - File basedir = new File(System.getProperty("java.io.tmpdir"), "test").getAbsoluteFile(); - - String aligned = new DefaultPathTranslator().alignToBaseDirectory("${basedir}/dir", basedir); - - assertEquals(new File(basedir, "dir").getAbsolutePath(), aligned); - } - - @Test - void testUnalignToBasedirWherePathEqualsBasedir() { - File basedir = new File(System.getProperty("java.io.tmpdir"), "test").getAbsoluteFile(); - - String unaligned = new DefaultPathTranslator().unalignFromBaseDirectory(basedir.getAbsolutePath(), basedir); - - assertEquals(".", unaligned); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java deleted file mode 100644 index 2d2a2631806b..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.DefaultArtifactRepository; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; - -@Deprecated -class DefaultMirrorSelectorTest { - @Test - void testMirrorWithMirrorOfPatternContainingANegationIsNotSelected() { - ArtifactRepository repository = new DefaultArtifactRepository("snapshots.repo", "http://whatever", null); - String pattern = "external:*, !snapshots.repo"; - assertFalse(DefaultMirrorSelector.matchPattern(repository, pattern)); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java b/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java deleted file mode 100644 index 5feff152534b..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import javax.inject.Inject; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.SimpleLookup; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.metadata.SwitchableMetadataSource; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ResolutionErrorHandler; -import org.apache.maven.execution.DefaultMavenExecutionRequest; -import org.apache.maven.execution.DefaultMavenExecutionResult; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.internal.impl.DefaultRepositoryFactory; -import org.apache.maven.internal.impl.DefaultSession; -import org.apache.maven.internal.impl.InternalSession; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Repository; -import org.apache.maven.model.RepositoryPolicy; -import org.apache.maven.plugin.LegacySupport; -import org.apache.maven.project.artifact.DefaultMetadataSource; -import org.apache.maven.repository.legacy.LegacyRepositorySystem; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException; -import org.codehaus.plexus.testing.PlexusTest; -import org.eclipse.aether.DefaultRepositorySystemSession; -import org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider; -import org.eclipse.aether.internal.impl.DefaultRemoteRepositoryManager; -import org.eclipse.aether.internal.impl.DefaultUpdatePolicyAnalyzer; -import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; -import org.eclipse.aether.repository.LocalRepository; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.codehaus.plexus.testing.PlexusExtension.getBasedir; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Tests {@link LegacyRepositorySystem}. - * - */ -@PlexusTest -@Deprecated -class LegacyRepositorySystemTest { - @Inject - private LegacyRepositorySystem repositorySystem; - - @Inject - private ResolutionErrorHandler resolutionErrorHandler; - - @Inject - private PlexusContainer container; - - protected List getRemoteRepositories() throws Exception { - File repoDir = new File(getBasedir(), "src/test/remote-repo").getAbsoluteFile(); - - RepositoryPolicy policy = new RepositoryPolicy(); - policy.setEnabled(true); - policy.setChecksumPolicy("ignore"); - policy.setUpdatePolicy("always"); - - Repository repository = new Repository(); - repository.setId(RepositorySystem.DEFAULT_REMOTE_REPO_ID); - repository.setUrl("file://" + repoDir.toURI().getPath()); - repository.setReleases(policy); - repository.setSnapshots(policy); - - return Arrays.asList(repositorySystem.buildArtifactRepository(repository)); - } - - protected ArtifactRepository getLocalRepository() throws Exception { - File repoDir = new File(getBasedir(), "target/local-repo").getAbsoluteFile(); - - return repositorySystem.createLocalRepository(repoDir); - } - - @Test - void testThatASystemScopedDependencyIsNotResolvedFromRepositories() throws Exception { - // - // We should get a whole slew of dependencies resolving this artifact transitively - // - Dependency d = new Dependency(); - d.setGroupId("org.apache.maven.its"); - d.setArtifactId("b"); - d.setVersion("0.1"); - d.setScope(Artifact.SCOPE_COMPILE); - Artifact artifact = repositorySystem.createDependencyArtifact(d); - - ArtifactResolutionRequest request = new ArtifactResolutionRequest() - .setArtifact(artifact) - .setResolveRoot(true) - .setResolveTransitively(true) - .setRemoteRepositories(getRemoteRepositories()) - .setLocalRepository(getLocalRepository()); - - DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(); - LocalRepository localRepo = - new LocalRepository(request.getLocalRepository().getBasedir()); - session.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory().newInstance(session, localRepo)); - LegacySupport legacySupport = container.lookup(LegacySupport.class); - DefaultMavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest(); - MavenSession mavenSession = - new MavenSession(container, session, mavenExecutionRequest, new DefaultMavenExecutionResult()); - legacySupport.setSession(mavenSession); - InternalSession iSession = new DefaultSession( - mavenSession, - null, - null, - null, - new SimpleLookup(List.of(new DefaultRepositoryFactory(new DefaultRemoteRepositoryManager( - new DefaultUpdatePolicyAnalyzer(), new DefaultChecksumPolicyProvider())))), - null); - InternalSession.associate(session, iSession); - - ArtifactResolutionResult result = repositorySystem.resolve(request); - resolutionErrorHandler.throwErrors(request, result); - assertEquals(2, result.getArtifacts().size()); - - // - // System scoped version which should - // - d.setScope(Artifact.SCOPE_SYSTEM); - File file = new File(getBasedir(), "src/test/repository-system/maven-core-2.1.0.jar"); - assertTrue(file.exists()); - d.setSystemPath(file.getCanonicalPath()); - - artifact = repositorySystem.createDependencyArtifact(d); - - // - // The request has not set any local or remote repositories as the system scoped dependency being resolved - // should only - // give us the dependency off the disk and nothing more. - // - request = new ArtifactResolutionRequest() - .setArtifact(artifact) - .setResolveRoot(true) - .setResolveTransitively(true); - - result = repositorySystem.resolve(request); - resolutionErrorHandler.throwErrors(request, result); - assertEquals(1, result.getArtifacts().size()); - - // - // Put in a bogus file to make sure missing files cause the resolution to fail. - // - file = new File(getBasedir(), "src/test/repository-system/maven-monkey-2.1.0.jar"); - assertFalse(file.exists()); - d.setSystemPath(file.getCanonicalPath()); - artifact = repositorySystem.createDependencyArtifact(d); - - // - // The request has not set any local or remote repositories as the system scoped dependency being resolved - // should only - // give us the dependency off the disk and nothing more. - // - request = new ArtifactResolutionRequest() - .setArtifact(artifact) - .setResolveRoot(true) - .setResolveTransitively(true); - - try { - result = repositorySystem.resolve(request); - resolutionErrorHandler.throwErrors(request, result); - } catch (Exception e) { - assertTrue(result.hasMissingArtifacts()); - } - } - - @Test - void testLocalRepositoryBasedir() throws Exception { - File localRepoDir = new File("").getAbsoluteFile(); - - ArtifactRepository localRepo = repositorySystem.createLocalRepository(localRepoDir); - - String basedir = localRepo.getBasedir(); - - assertFalse(basedir.endsWith("/")); - assertFalse(basedir.endsWith("\\")); - - assertEquals(localRepoDir, new File(basedir)); - - assertEquals(localRepoDir.getPath(), basedir); - } - - @Inject - DefaultMetadataSource defaultMetadataSource; - - @Inject - SwitchableMetadataSource switchableMetadataSource; - - @BeforeEach - void setup() throws CycleDetectedInComponentGraphException { - switchableMetadataSource.setDelegate(defaultMetadataSource); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java deleted file mode 100644 index 34c859807cb0..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import javax.inject.Inject; - -import java.util.Arrays; -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; -import org.apache.maven.settings.Mirror; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@PlexusTest -@Deprecated -class MirrorProcessorTest { - @Inject - private DefaultMirrorSelector mirrorSelector; - - @Inject - private ArtifactRepositoryFactory repositorySystem; - - @Test - void testExternalURL() { - assertTrue(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://somehost"))); - assertTrue(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://somehost:9090/somepath"))); - assertTrue(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "ftp://somehost"))); - assertTrue(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://192.168.101.1"))); - assertTrue(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://"))); - // these are local - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://localhost:8080"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://127.0.0.1:9090"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "file://localhost/somepath"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "file://localhost/D:/somepath"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://localhost"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "http://127.0.0.1"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "file:///somepath"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "file://D:/somepath"))); - - // not a proper url so returns false; - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", "192.168.101.1"))); - assertFalse(DefaultMirrorSelector.isExternalRepo(getRepo("foo", ""))); - } - - @Test - void testMirrorLookup() { - Mirror mirrorA = newMirror("a", "a", "http://a"); - Mirror mirrorB = newMirror("b", "b", "http://b"); - - List mirrors = Arrays.asList(mirrorA, mirrorB); - - assertSame(mirrorA, mirrorSelector.getMirror(getRepo("a", "http://a.a"), mirrors)); - - assertSame(mirrorB, mirrorSelector.getMirror(getRepo("b", "http://a.a"), mirrors)); - - assertNull(mirrorSelector.getMirror(getRepo("c", "http://c.c"), mirrors)); - } - - @Test - void testMirrorWildcardLookup() { - Mirror mirrorA = newMirror("a", "a", "http://a"); - Mirror mirrorB = newMirror("b", "b", "http://b"); - Mirror mirrorC = newMirror("c", "*", "http://wildcard"); - - List mirrors = Arrays.asList(mirrorA, mirrorB, mirrorC); - - assertSame(mirrorA, mirrorSelector.getMirror(getRepo("a", "http://a.a"), mirrors)); - - assertSame(mirrorB, mirrorSelector.getMirror(getRepo("b", "http://a.a"), mirrors)); - - assertSame(mirrorC, mirrorSelector.getMirror(getRepo("c", "http://c.c"), mirrors)); - } - - @Test - void testMirrorStopOnFirstMatch() { - // exact matches win first - Mirror mirrorA2 = newMirror("a2", "a,b", "http://a2"); - Mirror mirrorA = newMirror("a", "a", "http://a"); - // make sure repeated entries are skipped - Mirror mirrorA3 = newMirror("a", "a", "http://a3"); - - Mirror mirrorB = newMirror("b", "b", "http://b"); - Mirror mirrorC = newMirror("c", "d,e", "http://de"); - Mirror mirrorC2 = newMirror("c", "*", "http://wildcard"); - Mirror mirrorC3 = newMirror("c", "e,f", "http://ef"); - - List mirrors = Arrays.asList(mirrorA2, mirrorA, mirrorA3, mirrorB, mirrorC, mirrorC2, mirrorC3); - - assertSame(mirrorA, mirrorSelector.getMirror(getRepo("a", "http://a.a"), mirrors)); - - assertSame(mirrorB, mirrorSelector.getMirror(getRepo("b", "http://a.a"), mirrors)); - - assertSame(mirrorC2, mirrorSelector.getMirror(getRepo("c", "http://c.c"), mirrors)); - - assertSame(mirrorC, mirrorSelector.getMirror(getRepo("d", "http://d"), mirrors)); - - assertSame(mirrorC, mirrorSelector.getMirror(getRepo("e", "http://e"), mirrors)); - - assertSame(mirrorC2, mirrorSelector.getMirror(getRepo("f", "http://f"), mirrors)); - } - - @Test - void testPatterns() { - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*,")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), ",*,")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*,")); - - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "a")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "a,")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), ",a,")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "a,")); - - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("b"), "a")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("b"), "a,")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("b"), ",a")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("b"), ",a,")); - - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "a,b")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("b"), "a,b")); - - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("c"), "a,b")); - - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*,b")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a"), "*,!b")); - - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("a"), "*,!a")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("a"), "!a,*")); - - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("c"), "*,!a")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("c"), "!a,*")); - - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("c"), "!a,!c")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("d"), "!a,!c*")); - } - - @Test - void testPatternsWithExternal() { - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "*")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "external:*")); - - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "external:*,a")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "external:*,!a")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "a,external:*")); - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("a", "http://localhost"), "!a,external:*")); - - assertFalse(DefaultMirrorSelector.matchPattern(getRepo("c", "http://localhost"), "!a,external:*")); - assertTrue(DefaultMirrorSelector.matchPattern(getRepo("c", "http://somehost"), "!a,external:*")); - } - - @Test - void testLayoutPattern() { - assertTrue(DefaultMirrorSelector.matchesLayout("default", null)); - assertTrue(DefaultMirrorSelector.matchesLayout("default", "")); - assertTrue(DefaultMirrorSelector.matchesLayout("default", "*")); - - assertTrue(DefaultMirrorSelector.matchesLayout("default", "default")); - assertFalse(DefaultMirrorSelector.matchesLayout("default", "legacy")); - - assertTrue(DefaultMirrorSelector.matchesLayout("default", "legacy,default")); - assertTrue(DefaultMirrorSelector.matchesLayout("default", "default,legacy")); - - assertFalse(DefaultMirrorSelector.matchesLayout("default", "legacy,!default")); - assertFalse(DefaultMirrorSelector.matchesLayout("default", "!default,legacy")); - - assertFalse(DefaultMirrorSelector.matchesLayout("default", "*,!default")); - assertFalse(DefaultMirrorSelector.matchesLayout("default", "!default,*")); - } - - @Test - void testMirrorLayoutConsideredForMatching() { - ArtifactRepository repo = getRepo("a"); - - Mirror mirrorA = newMirror("a", "a", null, "http://a"); - Mirror mirrorB = newMirror("b", "a", "p2", "http://b"); - - Mirror mirrorC = newMirror("c", "*", null, "http://c"); - Mirror mirrorD = newMirror("d", "*", "p2", "http://d"); - - assertSame(mirrorA, mirrorSelector.getMirror(repo, Arrays.asList(mirrorA))); - assertNull(mirrorSelector.getMirror(repo, Arrays.asList(mirrorB))); - - assertSame(mirrorC, mirrorSelector.getMirror(repo, Arrays.asList(mirrorC))); - assertNull(mirrorSelector.getMirror(repo, Arrays.asList(mirrorD))); - } - - /** - * Build an ArtifactRepository object. - * - * @param id - * @param url - * @return - */ - private ArtifactRepository getRepo(String id, String url) { - return repositorySystem.createArtifactRepository(id, url, new DefaultRepositoryLayout(), null, null); - } - - /** - * Build an ArtifactRepository object. - * - * @param id - * @return - */ - private ArtifactRepository getRepo(String id) { - return getRepo(id, "http://something"); - } - - private Mirror newMirror(String id, String mirrorOf, String url) { - return newMirror(id, mirrorOf, null, url); - } - - private Mirror newMirror(String id, String mirrorOf, String layouts, String url) { - Mirror mirror = new Mirror(); - - mirror.setId(id); - mirror.setMirrorOf(mirrorOf); - mirror.setMirrorOfLayouts(layouts); - mirror.setUrl(url); - - return mirror; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/TestArtifactHandler.java b/maven-compat/src/test/java/org/apache/maven/repository/TestArtifactHandler.java deleted file mode 100644 index f42bbaa96747..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/TestArtifactHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import org.apache.maven.artifact.handler.ArtifactHandler; - -/** - * Assists unit testing. - * - */ -@Deprecated -class TestArtifactHandler implements ArtifactHandler { - - private String type; - - private String extension; - - public TestArtifactHandler(String type) { - this(type, type); - } - - public TestArtifactHandler(String type, String extension) { - this.type = type; - this.extension = extension; - } - - @Override - public String getClassifier() { - return null; - } - - @Override - public String getDirectory() { - return getPackaging() + "s"; - } - - @Override - public String getExtension() { - return extension; - } - - @Override - public String getLanguage() { - return "java"; - } - - @Override - public String getPackaging() { - return type; - } - - @Override - @Deprecated - public boolean isAddedToClasspath() { - return true; - } - - @Override - public boolean isIncludesDependencies() { - return false; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/TestRepositorySystem.java b/maven-compat/src/test/java/org/apache/maven/repository/TestRepositorySystem.java deleted file mode 100644 index 3921e20704e7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/TestRepositorySystem.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.apache.maven.api.model.Model; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DefaultArtifact; -import org.apache.maven.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.MavenArtifactRepository; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.bridge.MavenRepositorySystem; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.Plugin; -import org.apache.maven.model.Repository; -import org.apache.maven.model.io.ModelReader; -import org.apache.maven.project.artifact.ArtifactWithDependencies; -import org.apache.maven.settings.Mirror; -import org.apache.maven.settings.Proxy; -import org.apache.maven.settings.Server; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.sisu.Priority; - -/** - */ -@Named -@Singleton -@Priority(10) -@Deprecated -public class TestRepositorySystem implements RepositorySystem { - - private final ModelReader modelReader; - - private final ArtifactFactory artifactFactory; - - public TestRepositorySystem() { - this(null, null); - } - - @Inject - public TestRepositorySystem(ModelReader modelReader, ArtifactFactory artifactFactory) { - this.modelReader = modelReader; - this.artifactFactory = artifactFactory; - } - - public ArtifactRepository buildArtifactRepository(Repository repository) throws InvalidRepositoryException { - return new MavenArtifactRepository( - repository.getId(), - repository.getUrl(), - new DefaultRepositoryLayout(), - new ArtifactRepositoryPolicy(), - new ArtifactRepositoryPolicy()); - } - - public Artifact createArtifact(String groupId, String artifactId, String version, String packaging) { - return createArtifact(groupId, artifactId, version, null, packaging); - } - - public Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) { - return new DefaultArtifact(groupId, artifactId, version, scope, type, null, new TestArtifactHandler(type)); - } - - public ArtifactRepository createArtifactRepository( - String id, - String url, - ArtifactRepositoryLayout repositoryLayout, - ArtifactRepositoryPolicy snapshots, - ArtifactRepositoryPolicy releases) { - return new MavenArtifactRepository(id, url, repositoryLayout, snapshots, releases); - } - - public Artifact createArtifactWithClassifier( - String groupId, String artifactId, String version, String type, String classifier) { - return new DefaultArtifact(groupId, artifactId, version, null, type, classifier, new TestArtifactHandler(type)); - } - - public ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException { - return createLocalRepository( - new File(System.getProperty("basedir", "."), "target/local-repo").getAbsoluteFile()); - } - - public ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException { - return new MavenArtifactRepository( - DEFAULT_REMOTE_REPO_ID, - "file://" - + new File(System.getProperty("basedir", "."), "src/test/remote-repo") - .getAbsoluteFile() - .toURI() - .getPath(), - new DefaultRepositoryLayout(), - new ArtifactRepositoryPolicy(), - new ArtifactRepositoryPolicy()); - } - - public Artifact createDependencyArtifact(Dependency dependency) { - Artifact artifact = new DefaultArtifact( - dependency.getGroupId(), - dependency.getArtifactId(), - dependency.getVersion(), - dependency.getScope(), - dependency.getType(), - dependency.getClassifier(), - new TestArtifactHandler(dependency.getType())); - - if (Artifact.SCOPE_SYSTEM.equals(dependency.getScope())) { - artifact.setFile(new File(dependency.getSystemPath())); - artifact.setResolved(true); - } - - return artifact; - } - - public ArtifactRepository createLocalRepository(File localRepository) throws InvalidRepositoryException { - return new MavenArtifactRepository( - MavenRepositorySystem.DEFAULT_LOCAL_REPO_ID, - "file://" + localRepository.toURI().getPath(), - new DefaultRepositoryLayout(), - new ArtifactRepositoryPolicy(), - new ArtifactRepositoryPolicy()); - } - - public Artifact createPluginArtifact(Plugin plugin) { - VersionRange versionRange; - try { - String version = plugin.getVersion(); - if (version == null || version.isEmpty()) { - version = "RELEASE"; - } - versionRange = VersionRange.createFromVersionSpec(version); - } catch (InvalidVersionSpecificationException e) { - return null; - } - - return artifactFactory.createPluginArtifact(plugin.getGroupId(), plugin.getArtifactId(), versionRange); - } - - public Artifact createProjectArtifact(String groupId, String artifactId, String version) { - return createArtifact(groupId, artifactId, version, "pom"); - } - - public List getEffectiveRepositories(List repositories) { - return repositories; - } - - public Mirror getMirror(ArtifactRepository repository, List mirrors) { - return null; - } - - public void injectAuthentication(List repositories, List servers) {} - - public void injectMirror(List repositories, List mirrors) {} - - public void injectProxy(List repositories, List proxies) {} - - public void publish( - ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException { - // TODO Auto-generated method stub - - } - - public ArtifactResolutionResult resolve(ArtifactResolutionRequest request) { - ArtifactResolutionResult result = new ArtifactResolutionResult(); - - if (request.isResolveRoot()) { - try { - resolve(request.getArtifact(), request); - result.addArtifact(request.getArtifact()); - } catch (IOException e) { - result.addMissingArtifact(request.getArtifact()); - } - } - - if (request.isResolveTransitively()) { - Map artifacts = new LinkedHashMap<>(); - - if (request.getArtifactDependencies() != null) { - for (Artifact artifact : request.getArtifactDependencies()) { - artifacts.put(artifact.getDependencyConflictId(), artifact); - } - } - - List dependencies = new ArrayList<>(); - if (request.getArtifact() instanceof ArtifactWithDependencies) { - dependencies = ((ArtifactWithDependencies) request.getArtifact()).getDependencies(); - } else { - Artifact pomArtifact = createProjectArtifact( - request.getArtifact().getGroupId(), - request.getArtifact().getArtifactId(), - request.getArtifact().getVersion()); - File pomFile = new File( - request.getLocalRepository().getBasedir(), - request.getLocalRepository().pathOf(pomArtifact)); - - try { - Model model = modelReader.read(pomFile, null).getDelegate(); - - dependencies = Dependency.dependencyToApiV3(model.getDependencies()); - } catch (IOException e) { - e.printStackTrace(); - } - } - - for (Dependency dependency : dependencies) { - Artifact artifact = createDependencyArtifact(dependency); - if (!artifacts.containsKey(artifact.getDependencyConflictId())) { - artifacts.put(artifact.getDependencyConflictId(), artifact); - } - } - - for (Artifact artifact : artifacts.values()) { - try { - resolve(artifact, request); - result.addArtifact(artifact); - } catch (IOException e) { - result.addMissingArtifact(artifact); - } - } - } - - return result; - } - - private void resolve(Artifact artifact, ArtifactResolutionRequest request) throws IOException { - if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) { - return; - } - - ArtifactRepository localRepo = request.getLocalRepository(); - - File localFile = new File(localRepo.getBasedir(), localRepo.pathOf(artifact)); - - artifact.setFile(localFile); - - if (!localFile.exists()) { - if (request.getRemoteRepositories().isEmpty()) { - throw new IOException(localFile + " does not exist and no remote repositories are configured"); - } - - ArtifactRepository remoteRepo = request.getRemoteRepositories().get(0); - - File remoteFile = new File(remoteRepo.getBasedir(), remoteRepo.pathOf(artifact)); - - Files.createDirectories(localFile.toPath().getParent()); - Files.copy(remoteFile.toPath(), localFile.toPath()); - } - - artifact.setResolved(true); - } - - public void retrieve( - ArtifactRepository repository, - File destination, - String remotePath, - ArtifactTransferListener transferListener) - throws ArtifactTransferFailedException, ArtifactDoesNotExistException { - // TODO Auto-generated method stub - - } - - public void injectMirror(RepositorySystemSession session, List repositories) {} - - public void injectProxy(RepositorySystemSession session, List repositories) {} - - public void injectAuthentication(RepositorySystemSession session, List repositories) {} -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java deleted file mode 100644 index e06318c1db31..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Inject; - -import java.io.File; - -import org.apache.maven.artifact.AbstractArtifactComponentTestCase; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; -import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.logging.console.ConsoleLogger; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@Deprecated -class DefaultUpdateCheckManagerTest extends AbstractArtifactComponentTestCase { - - @Inject - private ArtifactFactory artifactFactory; - - DefaultUpdateCheckManager updateCheckManager; - - @Override - protected String component() { - return "updateCheckManager"; - } - - @BeforeEach - @Override - public void setUp() throws Exception { - super.setUp(); - - updateCheckManager = new DefaultUpdateCheckManager(new ConsoleLogger(Logger.LEVEL_DEBUG, "test")); - } - - @Test - void testArtifact() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createArtifact("a", "0.0.1-SNAPSHOT"); - File file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - file.delete(); - a.setFile(file); - - File touchFile = updateCheckManager.getTouchfile(a); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - file.getParentFile().mkdirs(); - file.createNewFile(); - updateCheckManager.touch(a, remoteRepository, null); - - assertFalse(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - assertNull( - updateCheckManager.readLastUpdated(touchFile, updateCheckManager.getRepositoryKey(remoteRepository))); - - assertFalse(updateCheckManager.getTouchfile(a).exists()); - } - - @Test - void testMissingArtifact() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createArtifact("a", "0.0.1-SNAPSHOT"); - File file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - file.delete(); - a.setFile(file); - - File touchFile = updateCheckManager.getTouchfile(a); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - updateCheckManager.touch(a, remoteRepository, null); - - assertFalse(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - assertFalse(file.exists()); - assertNotNull( - updateCheckManager.readLastUpdated(touchFile, updateCheckManager.getRepositoryKey(remoteRepository))); - } - - @Test - void testPom() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createArtifact("a", "0.0.1", "pom"); - File file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - file.delete(); - a.setFile(file); - - File touchFile = updateCheckManager.getTouchfile(a); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - file.getParentFile().mkdirs(); - file.createNewFile(); - updateCheckManager.touch(a, remoteRepository, null); - - assertFalse(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - assertNull( - updateCheckManager.readLastUpdated(touchFile, updateCheckManager.getRepositoryKey(remoteRepository))); - - assertFalse(updateCheckManager.getTouchfile(a).exists()); - } - - @Test - void testMissingPom() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createArtifact("a", "0.0.1", "pom"); - File file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - file.delete(); - a.setFile(file); - - File touchFile = updateCheckManager.getTouchfile(a); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - updateCheckManager.touch(a, remoteRepository, null); - - assertFalse(updateCheckManager.isUpdateRequired(a, remoteRepository)); - - assertFalse(file.exists()); - assertNotNull( - updateCheckManager.readLastUpdated(touchFile, updateCheckManager.getRepositoryKey(remoteRepository))); - } - - @Test - void testMetadata() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createRemoteArtifact("a", "0.0.1-SNAPSHOT"); - RepositoryMetadata metadata = new ArtifactRepositoryMetadata(a); - - File file = new File( - localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata(metadata, localRepository)); - file.delete(); - - File touchFile = updateCheckManager.getTouchfile(metadata, file); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(metadata, remoteRepository, file)); - - file.getParentFile().mkdirs(); - file.createNewFile(); - updateCheckManager.touch(metadata, remoteRepository, file); - - assertFalse(updateCheckManager.isUpdateRequired(metadata, remoteRepository, file)); - - assertNotNull(updateCheckManager.readLastUpdated( - touchFile, updateCheckManager.getMetadataKey(remoteRepository, file))); - } - - @Test - void testMissingMetadata() throws Exception { - ArtifactRepository remoteRepository = remoteRepository(); - - ArtifactRepository localRepository = localRepository(); - - Artifact a = createRemoteArtifact("a", "0.0.1-SNAPSHOT"); - RepositoryMetadata metadata = new ArtifactRepositoryMetadata(a); - - File file = new File( - localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata(metadata, localRepository)); - file.delete(); - - File touchFile = updateCheckManager.getTouchfile(metadata, file); - touchFile.delete(); - - assertTrue(updateCheckManager.isUpdateRequired(metadata, remoteRepository, file)); - - updateCheckManager.touch(metadata, remoteRepository, file); - - assertFalse(updateCheckManager.isUpdateRequired(metadata, remoteRepository, file)); - - assertNotNull(updateCheckManager.readLastUpdated( - touchFile, updateCheckManager.getMetadataKey(remoteRepository, file))); - } - - @Test - void testArtifactTouchFileName() throws Exception { - ArtifactRepository localRepository = localRepository(); - - Artifact a = artifactFactory.createArtifactWithClassifier("groupId", "a", "0.0.1-SNAPSHOT", "jar", null); - File file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - a.setFile(file); - - assertEquals( - "a-0.0.1-SNAPSHOT.jar.lastUpdated", - updateCheckManager.getTouchfile(a).getName()); - - a = artifactFactory.createArtifactWithClassifier("groupId", "a", "0.0.1-SNAPSHOT", "jar", "classifier"); - file = new File(localRepository.getBasedir(), localRepository.pathOf(a)); - a.setFile(file); - - assertEquals( - "a-0.0.1-SNAPSHOT-classifier.jar.lastUpdated", - updateCheckManager.getTouchfile(a).getName()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java deleted file mode 100644 index 926bc219eb90..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Inject; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.DefaultArtifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadata; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.UnsupportedProtocolException; -import org.apache.maven.wagon.Wagon; -import org.apache.maven.wagon.events.TransferEvent; -import org.apache.maven.wagon.events.TransferListener; -import org.apache.maven.wagon.observers.AbstractTransferListener; -import org.apache.maven.wagon.observers.Debug; -import org.codehaus.plexus.testing.PlexusTest; -import org.codehaus.plexus.util.FileUtils; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static org.codehaus.plexus.testing.PlexusExtension.getTestFile; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - */ -@PlexusTest -@Deprecated -class DefaultWagonManagerTest { - @Inject - private WagonManager wagonManager; - - private final TransferListener transferListener = new Debug(); - - @Inject - private ArtifactFactory artifactFactory; - - @Inject - private ArtifactRepositoryFactory artifactRepositoryFactory; - - @Test - void testUnnecessaryRepositoryLookup() throws Exception { - Artifact artifact = createTestPomArtifact("target/test-data/get-missing-pom"); - - List repos = new ArrayList<>(); - repos.add(artifactRepositoryFactory.createArtifactRepository( - "repo1", "string://url1", new ArtifactRepositoryLayoutStub(), null, null)); - repos.add(artifactRepositoryFactory.createArtifactRepository( - "repo2", "string://url2", new ArtifactRepositoryLayoutStub(), null, null)); - - StringWagon wagon = (StringWagon) wagonManager.getWagon("string"); - wagon.addExpectedContent(repos.get(0).getLayout().pathOf(artifact), "expected"); - wagon.addExpectedContent( - repos.get(0).getLayout().pathOf(artifact) + ".md5", "cd26d9e10ce691cc69aa2b90dcebbdac"); - wagon.addExpectedContent(repos.get(1).getLayout().pathOf(artifact), "expected"); - wagon.addExpectedContent( - repos.get(1).getLayout().pathOf(artifact) + ".md5", "cd26d9e10ce691cc69aa2b90dcebbdac"); - - class TransferListener extends AbstractTransferListener { - public List events = new ArrayList<>(); - - @Override - public void transferInitiated(TransferEvent transferEvent) { - events.add(transferEvent); - } - } - - TransferListener listener = new TransferListener(); - wagonManager.getArtifact(artifact, repos, listener, false); - assertEquals(1, listener.events.size()); - } - - @Test - void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolException, IOException { - Artifact artifact = createTestArtifact("target/test-data/get-missing-jar", "jar"); - - ArtifactRepository repo = createStringRepo(); - - assertThrows(ResourceDoesNotExistException.class, () -> wagonManager.getArtifact(artifact, repo, null, false)); - - assertFalse(artifact.getFile().exists()); - } - - @Test - void testGetMissingJarForced() throws TransferFailedException, UnsupportedProtocolException, IOException { - Artifact artifact = createTestArtifact("target/test-data/get-missing-jar", "jar"); - - ArtifactRepository repo = createStringRepo(); - - assertThrows(ResourceDoesNotExistException.class, () -> wagonManager.getArtifact(artifact, repo, null, true)); - - assertFalse(artifact.getFile().exists()); - } - - @Test - void testGetRemoteJar() - throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException { - Artifact artifact = createTestArtifact("target/test-data/get-remote-jar", "jar"); - - ArtifactRepository repo = createStringRepo(); - - StringWagon wagon = (StringWagon) wagonManager.getWagon("string"); - wagon.addExpectedContent(repo.getLayout().pathOf(artifact), "expected"); - wagon.addExpectedContent(repo.getLayout().pathOf(artifact) + ".md5", "cd26d9e10ce691cc69aa2b90dcebbdac"); - - wagonManager.getArtifact(artifact, repo, null, false); - - assertTrue(artifact.getFile().exists()); - assertEquals("expected", FileUtils.fileRead(artifact.getFile(), "UTF-8")); - } - - private Artifact createTestPomArtifact(String directory) throws IOException { - File testData = getTestFile(directory); - FileUtils.deleteDirectory(testData); - testData.mkdirs(); - - Artifact artifact = artifactFactory.createProjectArtifact("test", "test", "1.0"); - artifact.setFile(new File(testData, "test-1.0.pom")); - assertFalse(artifact.getFile().exists()); - return artifact; - } - - private Artifact createTestArtifact(String directory, String type) throws IOException { - return createTestArtifact(directory, "1.0", type); - } - - private Artifact createTestArtifact(String directory, String version, String type) throws IOException { - File testData = getTestFile(directory); - FileUtils.deleteDirectory(testData); - testData.mkdirs(); - - Artifact artifact = artifactFactory.createBuildArtifact("test", "test", version, type); - artifact.setFile(new File( - testData, - "test-" + version + "." + artifact.getArtifactHandler().getExtension())); - assertFalse(artifact.getFile().exists()); - return artifact; - } - - private ArtifactRepository createStringRepo() { - return artifactRepositoryFactory.createArtifactRepository( - "id", "string://url", new ArtifactRepositoryLayoutStub(), null, null); - } - - /** - * Build an ArtifactRepository object. - * - * @param id - * @param url - * @return - */ - private ArtifactRepository getRepo(String id, String url) { - return artifactRepositoryFactory.createArtifactRepository(id, url, new DefaultRepositoryLayout(), null, null); - } - - /** - * Build an ArtifactRepository object. - * - * @param id - * @return - */ - private ArtifactRepository getRepo(String id) { - return getRepo(id, "http://something"); - } - - @Test - void testDefaultWagonManager() throws Exception { - assertWagon("a"); - - assertWagon("b"); - - assertWagon("c"); - - assertWagon("string"); - - assertThrows(UnsupportedProtocolException.class, () -> assertWagon("d")); - } - - /** - * Check that transfer listeners are properly removed after getArtifact and putArtifact - */ - @Test - void testWagonTransferListenerRemovedAfterGetArtifactAndPutArtifact() throws Exception { - Artifact artifact = createTestArtifact("target/test-data/transfer-listener", "jar"); - ArtifactRepository repo = createStringRepo(); - StringWagon wagon = (StringWagon) wagonManager.getWagon("string"); - wagon.addExpectedContent(repo.getLayout().pathOf(artifact), "expected"); - wagon.addExpectedContent(repo.getLayout().pathOf(artifact) + ".md5", "cd26d9e10ce691cc69aa2b90dcebbdac"); - - /* getArtifact */ - assertFalse( - wagon.getTransferEventSupport().hasTransferListener(transferListener), - "Transfer listener is registered before test"); - wagonManager.getArtifact(artifact, repo, transferListener, false); - assertFalse( - wagon.getTransferEventSupport().hasTransferListener(transferListener), - "Transfer listener still registered after getArtifact"); - - /* putArtifact */ - File sampleFile = getTestFile("target/test-file"); - FileUtils.fileWrite(sampleFile.getAbsolutePath(), "sample file"); - - assertFalse( - wagon.getTransferEventSupport().hasTransferListener(transferListener), - "Transfer listener is registered before test"); - wagonManager.putArtifact(sampleFile, artifact, repo, transferListener); - assertFalse( - wagon.getTransferEventSupport().hasTransferListener(transferListener), - "Transfer listener still registered after putArtifact"); - } - - /** - * Checks the verification of checksums. - */ - @Disabled - @Test - void testChecksumVerification() throws Exception { - ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( - true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL); - - ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( - "id", "string://url", new ArtifactRepositoryLayoutStub(), policy, policy); - - Artifact artifact = new DefaultArtifact( - "sample.group", - "sample-art", - VersionRange.createFromVersion("1.0"), - "scope", - "jar", - "classifier", - null); - artifact.setFile(getTestFile("target/sample-art")); - - StringWagon wagon = (StringWagon) wagonManager.getWagon("string"); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "lower-case-checksum"); - wagon.addExpectedContent("path.sha1", "2a25dc564a3b34f68237fc849066cbc7bb7a36a1"); - wagonManager.getArtifact(artifact, repo, null, false); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "upper-case-checksum"); - wagon.addExpectedContent("path.sha1", "B7BB97D7D0B9244398D9B47296907F73313663E6"); - wagonManager.getArtifact(artifact, repo, null, false); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "expected-failure"); - wagon.addExpectedContent("path.sha1", "b7bb97d7d0b9244398d9b47296907f73313663e6"); - assertThrows( - ChecksumFailedException.class, - () -> wagonManager.getArtifact(artifact, repo, null, false), - "Checksum verification did not fail"); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "lower-case-checksum"); - wagon.addExpectedContent("path.md5", "50b2cf50a103a965efac62b983035cac"); - wagonManager.getArtifact(artifact, repo, null, false); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "upper-case-checksum"); - wagon.addExpectedContent("path.md5", "842F568FCCFEB7E534DC72133D42FFDC"); - wagonManager.getArtifact(artifact, repo, null, false); - - wagon.clearExpectedContent(); - wagon.addExpectedContent("path", "expected-failure"); - wagon.addExpectedContent("path.md5", "b7bb97d7d0b9244398d9b47296907f73313663e6"); - assertThrows( - ChecksumFailedException.class, - () -> wagonManager.getArtifact(artifact, repo, null, false), - "Checksum verification did not fail"); - } - - @Test - void testPerLookupInstantiation() throws Exception { - String protocol = "perlookup"; - - Wagon one = wagonManager.getWagon(protocol); - Wagon two = wagonManager.getWagon(protocol); - - assertNotSame(one, two); - } - - private void assertWagon(String protocol) throws Exception { - Wagon wagon = wagonManager.getWagon(protocol); - - assertNotNull(wagon, "Check wagon, protocol=" + protocol); - } - - private final class ArtifactRepositoryLayoutStub implements ArtifactRepositoryLayout { - public String getId() { - return "test"; - } - - public String pathOfRemoteRepositoryMetadata(ArtifactMetadata metadata) { - return "path"; - } - - public String pathOfLocalRepositoryMetadata(ArtifactMetadata metadata, ArtifactRepository repository) { - return "path"; - } - - public String pathOf(Artifact artifact) { - return "path"; - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java deleted file mode 100644 index 82554ea83ac7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Inject; - -import java.io.File; -import java.util.Arrays; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.Authentication; -import org.apache.maven.settings.Server; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Tests {@link LegacyRepositorySystem}. - * - */ -@PlexusTest -@Deprecated -class LegacyRepositorySystemTest { - @Inject - private LegacyRepositorySystem repositorySystem; - - @Test - void testThatLocalRepositoryWithSpacesIsProperlyHandled() throws Exception { - File basedir = new File("target/spacy path").getAbsoluteFile(); - ArtifactRepository repo = repositorySystem.createLocalRepository(basedir); - assertEquals(basedir, new File(repo.getBasedir())); - } - - @Test - void testAuthenticationHandling() { - Server server = new Server(); - server.setId("repository"); - server.setUsername("jason"); - server.setPassword("abc123"); - - ArtifactRepository repository = - repositorySystem.createArtifactRepository("repository", "http://foo", null, null, null); - repositorySystem.injectAuthentication(Arrays.asList(repository), Arrays.asList(server)); - Authentication authentication = repository.getAuthentication(); - assertNotNull(authentication); - assertEquals("jason", authentication.getUsername()); - assertEquals("abc123", authentication.getPassword()); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java deleted file mode 100644 index 9d4b5d3e0d30..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; - -/** - * Wagon with per-lookup instantiation strategy. - */ -@Named("perlookup") -public class PerLookupWagon extends WagonMock { - - public String[] getSupportedProtocols() { - return new String[] {"perlookup"}; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java deleted file mode 100644 index 6e32a115dc55..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; -import javax.inject.Singleton; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import org.apache.maven.wagon.ConnectionException; -import org.apache.maven.wagon.InputData; -import org.apache.maven.wagon.OutputData; -import org.apache.maven.wagon.ResourceDoesNotExistException; -import org.apache.maven.wagon.StreamWagon; -import org.apache.maven.wagon.TransferFailedException; -import org.apache.maven.wagon.authentication.AuthenticationException; -import org.apache.maven.wagon.authorization.AuthorizationException; -import org.apache.maven.wagon.resource.Resource; - -@Named("string") -@Singleton -public class StringWagon extends StreamWagon { - private Map expectedContent = new HashMap<>(); - - public void addExpectedContent(String resourceName, String expectedContent) { - this.expectedContent.put(resourceName, expectedContent); - } - - public String[] getSupportedProtocols() { - return new String[] {"string"}; - } - - @Override - public void closeConnection() throws ConnectionException {} - - @Override - public void fillInputData(InputData inputData) - throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException { - Resource resource = inputData.getResource(); - - String content = expectedContent.get(resource.getName()); - - if (content != null) { - resource.setContentLength(content.length()); - resource.setLastModified(System.currentTimeMillis()); - - inputData.setInputStream(new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))); - } else { - throw new ResourceDoesNotExistException("No content provided for " + resource.getName()); - } - } - - @Override - public void fillOutputData(OutputData outputData) throws TransferFailedException { - outputData.setOutputStream(new ByteArrayOutputStream()); - } - - @Override - protected void openConnectionInternal() throws ConnectionException, AuthenticationException {} - - public void clearExpectedContent() { - expectedContent.clear(); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java deleted file mode 100644 index f84fd328e44f..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; -import javax.inject.Singleton; - -/** - * Wagon for testing, for protocol a - * - */ -@Named("a") -@Singleton -public class WagonA extends WagonMock { - public String[] getSupportedProtocols() { - return new String[] {"a"}; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java deleted file mode 100644 index 5c8772a389e8..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; -import javax.inject.Singleton; - -/** - * Wagon for testing, for protocols b1 and b2 - * - */ -@Named("b") -@Singleton -public class WagonB extends WagonMock { - public String[] getSupportedProtocols() { - return new String[] {"b1", "b2"}; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java deleted file mode 100644 index 2af580fbd935..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import javax.inject.Named; -import javax.inject.Singleton; - -/** - * Wagon for testing, for protocol c - * - */ -@Named("c") -@Singleton -public class WagonC extends WagonMock { - public String[] getSupportedProtocols() { - return new String[] {"c"}; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java deleted file mode 100644 index c0abd118cc32..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy; - -import org.apache.maven.wagon.providers.file.FileWagon; - -/** - * Mock of a Wagon for testing - * - */ -public class WagonMock extends FileWagon { - - /** - * A field that can be configured in the Wagon - * - * @component.configuration default="configurableField" - */ - private String configurableField = null; - - public void setConfigurableField(String configurableField) { - this.configurableField = configurableField; - } - - public String getConfigurableField() { - return configurableField; - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java deleted file mode 100644 index bf78aa73e31f..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java +++ /dev/null @@ -1,932 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver; - -import javax.inject.Inject; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.artifact.metadata.ArtifactMetadataSource; -import org.apache.maven.artifact.metadata.ResolutionGroup; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.CyclicDependencyException; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter; -import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Test the default artifact collector. - * - */ -@PlexusTest -@Deprecated -class DefaultArtifactCollectorTest { - @Inject - private LegacyArtifactCollector artifactCollector; - - @Inject - private ArtifactFactory artifactFactory; - - private ArtifactSpec projectArtifact; - - private Source source; - - private static final String GROUP_ID = "test"; - - @BeforeEach - void setUp() throws Exception { - source = new Source(); - - projectArtifact = createArtifactSpec("project", "1.0", null); - } - - @Test - @Disabled("works, but we don't fail on cycles presently") - void testCircularDependencyNotIncludingCurrentProject() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - b.addDependency("a", "1.0"); - assertThrows( - CyclicDependencyException.class, - () -> collect(a), - "Should have failed on cyclic dependency not involving project"); - } - - @Test - @Disabled("works, but we don't fail on cycles presently") - void testCircularDependencyIncludingCurrentProject() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - b.addDependency("project", "1.0"); - assertThrows( - CyclicDependencyException.class, - () -> collect(a), - "Should have failed on cyclic dependency not involving project"); - } - - @Test - void testResolveWithFilter() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c = a.addDependency("c", "3.0"); - - b.addDependency("c", "2.0"); - ArtifactSpec d = b.addDependency("d", "4.0"); - - ArtifactResolutionResult res = collect(a); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact, d.artifact}), - res.getArtifacts(), - "Check artifact list"); - - ArtifactFilter filter = new ExclusionSetFilter(new String[] {"b"}); - res = collect(a, filter); - assertEquals(createSet(new Object[] {a.artifact, c.artifact}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testResolveCorrectDependenciesWhenDifferentDependenciesOnNearest() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c2 = b.addDependency("c", "2.0"); - c2.addDependency("d", "1.0"); - - ArtifactSpec e = createArtifactSpec("e", "1.0"); - ArtifactSpec c1 = e.addDependency("c", "1.0"); - ArtifactSpec f = c1.addDependency("f", "1.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, e.artifact})); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, e.artifact, c1.artifact, f.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("1.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - @Disabled - void testResolveCorrectDependenciesWhenDifferentDependenciesOnNewest() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - // TODO use newest conflict resolver - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c2 = b.addDependency("c", "2.0"); - ArtifactSpec d = c2.addDependency("d", "1.0"); - - ArtifactSpec e = createArtifactSpec("e", "1.0"); - ArtifactSpec c1 = e.addDependency("c", "1.0"); - c1.addDependency("f", "1.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, e.artifact})); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, e.artifact, c2.artifact, d.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("2.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - @Disabled - void testResolveCorrectDependenciesWhenDifferentDependenciesOnNewestVersionReplaced() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - // TODO use newest conflict resolver - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b1 = a.addDependency("b", "1.0"); - ArtifactSpec c = a.addDependency("c", "1.0"); - ArtifactSpec d2 = b1.addDependency("d", "2.0"); - d2.addDependency("h", "1.0"); - ArtifactSpec d1 = c.addDependency("d", "1.0"); - ArtifactSpec b2 = c.addDependency("b", "2.0"); - ArtifactSpec e = b2.addDependency("e", "1.0"); - ArtifactSpec g = d1.addDependency("g", "1.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact})); - Object[] artifacts = new Object[] {a.artifact, c.artifact, d1.artifact, b2.artifact, e.artifact, g.artifact}; - assertEquals(createSet(artifacts), res.getArtifacts(), "Check artifact list"); - assertEquals("1.0", getArtifact("d", res.getArtifacts()).getVersion(), "Check version"); - assertEquals("2.0", getArtifact("b", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveNearestNewestIsNearest() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c = a.addDependency("c", "3.0"); - - b.addDependency("c", "2.0"); - - ArtifactResolutionResult res = collect(a); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("3.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveNearestOldestIsNearest() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c = a.addDependency("c", "2.0"); - - b.addDependency("c", "3.0"); - - ArtifactResolutionResult res = collect(a); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("2.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveLocalNewestIsLocal() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - a.addDependency("b", "2.0"); - ArtifactSpec b = createArtifactSpec("b", "3.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("3.0", getArtifact("b", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveLocalOldestIsLocal() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - a.addDependency("b", "3.0"); - ArtifactSpec b = createArtifactSpec("b", "2.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("2.0", getArtifact("b", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveLocalWithNewerVersionButLesserScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("commons-logging", "1.0"); - a.addDependency("junit", "3.7"); - ArtifactSpec b = createArtifactSpec("junit", "3.8.1", Artifact.SCOPE_TEST); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("3.8.1", getArtifact("junit", res.getArtifacts()).getVersion(), "Check version"); - assertEquals( - Artifact.SCOPE_TEST, getArtifact("junit", res.getArtifacts()).getScope(), "Check artifactScope"); - } - - @Test - void testResolveLocalWithNewerVersionButLesserScopeResolvedFirst() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec b = createArtifactSpec("junit", "3.8.1", Artifact.SCOPE_TEST); - ArtifactSpec a = createArtifactSpec("commons-logging", "1.0"); - a.addDependency("junit", "3.7"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("3.8.1", getArtifact("junit", res.getArtifacts()).getVersion(), "Check version"); - assertEquals( - Artifact.SCOPE_TEST, getArtifact("junit", res.getArtifacts()).getScope(), "Check artifactScope"); - } - - @Test - void testResolveNearestWithRanges() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - ArtifactSpec c = a.addDependency("c", "2.0"); - - b.addDependency("c", "[1.0,3.0]"); - - ArtifactResolutionResult res = collect(a); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("2.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testResolveRangeWithManagedVersion() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "[1.0,3.0]"); - - ArtifactSpec managedB = createArtifactSpec("b", "5.0"); - - ArtifactResolutionResult res = collect(a, managedB.artifact); - assertEquals( - createSet(new Object[] {a.artifact, managedB.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("5.0", getArtifact("b", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testCompatibleRanges() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - a.addDependency("c", "[2.0,2.5]"); - b.addDependency("c", "[1.0,3.0]"); - ArtifactSpec c = createArtifactSpec("c", "2.5"); - - ArtifactResolutionResult res = collect(a); - - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact}), - res.getArtifacts(), - "Check artifact list"); - assertEquals("2.5", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testIncompatibleRanges() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - a.addDependency("c", "[2.4,3.0]"); - - b.addDependency("c", "[1.0,2.0]"); - - ArtifactResolutionResult res = collect(a); - - assertTrue(res.hasVersionRangeViolations()); - } - - @Test - void testUnboundedRangeWhenVersionUnavailable() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = a.addDependency("b", "1.0"); - a.addDependency("c", "[2.0,]"); - b.addDependency("c", "[1.0,]"); - - ArtifactResolutionResult res = collect(a); - - assertTrue(res.hasVersionRangeViolations()); - } - - @Test - void testUnboundedRangeBelowLastRelease() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - createArtifactSpec("c", "1.5"); - ArtifactSpec c = createArtifactSpec("c", "2.0"); - createArtifactSpec("c", "1.1"); - a.addDependency("c", "[1.0,)"); - - ArtifactResolutionResult res = collect(a); - - assertEquals(createSet(new Object[] {a.artifact, c.artifact}), res.getArtifacts(), "Check artifact list"); - assertEquals("2.0", getArtifact("c", res.getArtifacts()).getVersion(), "Check version"); - } - - @Test - void testUnboundedRangeAboveLastRelease() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - createArtifactSpec("c", "2.0"); - a.addDependency("c", "[10.0,)"); - - ArtifactResolutionResult res = collect(a); - - assertTrue(res.hasVersionRangeViolations()); - } - - @Test - void testResolveManagedVersion() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - a.addDependency("b", "3.0", Artifact.SCOPE_RUNTIME); - - Artifact managedVersion = createArtifactSpec("b", "5.0").artifact; - Artifact modifiedB = createArtifactSpec("b", "5.0", Artifact.SCOPE_RUNTIME).artifact; - - ArtifactResolutionResult res = collect(a, managedVersion); - assertEquals(createSet(new Object[] {a.artifact, modifiedB}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testCollectChangesVersionOfOriginatingArtifactIfInDependencyManagementHasDifferentVersion() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - - Artifact artifact = projectArtifact.artifact; - Artifact managedVersion = createArtifactSpec(artifact.getArtifactId(), "2.0").artifact; - - ArtifactResolutionResult result = collect(a, managedVersion); - - assertEquals("1.0", artifact.getVersion(), "collect has modified version in originating artifact"); - - Artifact resolvedArtifact = result.getArtifacts().iterator().next(); - - assertEquals("1.0", resolvedArtifact.getVersion(), "Resolved version don't match original artifact version"); - } - - @Test - void testResolveCompileScopeOverTestScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec c = createArtifactSpec("c", "3.0", Artifact.SCOPE_TEST); - - a.addDependency("c", "2.0", Artifact.SCOPE_COMPILE); - - Artifact modifiedC = createArtifactSpec("c", "3.0", Artifact.SCOPE_COMPILE).artifact; - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, c.artifact})); - assertEquals(createSet(new Object[] {a.artifact, modifiedC}), res.getArtifacts(), "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - // local wins now, and irrelevant if not local as test/provided aren't transitive - // assertEquals( Artifact.SCOPE_COMPILE, artifact.getArtifactScope(), "Check artifactScope" ); - assertEquals(Artifact.SCOPE_TEST, artifact.getScope(), "Check artifactScope"); - } - - @Test - void testResolveRuntimeScopeOverTestScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec c = createArtifactSpec("c", "3.0", Artifact.SCOPE_TEST); - - a.addDependency("c", "2.0", Artifact.SCOPE_RUNTIME); - - Artifact modifiedC = createArtifactSpec("c", "3.0", Artifact.SCOPE_RUNTIME).artifact; - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, c.artifact})); - assertEquals(createSet(new Object[] {a.artifact, modifiedC}), res.getArtifacts(), "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - // local wins now, and irrelevant if not local as test/provided aren't transitive - // assertEquals( Artifact.SCOPE_RUNTIME, artifact.getArtifactScope(), "Check artifactScope" ); - assertEquals(Artifact.SCOPE_TEST, artifact.getScope(), "Check artifactScope"); - } - - @Test - void testResolveCompileScopeOverRuntimeScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec root = createArtifactSpec("root", "1.0"); - ArtifactSpec a = root.addDependency("a", "1.0"); - root.addDependency("c", "3.0", Artifact.SCOPE_RUNTIME); - - a.addDependency("c", "2.0", Artifact.SCOPE_COMPILE); - - Artifact modifiedC = createArtifactSpec("c", "3.0", Artifact.SCOPE_COMPILE).artifact; - - ArtifactResolutionResult res = collect(createSet(new Object[] {root.artifact})); - assertEquals( - createSet(new Object[] {a.artifact, root.artifact, modifiedC}), - res.getArtifacts(), - "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - assertEquals(Artifact.SCOPE_COMPILE, artifact.getScope(), "Check artifactScope"); - } - - @Test - void testResolveCompileScopeOverProvidedScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec c = createArtifactSpec("c", "3.0", Artifact.SCOPE_PROVIDED); - - a.addDependency("c", "2.0", Artifact.SCOPE_COMPILE); - - Artifact modifiedC = createArtifactSpec("c", "3.0", Artifact.SCOPE_COMPILE).artifact; - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, c.artifact})); - assertEquals(createSet(new Object[] {a.artifact, modifiedC}), res.getArtifacts(), "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - // local wins now, and irrelevant if not local as test/provided aren't transitive - // assertEquals( Artifact.SCOPE_COMPILE, artifact.getArtifactScope(), "Check artifactScope" ); - assertEquals(Artifact.SCOPE_PROVIDED, artifact.getScope(), "Check artifactScope"); - } - - @Test - void testResolveRuntimeScopeOverProvidedScope() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec c = createArtifactSpec("c", "3.0", Artifact.SCOPE_PROVIDED); - - a.addDependency("c", "2.0", Artifact.SCOPE_RUNTIME); - - Artifact modifiedC = createArtifactSpec("c", "3.0", Artifact.SCOPE_RUNTIME).artifact; - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, c.artifact})); - assertEquals(createSet(new Object[] {a.artifact, modifiedC}), res.getArtifacts(), "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - // local wins now, and irrelevant if not local as test/provided aren't transitive - // assertEquals( Artifact.SCOPE_RUNTIME, artifact.getArtifactScope(), "Check artifactScope" ); - assertEquals(Artifact.SCOPE_PROVIDED, artifact.getScope(), "Check artifactScope"); - } - - @Test - void testProvidedScopeNotTransitive() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0", Artifact.SCOPE_PROVIDED); - ArtifactSpec b = createArtifactSpec("b", "1.0"); - b.addDependency("c", "3.0", Artifact.SCOPE_PROVIDED); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testOptionalNotTransitive() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = createArtifactSpec("b", "1.0"); - b.addDependency("c", "3.0", true); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testOptionalIncludedAtRoot() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - - ArtifactSpec b = createArtifactSpec("b", "1.0", true); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testScopeUpdate() throws InvalidVersionSpecificationException, ArtifactResolutionException { - /* farthest = compile */ - checkScopeUpdate(Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_COMPILE, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_COMPILE, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_COMPILE, Artifact.SCOPE_TEST, Artifact.SCOPE_COMPILE); - - /* farthest = provided */ - checkScopeUpdate(Artifact.SCOPE_PROVIDED, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED); - checkScopeUpdate(Artifact.SCOPE_PROVIDED, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME); - checkScopeUpdate(Artifact.SCOPE_PROVIDED, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM); - checkScopeUpdate(Artifact.SCOPE_PROVIDED, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST); - - /* farthest = runtime */ - checkScopeUpdate(Artifact.SCOPE_RUNTIME, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_RUNTIME, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_RUNTIME); - checkScopeUpdate(Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME); - checkScopeUpdate(Artifact.SCOPE_RUNTIME, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM); - checkScopeUpdate(Artifact.SCOPE_RUNTIME, Artifact.SCOPE_TEST, Artifact.SCOPE_RUNTIME); - - /* farthest = system */ - checkScopeUpdate(Artifact.SCOPE_SYSTEM, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_SYSTEM, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED); - checkScopeUpdate(Artifact.SCOPE_SYSTEM, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME); - checkScopeUpdate(Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM); - checkScopeUpdate(Artifact.SCOPE_SYSTEM, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST); - - /* farthest = test */ - checkScopeUpdate(Artifact.SCOPE_TEST, Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE); - checkScopeUpdate(Artifact.SCOPE_TEST, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_PROVIDED); - checkScopeUpdate(Artifact.SCOPE_TEST, Artifact.SCOPE_RUNTIME, Artifact.SCOPE_RUNTIME); - checkScopeUpdate(Artifact.SCOPE_TEST, Artifact.SCOPE_SYSTEM, Artifact.SCOPE_SYSTEM); - checkScopeUpdate(Artifact.SCOPE_TEST, Artifact.SCOPE_TEST, Artifact.SCOPE_TEST); - } - - private void checkScopeUpdate(String farthestScope, String nearestScope, String expectedScope) - throws ArtifactResolutionException, InvalidVersionSpecificationException { - checkScopeUpdateDirect(farthestScope, nearestScope, expectedScope); - checkScopeUpdateTransitively(farthestScope, nearestScope, expectedScope); - } - - private void checkScopeUpdateTransitively(String farthestScope, String nearestScope, String expectedScope) - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = createArtifactSpec("b", "1.0", nearestScope); - ArtifactSpec c = createArtifactSpec("c", "1.0"); - a.addDependency(c); - ArtifactSpec dNearest = createArtifactSpec("d", "2.0"); - b.addDependency(dNearest); - ArtifactSpec dFarthest = createArtifactSpec("d", "3.0", farthestScope); - c.addDependency(dFarthest); - - /* system and provided dependencies are not transitive */ - if (!Artifact.SCOPE_SYSTEM.equals(nearestScope) && !Artifact.SCOPE_PROVIDED.equals(nearestScope)) { - checkScopeUpdate(a, b, expectedScope, "2.0"); - } - } - - private void checkScopeUpdateDirect(String farthestScope, String nearestScope, String expectedScope) - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = createArtifactSpec("b", "1.0"); - ArtifactSpec c = createArtifactSpec("c", "1.0"); - a.addDependency(c); - ArtifactSpec dNearest = createArtifactSpec("d", "2.0", nearestScope); - b.addDependency(dNearest); - ArtifactSpec dFarthest = createArtifactSpec("d", "3.0", farthestScope); - c.addDependency(dFarthest); - - checkScopeUpdate(a, b, expectedScope, "2.0"); - } - - private void checkScopeUpdate(ArtifactSpec a, ArtifactSpec b, String expectedScope, String expectedVersion) - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ScopeArtifactFilter filter; - if (Artifact.SCOPE_PROVIDED.equals(expectedScope)) { - filter = new ScopeArtifactFilter(Artifact.SCOPE_COMPILE); - } else if (Artifact.SCOPE_SYSTEM.equals(expectedScope)) { - filter = new ScopeArtifactFilter(Artifact.SCOPE_COMPILE); - } else { - filter = new ScopeArtifactFilter(expectedScope); - } - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact}), filter); - Artifact artifact = getArtifact("d", res.getArtifacts()); - assertNotNull(artifact, "MNG-1895 Dependency was not added to resolution"); - assertEquals(expectedScope, artifact.getScope(), "Check artifactScope"); - assertEquals(expectedVersion, artifact.getVersion(), "Check version"); - - ArtifactSpec d = createArtifactSpec("d", "1.0"); - res = collect(createSet(new Object[] {a.artifact, b.artifact, d.artifact}), filter); - artifact = getArtifact("d", res.getArtifacts()); - assertNotNull(artifact, "MNG-1895 Dependency was not added to resolution"); - assertEquals(d.artifact.getScope(), artifact.getScope(), "Check artifactScope"); - assertEquals("1.0", artifact.getVersion(), "Check version"); - } - - @Test - @Disabled - void testOptionalNotTransitiveButVersionIsInfluential() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - ArtifactSpec b = createArtifactSpec("b", "1.0"); - b.addDependency("c", "3.0", true); - ArtifactSpec d = a.addDependency("d", "1.0"); - ArtifactSpec e = d.addDependency("e", "1.0"); - e.addDependency("c", "2.0"); - - ArtifactSpec c = createArtifactSpec("c", "3.0"); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals( - createSet(new Object[] {a.artifact, b.artifact, c.artifact, d.artifact, e.artifact}), - res.getArtifacts(), - "Check artifact list"); - Artifact artifact = getArtifact("c", res.getArtifacts()); - assertEquals("3.0", artifact.getVersion(), "Check version"); - } - - @Test - void testTestScopeNotTransitive() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0", Artifact.SCOPE_TEST); - ArtifactSpec b = createArtifactSpec("b", "1.0"); - b.addDependency("c", "3.0", Artifact.SCOPE_TEST); - - ArtifactResolutionResult res = collect(createSet(new Object[] {a.artifact, b.artifact})); - assertEquals(createSet(new Object[] {a.artifact, b.artifact}), res.getArtifacts(), "Check artifact list"); - } - - @Test - void testSnapshotNotIncluded() throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - a.addDependency("b", "[1.0,)"); - createArtifactSpec("b", "1.0-SNAPSHOT"); - - ArtifactResolutionResult res = collect(a); - - assertTrue(res.hasVersionRangeViolations()); - - /* - * try { ArtifactResolutionResult res = collect( a ); fail( "Expected b not to resolve: " + res ); } catch ( - * OverConstrainedVersionException e ) { assertTrue( e.getMessage().indexOf( "[1.0-SNAPSHOT]" ) < - * e.getMessage().indexOf( "[1.0,)" ) ); } - */ - } - - @Test - @Disabled("that one does not work") - void testOverConstrainedVersionException() - throws ArtifactResolutionException, InvalidVersionSpecificationException { - ArtifactSpec a = createArtifactSpec("a", "1.0"); - a.addDependency("b", "[1.0, 2.0)"); - a.addDependency("c", "[3.3.0,4.0.0)"); - - ArtifactSpec b = createArtifactSpec("b", "1.0.0"); - b.addDependency("c", "3.3.0-v3346"); - - ArtifactSpec c = createArtifactSpec("c", "3.2.1-v3235e"); - - OverConstrainedVersionException e = assertThrows( - OverConstrainedVersionException.class, () -> collect(createSet(new Object[] {a.artifact}))); - assertTrue(e.getMessage().contains("[3.2.1-v3235e, 3.3.0-v3346]"), "Versions unordered"); - assertTrue(e.getMessage().contains("Path to dependency:"), "DependencyTrail unresolved"); - } - - private Artifact getArtifact(String id, Set artifacts) { - for (Object artifact : artifacts) { - Artifact a = (Artifact) artifact; - if (a.getArtifactId().equals(id) && a.getGroupId().equals(GROUP_ID)) { - return a; - } - } - return null; - } - - private ArtifactResolutionResult collect(Set artifacts) throws ArtifactResolutionException { - return collect(artifacts, null); - } - - private ArtifactResolutionResult collect(Set artifacts, ArtifactFilter filter) - throws ArtifactResolutionException { - return artifactCollector.collect( - artifacts, projectArtifact.artifact, null, null, null, source, filter, Collections.emptyList(), null); - } - - private ArtifactResolutionResult collect(ArtifactSpec a) throws ArtifactResolutionException { - return artifactCollector.collect( - Collections.singleton(a.artifact), - projectArtifact.artifact, - null, - null, - null, - source, - null, - Collections.emptyList(), - null); - } - - private ArtifactResolutionResult collect(ArtifactSpec a, ArtifactFilter filter) throws ArtifactResolutionException { - return artifactCollector.collect( - Collections.singleton(a.artifact), - projectArtifact.artifact, - null, - null, - null, - source, - filter, - Collections.emptyList(), - null); - } - - private ArtifactResolutionResult collect(ArtifactSpec a, Artifact managedVersion) - throws ArtifactResolutionException { - Map managedVersions = - Collections.singletonMap(managedVersion.getDependencyConflictId(), managedVersion); - return artifactCollector.collect( - Collections.singleton(a.artifact), - projectArtifact.artifact, - managedVersions, - null, - null, - source, - null, - Collections.emptyList(), - null); - } - - private ArtifactSpec createArtifactSpec(String id, String version) throws InvalidVersionSpecificationException { - return createArtifactSpec(id, version, Artifact.SCOPE_COMPILE); - } - - private ArtifactSpec createArtifactSpec(String id, String version, boolean optional) - throws InvalidVersionSpecificationException { - return createArtifactSpec(id, version, Artifact.SCOPE_COMPILE, null, optional); - } - - private ArtifactSpec createArtifactSpec(String id, String version, String scope) - throws InvalidVersionSpecificationException { - return createArtifactSpec(id, version, scope, null, false); - } - - private ArtifactSpec createArtifactSpec( - String id, String version, String scope, String inheritedScope, boolean optional) - throws InvalidVersionSpecificationException { - VersionRange versionRange = VersionRange.createFromVersionSpec(version); - Artifact artifact = artifactFactory.createDependencyArtifact( - GROUP_ID, id, versionRange, "jar", null, scope, inheritedScope, optional); - ArtifactSpec spec = null; - if (artifact != null) { - spec = new ArtifactSpec(); - spec.artifact = artifact; - source.addArtifact(spec); - } - return spec; - } - - @SuppressWarnings("unchecked") - private static Set createSet(Object[] x) { - return new LinkedHashSet(Arrays.asList(x)); - } - - private class ArtifactSpec { - private Artifact artifact; - - private Set dependencies = new HashSet<>(); - - public ArtifactSpec addDependency(String id, String version) throws InvalidVersionSpecificationException { - return addDependency(id, version, Artifact.SCOPE_COMPILE); - } - - public ArtifactSpec addDependency(String id, String version, String scope) - throws InvalidVersionSpecificationException { - return addDependency(id, version, scope, false); - } - - private ArtifactSpec addDependency(ArtifactSpec dep) throws InvalidVersionSpecificationException { - if (dep != null) { - dependencies.add(dep.artifact); - } - return dep; - } - - private ArtifactSpec addDependency(String id, String version, String scope, boolean optional) - throws InvalidVersionSpecificationException { - ArtifactSpec dep = createArtifactSpec(id, version, scope, artifact.getScope(), optional); - return addDependency(dep); - } - - public ArtifactSpec addDependency(String id, String version, boolean optional) - throws InvalidVersionSpecificationException { - return addDependency(id, version, Artifact.SCOPE_COMPILE, optional); - } - } - - private class Source implements ArtifactMetadataSource { - private Map artifacts = new HashMap<>(); - - private Map> versions = new HashMap<>(); - - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - String key = getKey(artifact); - - ArtifactSpec a = (ArtifactSpec) artifacts.get(key); - try { - return new ResolutionGroup( - artifact, - createArtifacts( - artifactFactory, a.dependencies, artifact.getScope(), artifact.getDependencyFilter()), - Collections.emptyList()); - } catch (InvalidVersionSpecificationException e) { - throw new ArtifactMetadataRetrievalException("Invalid version creating artifacts", e, artifact); - } - } - - private String getKey(Artifact artifact) { - return artifact.getDependencyConflictId(); - } - - private Set createArtifacts( - ArtifactFactory artifactFactory, - Set dependencies, - String inheritedScope, - ArtifactFilter dependencyFilter) - throws InvalidVersionSpecificationException { - Set projectArtifacts = new HashSet<>(); - - for (Artifact d : dependencies) { - VersionRange versionRange; - if (d.getVersionRange() != null) { - versionRange = d.getVersionRange(); - } else { - versionRange = VersionRange.createFromVersionSpec(d.getVersion()); - } - Artifact artifact; - if (d.getScope().equals(Artifact.SCOPE_TEST) || d.getScope().equals(Artifact.SCOPE_PROVIDED)) { - /* don't call createDependencyArtifact as it'll ignore test and provided scopes */ - artifact = artifactFactory.createArtifact( - d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getScope(), d.getType()); - } else { - artifact = artifactFactory.createDependencyArtifact( - d.getGroupId(), - d.getArtifactId(), - versionRange, - d.getType(), - d.getClassifier(), - d.getScope(), - inheritedScope, - d.isOptional()); - } - - if (artifact != null && (dependencyFilter == null || dependencyFilter.include(artifact))) { - artifact.setDependencyFilter(dependencyFilter); - - projectArtifacts.add(artifact); - } - } - - return projectArtifacts; - } - - public void addArtifact(ArtifactSpec spec) { - artifacts.put(getKey(spec.artifact), spec); - - String key = spec.artifact.getDependencyConflictId(); - List artifactVersions = versions.computeIfAbsent(key, k -> new ArrayList<>()); - if (spec.artifact.getVersion() != null) { - artifactVersions.add(new DefaultArtifactVersion(spec.artifact.getVersion())); - } - } - - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - return retrieveAvailableVersions(artifact); - } - - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException { - return retrieveAvailableVersions(artifact); - } - - private List retrieveAvailableVersions(Artifact artifact) { - List artifactVersions = versions.get(artifact.getDependencyConflictId()); - if (artifactVersions == null) { - artifactVersions = Collections.emptyList(); - } - return artifactVersions; - } - - public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException { - return retrieve(request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } - - public List retrieveAvailableVersions(MetadataResolutionRequest request) - throws ArtifactMetadataRetrievalException { - return retrieveAvailableVersions( - request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java deleted file mode 100644 index 5f3202fdcf48..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import javax.inject.Inject; - -import java.util.Collections; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; -import org.apache.maven.artifact.versioning.VersionRange; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.BeforeEach; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * Provides a basis for testing conflict resolvers. - * - */ -@PlexusTest -@Deprecated -public abstract class AbstractConflictResolverTest { - // constants -------------------------------------------------------------- - - private static final String GROUP_ID = "test"; - - // fields ----------------------------------------------------------------- - - protected Artifact a1; - - protected Artifact a2; - - protected Artifact b1; - - private final String roleHint; - - @Inject - private ArtifactFactory artifactFactory; - - private ConflictResolver conflictResolver; - - @Inject - protected PlexusContainer container; - - // constructors ----------------------------------------------------------- - - public AbstractConflictResolverTest(String roleHint) throws Exception { - this.roleHint = roleHint; - } - - // TestCase methods ------------------------------------------------------- - - /* - * @see junit.framework.TestCase#setUp() - */ - @BeforeEach - public void setUp() throws Exception { - conflictResolver = (ConflictResolver) container.lookup(ConflictResolver.ROLE, roleHint); - - a1 = createArtifact("a", "1.0"); - a2 = createArtifact("a", "2.0"); - b1 = createArtifact("b", "1.0"); - } - - // protected methods ------------------------------------------------------ - - protected ConflictResolver getConflictResolver() { - return conflictResolver; - } - - protected void assertResolveConflict( - ResolutionNode expectedNode, ResolutionNode actualNode1, ResolutionNode actualNode2) { - ResolutionNode resolvedNode = getConflictResolver().resolveConflict(actualNode1, actualNode2); - - assertNotNull(resolvedNode, "Expected resolvable"); - assertEquals(expectedNode, resolvedNode, "Resolution node"); - } - - protected Artifact createArtifact(String id, String version) throws InvalidVersionSpecificationException { - return createArtifact(id, version, Artifact.SCOPE_COMPILE); - } - - protected Artifact createArtifact(String id, String version, String scope) - throws InvalidVersionSpecificationException { - return createArtifact(id, version, scope, null, false); - } - - protected Artifact createArtifact(String id, String version, String scope, String inheritedScope, boolean optional) - throws InvalidVersionSpecificationException { - VersionRange versionRange = VersionRange.createFromVersionSpec(version); - - return artifactFactory.createDependencyArtifact( - GROUP_ID, id, versionRange, "jar", null, scope, inheritedScope, optional); - } - - protected ResolutionNode createResolutionNode(Artifact Artifact) { - return new ResolutionNode(Artifact, Collections.emptyList()); - } - - protected ResolutionNode createResolutionNode(Artifact Artifact, ResolutionNode parent) { - return new ResolutionNode(Artifact, Collections.emptyList(), parent); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java deleted file mode 100644 index 558289e3e4bd..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.junit.jupiter.api.Test; - -/** - * Tests FarthestConflictResolver. - * - * @see FarthestConflictResolver - */ -@Deprecated -class FarthestConflictResolverTest extends AbstractConflictResolverTest { - // constructors ----------------------------------------------------------- - - public FarthestConflictResolverTest() throws Exception { - super("farthest"); - } - - // tests ------------------------------------------------------------------ - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:1.0
-     * b:1.0 -> a:2.0
-     * 
- */ - @Test - void testDepth() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - - assertResolveConflict(a2n, a1n, a2n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * b:1.0 -> a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testDepthReversed() { - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a2n, a2n, a1n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:1.0
-     * a:2.0
-     * 
- */ - @Test - void testEqual() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode a2n = createResolutionNode(a2); - - assertResolveConflict(a1n, a1n, a2n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testEqualReversed() { - ResolutionNode a2n = createResolutionNode(a2); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a2n, a2n, a1n); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java deleted file mode 100644 index dd7b32e9863b..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.junit.jupiter.api.Test; - -/** - * Tests NearestConflictResolver. - * - * @see NearestConflictResolver - */ -@Deprecated -class NearestConflictResolverTest extends AbstractConflictResolverTest { - // constructors ----------------------------------------------------------- - - public NearestConflictResolverTest() throws Exception { - super("nearest"); - } - - // tests ------------------------------------------------------------------ - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:1.0
-     * b:1.0 -> a:2.0
-     * 
- */ - @Test - void testDepth() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - - assertResolveConflict(a1n, a1n, a2n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * b:1.0 -> a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testDepthReversed() { - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a1n, a2n, a1n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:1.0
-     * a:2.0
-     * 
- */ - @Test - void testEqual() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode a2n = createResolutionNode(a2); - - assertResolveConflict(a1n, a1n, a2n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testEqualReversed() { - ResolutionNode a2n = createResolutionNode(a2); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a2n, a2n, a1n); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java deleted file mode 100644 index ffe13b561779..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.junit.jupiter.api.Test; - -/** - * Tests NewestConflictResolver. - * - * @see NewestConflictResolver - */ -@Deprecated -class NewestConflictResolverTest extends AbstractConflictResolverTest { - // constructors ----------------------------------------------------------- - - public NewestConflictResolverTest() throws Exception { - super("newest"); - } - - // tests ------------------------------------------------------------------ - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:1.0
-     * b:1.0 -> a:2.0
-     * 
- */ - @Test - void testDepth() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - - assertResolveConflict(a2n, a1n, a2n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * b:1.0 -> a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testDepthReversed() { - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a2n, a2n, a1n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:1.0
-     * a:2.0
-     * 
- */ - @Test - void testEqual() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode a2n = createResolutionNode(a2); - - assertResolveConflict(a2n, a1n, a2n); - } - - /** - * Tests that a:2.0 wins in the scenario: - *
-     * a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testEqualReversed() { - ResolutionNode a2n = createResolutionNode(a2); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a2n, a2n, a1n); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java deleted file mode 100644 index 4c90250fedd7..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.legacy.resolver.conflict; - -import org.apache.maven.artifact.resolver.ResolutionNode; -import org.junit.jupiter.api.Test; - -/** - * Tests OldestConflictResolver. - * - * @see OldestConflictResolver - */ -@Deprecated -class OldestConflictResolverTest extends AbstractConflictResolverTest { - // constructors ----------------------------------------------------------- - - public OldestConflictResolverTest() throws Exception { - super("oldest"); - } - - // tests ------------------------------------------------------------------ - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:1.0
-     * b:1.0 -> a:2.0
-     * 
- */ - @Test - void testDepth() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - - assertResolveConflict(a1n, a1n, a2n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * b:1.0 -> a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testDepthReversed() { - ResolutionNode b1n = createResolutionNode(b1); - ResolutionNode a2n = createResolutionNode(a2, b1n); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a1n, a2n, a1n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:1.0
-     * a:2.0
-     * 
- */ - @Test - void testEqual() { - ResolutionNode a1n = createResolutionNode(a1); - ResolutionNode a2n = createResolutionNode(a2); - - assertResolveConflict(a1n, a1n, a2n); - } - - /** - * Tests that a:1.0 wins in the scenario: - *
-     * a:2.0
-     * a:1.0
-     * 
- */ - @Test - void testEqualReversed() { - ResolutionNode a2n = createResolutionNode(a2); - ResolutionNode a1n = createResolutionNode(a1); - - assertResolveConflict(a1n, a2n, a1n); - } -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTestType.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTestType.java deleted file mode 100644 index 495db2d21528..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTestType.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Inject; - -import org.apache.maven.artifact.ArtifactScopeEnum; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * - * - */ -@PlexusTest -@Deprecated -class DefaultClasspathTransformationTestType { - @Inject - ClasspathTransformation transform; - - MetadataGraph graph; - - MetadataGraphVertex v1; - MetadataGraphVertex v2; - MetadataGraphVertex v3; - MetadataGraphVertex v4; - - // ------------------------------------------------------------------------------------------ - @BeforeEach - void setUp() throws Exception { - graph = new MetadataGraph(4, 3); - /* - * v2 - * v1< - * v3-v4 - * - */ - v1 = graph.addVertex(new ArtifactMetadata("g", "a1", "1.0")); - graph.setEntry(v1); - v2 = graph.addVertex(new ArtifactMetadata("g", "a2", "1.0")); - v3 = graph.addVertex(new ArtifactMetadata("g", "a3", "1.0")); - v4 = graph.addVertex(new ArtifactMetadata("g", "a4", "1.0")); - - // v1-->v2 - graph.addEdge(v1, v2, new MetadataGraphEdge("1.1", true, null, null, 2, 1)); - graph.addEdge(v1, v2, new MetadataGraphEdge("1.2", true, null, null, 2, 2)); - - // v1-->v3 - graph.addEdge(v1, v3, new MetadataGraphEdge("1.1", true, null, null, 2, 1)); - graph.addEdge(v1, v3, new MetadataGraphEdge("1.2", true, null, null, 4, 2)); - - // v3-->v4 - graph.addEdge(v3, v4, new MetadataGraphEdge("1.1", true, ArtifactScopeEnum.runtime, null, 2, 2)); - graph.addEdge(v3, v4, new MetadataGraphEdge("1.2", true, ArtifactScopeEnum.test, null, 2, 2)); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testCompileClasspathTransform() throws Exception { - ClasspathContainer res; - - res = transform.transform(graph, ArtifactScopeEnum.compile, false); - - assertNotNull(res, "null classpath container after compile transform"); - assertNotNull(res.getClasspath(), "null classpath after compile transform"); - assertEquals(3, res.getClasspath().size(), "compile classpath should have 3 entries"); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testRuntimeClasspathTransform() throws Exception { - ClasspathContainer res; - - res = transform.transform(graph, ArtifactScopeEnum.runtime, false); - - assertNotNull(res, "null classpath container after runtime transform"); - assertNotNull(res.getClasspath(), "null classpath after runtime transform"); - assertEquals(4, res.getClasspath().size(), "runtime classpath should have 4 entries"); - - ArtifactMetadata md = res.getClasspath().get(3); - assertEquals("1.1", md.getVersion(), "runtime artifact version should be 1.1"); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testTestClasspathTransform() throws Exception { - ClasspathContainer res; - - res = transform.transform(graph, ArtifactScopeEnum.test, false); - - assertNotNull(res, "null classpath container after test transform"); - assertNotNull(res.getClasspath(), "null classpath after test transform"); - assertEquals(4, res.getClasspath().size(), "test classpath should have 4 entries"); - - ArtifactMetadata md = res.getClasspath().get(3); - assertEquals("1.2", md.getVersion(), "test artifact version should be 1.2"); - } - // ------------------------------------------------------------------------------------------ - // ------------------------------------------------------------------------------------------ -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java deleted file mode 100644 index 15da1b3315ab..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * - * - */ -@Deprecated -class DefaultGraphConflictResolutionPolicyTest { - GraphConflictResolutionPolicy policy; - MetadataGraphEdge e1; - MetadataGraphEdge e2; - MetadataGraphEdge e3; - - // ------------------------------------------------------------------------------------------ - @BeforeEach - void setUp() throws Exception { - policy = new DefaultGraphConflictResolutionPolicy(); - e1 = new MetadataGraphEdge("1.1", true, null, null, 2, 1); - e2 = new MetadataGraphEdge("1.2", true, null, null, 3, 2); - e3 = new MetadataGraphEdge("1.2", true, null, null, 2, 3); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testDefaultPolicy() throws Exception { - MetadataGraphEdge res; - - res = policy.apply(e1, e2); - assertEquals("1.1", res.getVersion(), "Wrong depth edge selected"); - - res = policy.apply(e1, e3); - assertEquals("1.2", res.getVersion(), "Wrong version edge selected"); - } - // ------------------------------------------------------------------------------------------ - // ------------------------------------------------------------------------------------------ -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java deleted file mode 100644 index 94625d1fc0e9..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Inject; - -import org.apache.maven.artifact.ArtifactScopeEnum; -import org.codehaus.plexus.testing.PlexusTest; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * - * - */ -@PlexusTest -@Deprecated -class DefaultGraphConflictResolverTest { - @Inject - GraphConflictResolver resolver; - - MetadataGraph graph; - - MetadataGraphVertex v1; - MetadataGraphVertex v2; - MetadataGraphVertex v3; - MetadataGraphVertex v4; - - // ------------------------------------------------------------------------------------------ - @BeforeEach - void setUp() throws Exception { - /* - * v2 - * v1< - * v3-v4 - * - */ - graph = new MetadataGraph(4, 3); - v1 = graph.addVertex(new ArtifactMetadata("g", "a1", "1.0")); - graph.setEntry(v1); - v2 = graph.addVertex(new ArtifactMetadata("g", "a2", "1.0")); - v3 = graph.addVertex(new ArtifactMetadata("g", "a3", "1.0")); - v4 = graph.addVertex(new ArtifactMetadata("g", "a4", "1.0")); - - // v1-->v2 - graph.addEdge(v1, v2, new MetadataGraphEdge("1.1", true, null, null, 2, 1)); - graph.addEdge(v1, v2, new MetadataGraphEdge("1.2", true, null, null, 2, 2)); - - // v1-->v3 - graph.addEdge(v1, v3, new MetadataGraphEdge("1.1", true, null, null, 2, 1)); - graph.addEdge(v1, v3, new MetadataGraphEdge("1.2", true, null, null, 4, 2)); - - // v3-->v4 - graph.addEdge(v3, v4, new MetadataGraphEdge("1.1", true, ArtifactScopeEnum.runtime, null, 2, 1)); - graph.addEdge(v3, v4, new MetadataGraphEdge("1.2", true, ArtifactScopeEnum.provided, null, 2, 2)); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testCompileResolution() throws Exception { - MetadataGraph res; - - res = resolver.resolveConflicts(graph, ArtifactScopeEnum.compile); - - assertNotNull(res, "null graph after resolver"); - assertNotNull(res.getVertices(), "no vertices in the resulting graph after resolver"); - - assertNotNull(res.getExcidentEdges(v1), "no edges in the resulting graph after resolver"); - - assertEquals(4, res.getVertices().size(), "wrong # of vertices in the resulting graph after resolver"); - assertEquals( - 2, - res.getExcidentEdges(v1).size(), - "wrong # of excident edges in the resulting graph entry after resolver"); - - assertEquals( - 1, - res.getIncidentEdges(v2).size(), - "wrong # of v2 incident edges in the resulting graph after resolver"); - assertEquals( - "1.2", - res.getIncidentEdges(v2).get(0).getVersion(), - "wrong edge v1-v2 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v3).size(), "wrong # of edges v1-v3 in the resulting graph after resolver"); - assertEquals( - "1.1", - res.getIncidentEdges(v3).get(0).getVersion(), - "wrong edge v1-v3 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v4).size(), "wrong # of edges v3-v4 in the resulting graph after resolver"); - assertEquals( - "1.2", - res.getIncidentEdges(v4).get(0).getVersion(), - "wrong edge v3-v4 in the resulting graph after resolver"); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testRuntimeResolution() throws Exception { - MetadataGraph res; - - res = resolver.resolveConflicts(graph, ArtifactScopeEnum.runtime); - - assertNotNull(res, "null graph after resolver"); - assertNotNull(res.getVertices(), "no vertices in the resulting graph after resolver"); - assertNotNull(res.getExcidentEdges(v1), "no edges in the resulting graph after resolver"); - - assertEquals(4, res.getVertices().size(), "wrong # of vertices in the resulting graph after resolver"); - assertEquals( - 2, - res.getExcidentEdges(v1).size(), - "wrong # of excident edges in the resulting graph entry after resolver"); - - assertEquals( - 1, - res.getIncidentEdges(v2).size(), - "wrong # of v2 incident edges in the resulting graph after resolver"); - assertEquals( - "1.2", - res.getIncidentEdges(v2).get(0).getVersion(), - "wrong edge v1-v2 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v3).size(), "wrong # of edges v1-v3 in the resulting graph after resolver"); - assertEquals( - "1.1", - res.getIncidentEdges(v3).get(0).getVersion(), - "wrong edge v1-v3 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v4).size(), "wrong # of edges v3-v4 in the resulting graph after resolver"); - assertEquals( - "1.1", - res.getIncidentEdges(v4).get(0).getVersion(), - "wrong edge v3-v4 in the resulting graph after resolver"); - } - - // ------------------------------------------------------------------------------------------ - @Test - void testTestResolution() throws Exception { - MetadataGraph res; - - res = resolver.resolveConflicts(graph, ArtifactScopeEnum.test); - - assertNotNull(res, "null graph after resolver"); - assertNotNull(res.getVertices(), "no vertices in the resulting graph after resolver"); - assertNotNull(res.getExcidentEdges(v1), "no edges in the resulting graph after resolver"); - - assertEquals(4, res.getVertices().size(), "wrong # of vertices in the resulting graph after resolver"); - assertEquals( - 2, - res.getExcidentEdges(v1).size(), - "wrong # of excident edges in the resulting graph entry after resolver"); - - assertEquals( - 1, - res.getIncidentEdges(v2).size(), - "wrong # of v2 incident edges in the resulting graph after resolver"); - assertEquals( - "1.2", - res.getIncidentEdges(v2).get(0).getVersion(), - "wrong edge v1-v2 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v3).size(), "wrong # of edges v1-v3 in the resulting graph after resolver"); - assertEquals( - "1.1", - res.getIncidentEdges(v3).get(0).getVersion(), - "wrong edge v1-v3 in the resulting graph after resolver"); - - assertEquals( - 1, res.getIncidentEdges(v4).size(), "wrong # of edges v3-v4 in the resulting graph after resolver"); - assertEquals( - "1.2", - res.getIncidentEdges(v4).get(0).getVersion(), - "wrong edge v3-v4 in the resulting graph after resolver"); - } - // ------------------------------------------------------------------------------------------ - // ------------------------------------------------------------------------------------------ -} diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java deleted file mode 100644 index 5681bba45f81..000000000000 --- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.repository.metadata; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.repository.legacy.metadata.ArtifactMetadataRetrievalException; -import org.apache.maven.repository.legacy.metadata.ArtifactMetadataSource; -import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; -import org.apache.maven.repository.legacy.metadata.ResolutionGroup; - -@Named -@Singleton -@Deprecated -public class TestMetadataSource implements ArtifactMetadataSource { - @Inject - private ArtifactFactory factory; - - public ResolutionGroup retrieve( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - Set dependencies = new HashSet<>(); - - if ("g".equals(artifact.getArtifactId())) { - Artifact a = null; - try { - a = factory.createBuildArtifact("org.apache.maven", "h", "1.0", "jar"); - dependencies.add(a); - } catch (Exception e) { - throw new ArtifactMetadataRetrievalException("Error retrieving metadata", e, a); - } - } - - if ("i".equals(artifact.getArtifactId())) { - Artifact a = null; - try { - a = factory.createBuildArtifact("org.apache.maven", "j", "1.0-SNAPSHOT", "jar"); - dependencies.add(a); - } catch (Exception e) { - throw new ArtifactMetadataRetrievalException("Error retrieving metadata", e, a); - } - } - - return new ResolutionGroup(artifact, dependencies, remoteRepositories); - } - - public List retrieveAvailableVersions( - Artifact artifact, ArtifactRepository localRepository, List remoteRepositories) - throws ArtifactMetadataRetrievalException { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - public List retrieveAvailableVersionsFromDeploymentRepository( - Artifact artifact, ArtifactRepository localRepository, ArtifactRepository remoteRepository) - throws ArtifactMetadataRetrievalException { - throw new UnsupportedOperationException("Cannot get available versions in this test case"); - } - - public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException { - return retrieve(request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories()); - } -} diff --git a/maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/jre/placeholder.txt b/maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/jre/placeholder.txt deleted file mode 100644 index 4a9eb145a1e3..000000000000 --- a/maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/jre/placeholder.txt +++ /dev/null @@ -1 +0,0 @@ -need it so that empty directory does not get deleted diff --git a/maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/lib/tools.jar b/maven-compat/src/test/projects/project-dependencies-resolver/it0063/jdk/lib/tools.jar deleted file mode 100644 index d64355199008ab56ee327308add772c6030d55d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 345 zcmWIWW@Zs#-~ht>3M)$nB*4kQ!r%MB z$s^J;v@=+yKhyk?rY8PWJX~!0l4oMt70*;(XMQUBSi}f+i13u?8}2}BKsdmgkx7IB v)gLfNg8YFB;0^=%3SBF*u^?X{fGv;-*NWt)0B=?{kSZo1tOe4?KpX}D1TsW) diff --git a/maven-compat/src/test/projects/project-dependencies-resolver/it0063/pom.xml b/maven-compat/src/test/projects/project-dependencies-resolver/it0063/pom.xml deleted file mode 100644 index 0d7b08a90c74..000000000000 --- a/maven-compat/src/test/projects/project-dependencies-resolver/it0063/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.its.it0063 - maven-it-it0063 - 1.0 - jar - - Maven Integration Test :: it0063 - Test the use of a system scoped dependency to a (fake) tools.jar. - - - - com.sun - tools - 1.4.2 - system - ${jre.home}/../lib/tools.jar - - - - - - - org.apache.maven.its.plugins - maven-it-plugin-dependency-resolution - 2.1-SNAPSHOT - - target/compile.txt - - - - - diff --git a/maven-compat/src/test/projects/project-dependencies-resolver/project-with-exclusions/pom.xml b/maven-compat/src/test/projects/project-dependencies-resolver/project-with-exclusions/pom.xml deleted file mode 100644 index 9fae29254b8f..000000000000 --- a/maven-compat/src/test/projects/project-dependencies-resolver/project-with-exclusions/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - 4.0.0 - org.apache.maven.its.mng4034 - parent - 1.0-SNAPSHOT - - - org.apache.maven.its - maven-core-it-support - 1.3 - runtime - - - commons-lang - commons-lang - - - - - diff --git a/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar b/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar deleted file mode 100644 index 609ec21bcac43974b0b99185c748c0cdcfa5ceea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1898 zcmWIWW@h1H0D)TO2x~9{N^k;cU)K;vT~9wZ{Q#&k4u%?_va`3+m{Nh#)j%wQtjyQZ z&(qB{I7H9a?X&Nh(>~t1dKY=Ub+yi&Ilno`;EM5sr$stm=T7K&>pF3;KUoqsMNIpE zO2y7O-9f_MLBS<+wbqKra0^W~4ic>qJ{|NKDC1>Z>~-Lg-#Wi_0(D*M!oAE+6d2n! zS1=dH>BZ?Wz?_BYdVXYQ_E5ch#hqR6i0+LuW=k(_`CprEH>>3Gyb15megD0~_~KFT*n`GeXO~)h z_iLWXu2B?O5IC>;`|6$lPwwuBJzlz~eBXO3a~t=C8yS=j<_Jz|d-~<%lVc@5if2-_ zxzbih%BbG_Bk`hxYl*}4iCkHpraML4K9*){1n~ZCn98-$EwO}Qg5tNc;-^EaDtV>j zF1~Gg{ZOp2{7%lwrtB9>s+xFBlUxt#>a1?y=DK3bc|9<~DD|p9&gS4fccdoFRX7-Z zPvF|At`pCM1#P#;DtJEj+qSrcdFx_M^$)clcEfz6d|9EUp`JbKpqc_WPWG=Y6 z<2}!hNy*6_8WUH|?lPWu`EKCV?E0kd2HPfNA6_x*tCB+=-{}TPYx#z?hG!!s%3{Sg z%*#*+mGnDwNcvOJ#Ms|1*RI{~=Gw~EY9GDs#O1Gi5zaA1+tk`bUmw_&b^H?l>bmH%N2S^1^8@cmOK)=i@d%Hf{$2aW#5;FYyF;ty z9{j|oH@$mx$y7b@l3C81DhlT2zkKwHWrB~AL`~+DrT#KIO9i@{_s;zAHttLCMc!vM zhl?kvo|-n5W9gE);$^y0A*R>MdS<;4-NIpN{`XVH^`Gv+53Kgt?`d~C>3+sHXKjC0 zWP<5B=RbxsST}3b2ur((O!eC48+F8FW~PT}wVPnU;>880zAg2U+?Tj>p>g-2=HU6V z^K)#t{T6@tDcWLm@E^JQ{(@PT(`*^*_WG@AMgNnX&h6p*zz@s49N@Bt z(|$u*E-(w^0kH{5S)rgPzaX`!Br~-*xXk~ox2~6tr*ELgs*n%9I^Jg=KMmsZ(+T|G zuNP=w6lh?u!N_R4k!f&28807Dz+l6Zr&`bg%JhQqlc!$#r}T9{_-s6@?{(c<$HV8G z$JNuUl8dKD2Aw%QH6mov%xN=Xm_jC;IL!(yd>ENTm~j`LKtBM10K;2H5RFun!n9#8 zOhJl4U`eAokc4YPDq8Vb3@Y~^0A%q#AQNr^tQ3Sg2mv7H z=rUqB2djyoQW9n+_Hq(t>XODnqRoVsn#e|j>OAyxhcLQ^g;?i;j7Frw0B=?{kSXjy OC - - - - - 4.0.0 - - org.apache.maven.its - a - 0.1 - jar - - Maven Integration Test :: Dummy Artifact - - - - - - - maven-core-it - file:///${basedir}/repo - - - diff --git a/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml b/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml deleted file mode 100644 index 8099175ec04b..000000000000 --- a/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - org.apache.maven.its - a - 0.1 - - - 0.1 - - 20091023222756 - - diff --git a/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar b/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar deleted file mode 100644 index 19df0485a785a4c6d38b09e502b0ebdc3dc36227..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1936 zcmWIWW@h1H0D(^C2x~9{N^k;cU)K;vT~9wZ{Q#&k4u%e(va`3+m{Nh#)j%wQtjyQZ z&(qB{I7H9a?X&Nh(>~t1dKY=Ub+yi&Ilno`;EM5sr$stm=T7K&>pF3;KUoqsMNIpE zO2y7O-9f_MLBS<+wbqKra0^W~4ic>qJ{|NKDC1>Z>~-Lg-#Wi_0(D*M!oAE+6d2n! zS1=dH>BZ?Wz?_BYdVXYQMV3i5OHDspprL+<+DHV~-qpYs1<*jvUWW}27f z)Wn*s7DSn3s0OuFluXXf@_2KmjN|H-|FzF+wj^?7`cHg+u6%!gantANO6}<(v%Cw< ztUfMNc9?i#O81+blI^qn_w}4}zFs)@!QqrgR@ZGD7aFoEAIuRs}SkSs~~hoOgVa%#H;P7aIy>TP1_1@%HMLccn)&ZxVB< zIPE=a>n4>)mHaN-b8k;PQmDSV?@&Xo`XPzBZMzPt=X1G-Jg{1X+%i~|#>+WjcA}&~@?XXqQo-|n)x}mRMrpey0 zB^yp0TerA+cl$D#lvj;{cM};okDi!#QKwBq?%?)FnWM=&`or!|FW25N|L(nWVyjsdNS6bTsj}>1i;eXhz!_#Sh z2j}vGHnu6+Q`^5iy-@XAzJ9&r-^Lxk9^ZCr%%2>a{(t^8mUp%)vP*?dCQU53Qrlmf z)9~(pZuTkmw2kK1Ohw<{y3X~B>!8AgLn^`FcYha$<#7&h3DvUl=&W2|M#%$W6OuAa zK~a7|YEemMYH@Ix|5p1 zQ<$ks8ViXw6I!++8x5)%(bFBm=tV5VIu~R#A{7RBv$BCqVFyA - - - - - 4.0.0 - - org.apache.maven.its - b - 0.1 - jar - - Maven Integration Test :: Dummy Artifact - - - - - - - maven-core-it - file:///${basedir}/repo - - - - - - org.apache.maven.its - a - 0.1 - - - diff --git a/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml b/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml deleted file mode 100644 index e77af628fad2..000000000000 --- a/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - org.apache.maven.its - b - 0.1 - - - 0.1 - - 20091023222817 - - diff --git a/maven-compat/src/test/repository-system/maven-core-2.1.0.jar b/maven-compat/src/test/repository-system/maven-core-2.1.0.jar deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/maven-compat/src/test/resources/META-INF/maven/org.apache.maven.api.di.Inject b/maven-compat/src/test/resources/META-INF/maven/org.apache.maven.api.di.Inject deleted file mode 100644 index fb476677f3a5..000000000000 --- a/maven-compat/src/test/resources/META-INF/maven/org.apache.maven.api.di.Inject +++ /dev/null @@ -1 +0,0 @@ -org.apache.maven.project.EmptyLifecycleBindingsInjector diff --git a/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar b/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar deleted file mode 100644 index 421376db9e8a..000000000000 --- a/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -dummy diff --git a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom deleted file mode 100644 index 92c9f41d22cb..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom +++ /dev/null @@ -1,11 +0,0 @@ - - 4.0.0 - maven - p0 - pom - p0 - 1.0 - - Codehaus - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom deleted file mode 100644 index 6038a806a410..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p1 - pom - p1 - 1.0 - - scm-url - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom deleted file mode 100644 index 9ac112ac4615..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom +++ /dev/null @@ -1,18 +0,0 @@ - - - p1 - maven - 1.0 - - 4.0.0 - maven - p2 - pom - p2 - 1.0 - - - mailing-list - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom deleted file mode 100644 index d40684e9702c..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom +++ /dev/null @@ -1,14 +0,0 @@ - - - p2 - maven - 1.0 - - 4.0.0 - maven - p3 - pom - p3 - 1.0 - 2000 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom deleted file mode 100644 index dc9a2735297b..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom +++ /dev/null @@ -1,13 +0,0 @@ - - - p3 - maven - 1.0 - - 4.0.0 - maven - p4 - jar - p4 - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom deleted file mode 100644 index 9df2582d6655..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom +++ /dev/null @@ -1,11 +0,0 @@ - - 4.0.0 - maven.t01 - p0 - pom - p0 - 1.0 - - p0-org - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom deleted file mode 100644 index 4fc81d833878..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - - p0 - maven.t01 - 1.0 - - 4.0.0 - maven.t01 - p1 - pom - p1 - 1.0 - - p1-org - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom deleted file mode 100644 index 8032cf2fb170..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - - p1 - maven.t01 - 1.0 - - 4.0.0 - maven.t01 - p2 - pom - p2 - 1.0 - - p2-org - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom deleted file mode 100644 index 6ed58569fc4d..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - - p2 - maven.t01 - 1.0 - - 4.0.0 - maven.t01 - p3 - pom - p3 - 1.0 - - p3-org - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom deleted file mode 100644 index 1739333a8206..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - - p3 - maven.t01 - 1.0 - - 4.0.0 - maven.t01 - p4 - jar - p4 - 1.0 - - p4-org - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml deleted file mode 100644 index 93d1d72f64d2..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - p4 - maven.t02 - 1.0 - - 4.0.0 - maven.t02 - p5 - jar - p5 - 1.0 - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml deleted file mode 100644 index 77958f787afa..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - p3 - maven.t02 - 1.0 - - 4.0.0 - maven.t02 - p4 - pom - p4 - 1.0 - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml deleted file mode 100644 index d83de976d113..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - p2 - maven.t02 - 1.0 - - 4.0.0 - maven.t02 - p3 - pom - p3 - 1.0 - 2000 - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml deleted file mode 100644 index c2b7d7153e3a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - p1 - maven.t02 - 1.0 - - 4.0.0 - maven.t02 - p2 - pom - p2 - 1.0 - - - mailing-list - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml deleted file mode 100644 index af2d92ede4c5..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - p0 - maven.t02 - 1.0 - - 4.0.0 - maven.t02 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-compiler-plugin - - - test - package - - compile - - - - - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml deleted file mode 100644 index 3643fe49f3eb..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - 4.0.0 - maven.t02 - p0 - pom - p0 - 1.0 - - Codehaus - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml deleted file mode 100644 index 69fe6a1dce29..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - p0 - maven.t03 - 1.0 - - 4.0.0 - maven.t03 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml deleted file mode 100644 index 476ffdfbdd17..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - 4.0.0 - maven.t03 - p0 - pom - p0 - 1.0 - - Codehaus - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom deleted file mode 100644 index 5ca34c3a2e8e..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom +++ /dev/null @@ -1,21 +0,0 @@ - - 4.0.0 - maven-test - t04-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t04-b - 2.0 - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom deleted file mode 100644 index 4c311ab133d4..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t04-b - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom deleted file mode 100644 index d24e3bc1f571..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t04-b - jar - 2.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom deleted file mode 100644 index bef2488ba440..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t04-c - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom b/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom deleted file mode 100644 index d24e3bc1f571..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t04-b - jar - 2.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml deleted file mode 100644 index c25fc3e7388d..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - p0 - maven-t04 - 1.0 - - 4.0.0 - maven-t04 - p1 - pom - p1 - 1.0 - - scm-url - - - - - - maven-test - t04-a - - - - maven-test - t04-c - 1.0 - - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml deleted file mode 100644 index b7eb670ec6aa..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - maven-t04 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - - - - maven-test - t04-a - 1.0 - - - - maven-test - t04-b - 1.0 - - - - maven-test - t04-c - 2.0 - - - - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom deleted file mode 100644 index a1b8cb9b1137..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - t05-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t05-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom deleted file mode 100644 index 097101e81f3c..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - t05-a - jar - 2.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t05-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom deleted file mode 100644 index e0490ff73be0..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t05-b - jar - 1.0 - - - maven-test - t05-c - 1.0 - jar - compile - - - maven-test - t05-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom deleted file mode 100644 index ff59f5d2b7a2..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t05-b - jar - 1.1 - - - maven-test - t05-c - 1.0 - jar - compile - - - maven-test - t05-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom deleted file mode 100644 index 79370ec4f01c..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t05-b - jar - 2.0 - - - maven-test - t05-c - 1.0 - jar - compile - - - maven-test - t05-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom deleted file mode 100644 index 0edc3ddd6f50..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t05-c - jar - 1.0 - - - maven-test - t05-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom deleted file mode 100644 index 9290b033d5e0..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t05-d - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom deleted file mode 100644 index b4af4b2cdb89..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t05-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom b/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom deleted file mode 100644 index 09e1d9470c89..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t05-d - jar - 1.2 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml deleted file mode 100644 index d9c2d52bba32..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - p0 - maven-t05 - 1.0 - - 4.0.0 - maven-t05 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-test - t05-b - 1.0 - - - maven-test - t05-d - 1.0 - - - - - - maven-test - t05-a - 1.0 - runtime - - - maven-test - t05-c - 1.0 - runtime - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml deleted file mode 100644 index 6c93838b93a8..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - 4.0.0 - maven-t05 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - maven-test - t05-a - 1.0 - - - maven-test - t05-b - 1.1 - - - maven-test - t05-c - 1.0 - compile - - - maven-test - t05-d - 1.2 - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom deleted file mode 100644 index 21aa5f556be0..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - t06-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t06-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom deleted file mode 100644 index a9af131cba8a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t06-b - jar - 1.0 - - - maven-test - t06-c - 1.0 - jar - compile - - - maven-test - t06-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom deleted file mode 100644 index a9af131cba8a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t06-b - jar - 1.0 - - - maven-test - t06-c - 1.0 - jar - compile - - - maven-test - t06-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom deleted file mode 100644 index 80272114a8c2..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t06-c - jar - 1.0 - - - maven-test - t06-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom deleted file mode 100644 index e4531ab4a7ca..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t06-d - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom deleted file mode 100644 index c146cb89a6a5..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t06-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom b/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom deleted file mode 100644 index ff91f975ae2d..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t06-d - jar - 1.2 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml deleted file mode 100644 index 468621901e57..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - p0 - maven-t06 - 1.0 - - 4.0.0 - maven-t06 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-test - t06-b - 1.0 - - - maven-test - t06-d - 1.0 - test - false - - - - - - maven-test - t06-a - 1.0 - - - maven-test - t06-c - 1.0 - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml deleted file mode 100644 index 60c540ca1227..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - maven-t06 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - maven-test - t06-a - 1.0 - - - maven-test - t06-b - 1.1 - - - maven-test - t06-c - 1.0 - - - maven-test - t06-d - 1.2 - test - false - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom deleted file mode 100644 index 05665a9c27c9..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - t07-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t07-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom deleted file mode 100644 index 8ce6751c9320..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t07-b - jar - 1.0 - - - maven-test - t07-c - 1.0 - jar - compile - - - maven-test - t07-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom deleted file mode 100644 index 689ad055ed99..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t07-b - jar - 1.1 - - - maven-test - t07-c - 1.0 - jar - compile - - - maven-test - t07-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom deleted file mode 100644 index 494470c49ba5..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t07-c - jar - 1.0 - - - maven-test - t07-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom deleted file mode 100644 index 5761d515471b..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t07-d - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom deleted file mode 100644 index 08fc179c17ad..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t07-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom b/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom deleted file mode 100644 index 544ccc59a08c..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t07-d - jar - 1.2 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml deleted file mode 100644 index 6f700429a02a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - p0 - maven-t07 - 1.0 - - 4.0.0 - maven-t07 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-test - t07-b - 1.0 - - - maven-test - t07-d - 1.0 - test - false - - - - - - maven-test - t07-a - 1.0 - - - maven-test - t07-c - 1.0 - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml deleted file mode 100644 index b500ee0e5867..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - maven-t07 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - maven-test - t07-a - 1.0 - - - maven-test - t07-b - 1.1 - - - maven-test - t07-c - 1.0 - - - maven-test - t07-d - 1.2 - test - false - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom deleted file mode 100644 index 186c2d89f159..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - t08-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - t08-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom deleted file mode 100644 index d866ab355699..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t08-b - jar - 1.0 - - - maven-test - t08-c - 1.0 - jar - compile - - - maven-test - t08-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom deleted file mode 100644 index d402466e9f1b..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t08-b - jar - 1.1 - - - maven-test - t08-c - 1.0 - jar - compile - - - maven-test - t08-d - 1.1 - jar - compile - false - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom deleted file mode 100644 index d8250528e231..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t08-c - jar - 1.0 - - - maven-test - t08-d - 1.1 - jar - compile - true - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom deleted file mode 100644 index f4530458802c..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t08-d - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom deleted file mode 100644 index c7703b02db43..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t08-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom b/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom deleted file mode 100644 index e341be534df3..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t08-d - jar - 1.2 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml deleted file mode 100644 index 331996d87e93..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - p0 - maven-t08 - 1.0 - - 4.0.0 - maven-t08 - p1 - pom - p1 - 1.0 - - scm-url - - - - - maven-test - t08-b - 1.0 - - - maven-test - t08-d - 1.0 - test - true - - - - - - maven-test - t08-a - 1.0 - - - maven-test - t08-c - 1.0 - - - maven-test - t08-d - 1.0 - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml deleted file mode 100644 index a18ab853d1b1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - maven-t08 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - maven-test - t08-a - 1.0 - - - maven-test - t08-b - 1.1 - - - maven-test - t08-c - 1.0 - - - maven-test - t08-d - 1.2 - test - false - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom deleted file mode 100644 index 54cf647b2b1a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t09-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - - maven-test - t09-b - 1.0 - compile - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom deleted file mode 100644 index ce001c2f30db..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t09-b - jar - 1.0 - - - - maven-test - t09-c - 1.0 - compile - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom deleted file mode 100644 index da7bc3494673..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t09-c - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom deleted file mode 100644 index 862274728a4a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom +++ /dev/null @@ -1,17 +0,0 @@ - - 4.0.0 - maven-test - t09-d - jar - 1.0 - - - - maven-test - t09-c - 1.0 - compile - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml deleted file mode 100644 index ae4358436dc1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - p0 - maven-t09 - 1.0 - - 4.0.0 - maven-t09 - p1 - pom - p1 - 1.0 - - scm-url - - - - - - maven-test - t09-a - - - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml deleted file mode 100644 index 4681c2efe83a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - p0 - maven-t09 - 1.0 - - 4.0.0 - maven-t09 - p2 - pom - p2 - 1.0 - - scm-url - - - - - - maven-test - t09-a - - - - maven-test - t09-d - 1.0 - - - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml deleted file mode 100644 index a93746d28194..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - 4.0.0 - maven-t09 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - - - - maven-test - t09-a - 1.0 - - - - maven-test - t09-b - 1.0 - - - maven-test - t09-c - - - - - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom deleted file mode 100644 index 1fc2a2216a8a..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom +++ /dev/null @@ -1,24 +0,0 @@ - - 4.0.0 - maven-test - t10-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - - maven-test - t10-b - 1.0 - compile - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom deleted file mode 100644 index 64b5f97a0c39..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t10-b - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom deleted file mode 100644 index 6548ab300680..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - t10-c - jar - 1.0 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml deleted file mode 100644 index ed82ae1344cc..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - p0 - maven-t10 - 1.0 - - 4.0.0 - maven-t10 - p1 - pom - p1 - 1.0 - - scm-url - - - - - - maven-test - t10-a - - - - maven-test - t10-c - runtime - - - - - - - - maven-antrun-plugin - - ${project.parent.basedir} - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml deleted file mode 100644 index 74b631756cea..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - 4.0.0 - maven-t10 - p0 - pom - p0 - 1.0 - - Codehaus - - - - - - - - maven-test - t10-a - 1.0 - test - - - - maven-test - t10-b - 1.0 - runtime - - - - maven-test - t10-c - 1.0 - test - - - - - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml deleted file mode 100644 index e4c79be4576f..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - maven - p1 - jar - p1 - 1.0 - - scm-url - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml deleted file mode 100644 index 23b07e2c0ad8..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - 4.0.0 - maven - p0 - pom - p0 - 1.0 - - Codehaus - - - - - - - - maven - p1 - 1.0 - test - - - - - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml deleted file mode 100644 index 15115cb85689..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - p0 - maven - 1.0 - - 4.0.0 - p1 - jar - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - normal - - - compile - - - - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml deleted file mode 100644 index 4f2e64262d06..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml +++ /dev/null @@ -1,30 +0,0 @@ - - 4.0.0 - maven - p0 - pom - 1.0 - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - test - - - false - - - compile - - install - - - - - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom deleted file mode 100644 index a22df68eac12..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom +++ /dev/null @@ -1,18 +0,0 @@ - - 4.0.0 - maven - p0 - pom - 1.0 - - - scm:svn:http://host/p0 - scm:svn:https://host/p0 - http://host/viewer?path=/p0 - - - - modules/p1 - - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom b/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom deleted file mode 100644 index 736b51539b45..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom +++ /dev/null @@ -1,11 +0,0 @@ - - - p0 - maven - 1.0 - ../../pom.xml - - 4.0.0 - p1 - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml deleted file mode 100644 index 736b51539b45..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - p0 - maven - 1.0 - ../../pom.xml - - 4.0.0 - p1 - - diff --git a/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml b/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml deleted file mode 100644 index a22df68eac12..000000000000 --- a/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml +++ /dev/null @@ -1,18 +0,0 @@ - - 4.0.0 - maven - p0 - pom - 1.0 - - - scm:svn:http://host/p0 - scm:svn:https://host/p0 - http://host/viewer?path=/p0 - - - - modules/p1 - - - diff --git a/maven-compat/src/test/resources/local-repo/marker.txt b/maven-compat/src/test/resources/local-repo/marker.txt deleted file mode 100644 index d9bab060dde5..000000000000 --- a/maven-compat/src/test/resources/local-repo/marker.txt +++ /dev/null @@ -1 +0,0 @@ -this is just a marker file. \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar b/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar b/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar b/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar b/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar deleted file mode 100644 index 257cc5642cb1..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom b/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom deleted file mode 100644 index 6905f6c8de25..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - maven-test-a - jar - 1.0 - - - central - Fake Maven Central Repository - file://dummy - - - - - maven-test - maven-test-b - 1.0 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom b/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom deleted file mode 100644 index e814951a0dbb..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom +++ /dev/null @@ -1,23 +0,0 @@ - - 4.0.0 - maven-test - maven-test-b - jar - 1.0 - - - maven-test - maven-test-c - 1.0 - jar - compile - - - maven-test - maven-test-d - 1.1 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom b/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom deleted file mode 100644 index 4631b88f3c1c..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom +++ /dev/null @@ -1,16 +0,0 @@ - - 4.0.0 - maven-test - maven-test-c - jar - 1.0 - - - maven-test - maven-test-d - 1.2 - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom b/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom deleted file mode 100644 index 6e22f6083ef2..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom b/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom deleted file mode 100644 index 6e22f6083ef2..000000000000 --- a/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom +++ /dev/null @@ -1,7 +0,0 @@ - - 4.0.0 - maven-test - maven-test-d - jar - 1.1 - \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar deleted file mode 100644 index c2c027fec1a7..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar +++ /dev/null @@ -1 +0,0 @@ -local \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version deleted file mode 100644 index 09f9180ff24b..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version +++ /dev/null @@ -1 +0,0 @@ -20040101.101010 \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar deleted file mode 100644 index c2c027fec1a7..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar +++ /dev/null @@ -1 +0,0 @@ -local \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version deleted file mode 100644 index 09f9180ff24b..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version +++ /dev/null @@ -1 +0,0 @@ -20040101.101010 \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar deleted file mode 100644 index c2c027fec1a7..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar +++ /dev/null @@ -1 +0,0 @@ -local \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version b/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version deleted file mode 100644 index 09f9180ff24b..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version +++ /dev/null @@ -1 +0,0 @@ -20040101.101010 \ No newline at end of file diff --git a/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom b/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom deleted file mode 100644 index 64a075f4e98f..000000000000 --- a/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom +++ /dev/null @@ -1,49 +0,0 @@ - - snapshot-test - maven-test-snapshot-resolving - jar - - - central - Fake Maven Central Repository - file://dummy - - - - - snapshot-test - maven-snapshot-a - 1.0-SNAPSHOT - jar - compile - - - snapshot-test - maven-snapshot-b - 1.0-SNAPSHOT - jar - compile - - - snapshot-test - maven-snapshot-c - 1.0-SNAPSHOT - jar - compile - - - snapshot-test - maven-snapshot-d - 1.0-SNAPSHOT - jar - compile - - - snapshot-test - maven-snapshot-e - 1.0-SNAPSHOT - jar - compile - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml b/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml deleted file mode 100644 index f7c381fe2cc0..000000000000 --- a/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml b/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml deleted file mode 100644 index f7c381fe2cc0..000000000000 --- a/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml b/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml deleted file mode 100644 index 925022ef95f1..000000000000 --- a/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - org.apache.maven.wagon.Wagon - a - org.apache.maven.artifact.manager.WagonA - - - org.apache.maven.wagon.Wagon - b1 - org.apache.maven.artifact.manager.WagonB - - - org.apache.maven.wagon.Wagon - b2 - org.apache.maven.artifact.manager.WagonB - - - org.apache.maven.wagon.Wagon - c - org.apache.maven.artifact.manager.WagonC - - - org.apache.maven.wagon.Wagon - string - org.apache.maven.artifact.manager.StringWagon - - - diff --git a/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml b/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml deleted file mode 100644 index 2b950859de03..000000000000 --- a/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - org.apache.maven.artifact.resolver.ArtifactResolver - default - org.apache.maven.artifact.resolver.DefaultArtifactResolver - false - - - org.codehaus.plexus.logging.Logger - default - logger - - - org.apache.maven.artifact.factory.ArtifactFactory - default - artifactFactory - - - org.apache.maven.artifact.resolver.ArtifactCollector - default - artifactCollector - - - org.apache.maven.artifact.resolver.ResolutionErrorHandler - default - resolutionErrorHandler - - - org.apache.maven.artifact.metadata.ArtifactMetadataSource - test - source - - - org.codehaus.plexus.PlexusContainer - default - container - - - org.apache.maven.plugin.LegacySupport - default - legacySupport - - - org.eclipse.aether.RepositorySystem - default - repoSystem - - - - - diff --git a/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml b/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml deleted file mode 100644 index b434d7b93dc8..000000000000 --- a/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - org.apache.maven.wagon.Wagon - testfile - org.apache.maven.artifact.resolver.TestFileWagon - per-lookup - - - \ No newline at end of file diff --git a/maven-compat/src/test/resources/pom.xml b/maven-compat/src/test/resources/pom.xml deleted file mode 100644 index bad0e6e23e21..000000000000 --- a/maven-compat/src/test/resources/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - 4.0.0 - org.apache.maven - maven-core - jar - Maven - 2.0-SNAPSHOT - 2001 - - - org.apache.maven - maven-model - 2.0-SNAPSHOT - jar - compile - - - org.apache.maven - maven-plugin - 2.0-SNAPSHOT - jar - compile - - - commons-cli - commons-cli - 1.0-beta-2 - jar - compile - - - plexus - plexus-i18n - 1.0-beta-2-SNAPSHOT - jar - compile - - - ognl - ognl - 3.0.12 - jar - compile - - - marmalade - marmalade-core - 0.1 - jar - compile - - - marmalade - marmalade-el-ognl - 0.1 - jar - compile - - - plexus - plexus-compiler-api - 1.0 - jar - compile - - - plexus - plexus-compiler-javac - 1.0 - jar - compile - - - surefire - surefire-booter - 1.1 - jar - compile - - - maven - wagon-api - 0.9-SNAPSHOT - jar - compile - - - org.apache.maven - wagon-http-lightweight - 0.9-SNAPSHOT - jar - compile - - - maven - wagon-ssh - 0.9-SNAPSHOT - jar - compile - - - jsch - jsch - 0.1.14 - jar - compile - - - qdox - qdox - 1.2 - jar - compile - - - diff --git a/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml b/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml deleted file mode 100644 index c706250170c7..000000000000 --- a/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - 4.0.0 - maven - maven-project-test - Maven - 1.0-beta-9 - - - - maven-test - scope-default - 1.0 - - - - maven-test - scope-test - 1.0 - test - - - - maven-test - scope-runtime - 1.0 - runtime - - - - maven-test - scope-compile - 1.0 - compile - - - - maven-test - scope-provided - 1.0 - provided - - - - maven-inherited - scope-default - 1.0 - - - - maven-inherited - scope-compile - 1.0 - compile - - - - maven-inherited - scope-runtime - 1.0 - runtime - - - - maven-inherited - scope-test - 1.0 - test - - - - maven-inherited - scope-provided - 1.0 - provided - - - - diff --git a/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml b/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml deleted file mode 100644 index 1161c6986810..000000000000 --- a/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - 4.0.0 - maven-test - scope-compile - 1.0 - - - - maven-test-compile - scope-default - 1.0 - - - - maven-test-compile - scope-test - 1.0 - test - - - - maven-test-compile - scope-runtime - 1.0 - runtime - - - - maven-test-compile - scope-compile - 1.0 - compile - - - - diff --git a/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml b/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml deleted file mode 100644 index c904be0ef9ae..000000000000 --- a/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - 4.0.0 - maven-test - scope-default - 1.0 - - - - maven-test-default - scope-default - 1.0 - - - - maven-test-default - scope-test - 1.0 - test - - - - maven-test-default - scope-runtime - 1.0 - runtime - - - - maven-test-default - scope-compile - 1.0 - compile - - - - - diff --git a/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml b/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml deleted file mode 100644 index b85669ce033e..000000000000 --- a/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - 4.0.0 - maven-test - scope-provided - 1.0 - - - - maven-test-provided - scope-default - 1.0 - - - - maven-test-provided - scope-test - 1.0 - test - - - - maven-test-provided - scope-runtime - 1.0 - runtime - - - - maven-test-provided - scope-compile - 1.0 - compile - - - - diff --git a/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml b/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml deleted file mode 100644 index 921723c7e0fb..000000000000 --- a/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - 4.0.0 - maven-test - scope-runtime - 1.0 - - - - maven-test-runtime - scope-default - 1.0 - - - - maven-test-runtime - scope-test - 1.0 - test - - - - maven-test-runtime - scope-runtime - 1.0 - runtime - - - - maven-test-runtime - scope-compile - 1.0 - compile - - - - - diff --git a/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml b/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml deleted file mode 100644 index ea2dde9f48c0..000000000000 --- a/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - 4.0.0 - maven-test - scope-test - 1.0 - - - - maven-test-test - scope-default - 1.0 - - - - maven-test-test - scope-test - 1.0 - test - - - - maven-test-test - scope-runtime - 1.0 - runtime - - - - maven-test-test - scope-compile - 1.0 - compile - - - - - diff --git a/maven-core/pom.xml b/maven-core/pom.xml index f79a0d40df13..395932a4b706 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -327,7 +327,6 @@ under the License. org.apache.maven.toolchain.DefaultToolchainManager#logger org.apache.maven.project.ProjectSorter#getDAG():METHOD_REMOVED - org.apache.maven.plugin.PluginManager org.apache.maven.repository.ArtifactDoesNotExistException org.apache.maven.repository.ArtifactTransferEvent diff --git a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java index 1defc485567f..347f74b1d56d 100644 --- a/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java +++ b/maven-core/src/main/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilter.java @@ -34,11 +34,9 @@ */ public class ExclusionArtifactFilter implements ArtifactFilter { - private final List exclusions; private final List> predicates; public ExclusionArtifactFilter(List exclusions) { - this.exclusions = exclusions; this.predicates = exclusions.stream().map(ExclusionArtifactFilter::toPredicate).collect(Collectors.toList()); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java index 91e1adbc645f..a2f62d62c1b9 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java @@ -48,8 +48,6 @@ public class DefaultLifecycles { private final Logger logger = LoggerFactory.getLogger(getClass()); - // @Configuration(source="org/apache/maven/lifecycle/lifecycles.xml") - private final Lookup lookup; private final LifecycleRegistry registry; @@ -147,10 +145,9 @@ public List getLifeCycles() { } private Map lookupLifecycles() { - // TODO: Remove the following code when maven-compat is gone - // This code is here to ensure maven-compat's EmptyLifecycleExecutor keeps on working. if (lookup == null) { - return customLifecycles != null ? customLifecycles : new HashMap<>(); + throw new IllegalStateException( + "Unable to lookup lifecycles from the plexus container, since lookup is not set"); } // Lifecycles cannot be cached as extensions might add custom lifecycles later in the execution. diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java deleted file mode 100644 index 0cf8fee6ad35..000000000000 --- a/maven-core/src/main/java/org/apache/maven/plugin/internal/Maven3CompatDependenciesValidator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.maven.plugin.internal; - -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.apache.maven.api.DependencyScope; -import org.apache.maven.plugin.PluginValidationManager; -import org.eclipse.aether.RepositorySystemSession; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.resolution.ArtifactDescriptorResult; - -/** - * Detects Maven3 plugins using maven-compat Maven2 compatibility layer. - * - * @since 3.9.3 - */ -@Singleton -@Named -class Maven3CompatDependenciesValidator extends AbstractMavenPluginDependenciesValidator { - - @Inject - Maven3CompatDependenciesValidator(PluginValidationManager pluginValidationManager) { - super(pluginValidationManager); - } - - @Override - protected void doValidate( - RepositorySystemSession session, - Artifact pluginArtifact, - ArtifactDescriptorResult artifactDescriptorResult) { - for (org.eclipse.aether.graph.Dependency dependency : artifactDescriptorResult.getDependencies()) { - if ("org.apache.maven".equals(dependency.getArtifact().getGroupId()) - && "maven-compat".equals(dependency.getArtifact().getArtifactId()) - && !DependencyScope.TEST.is(dependency.getScope())) { - pluginValidationManager.reportPluginValidationIssue( - PluginValidationManager.IssueLocality.EXTERNAL, - session, - pluginArtifact, - "Plugin depends on the deprecated Maven 2.x compatibility layer, which will be not supported in Maven 4.x"); - } - } - } -} diff --git a/maven-core/src/main/resources/META-INF/maven/extension.xml b/maven-core/src/main/resources/META-INF/maven/extension.xml index 8a87ea31f39e..18063f947624 100644 --- a/maven-core/src/main/resources/META-INF/maven/extension.xml +++ b/maven-core/src/main/resources/META-INF/maven/extension.xml @@ -167,7 +167,6 @@ under the License. org.apache.maven:maven-aether-provider org.apache.maven:maven-resolver-provider org.apache.maven:maven-artifact-manager - org.apache.maven:maven-compat org.apache.maven:maven-core org.apache.maven:maven-error-diagnostics org.apache.maven:maven-lifecycle diff --git a/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java b/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java index 4347e1a8dcc1..12f8e94f94f3 100644 --- a/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java +++ b/maven-core/src/test/java/org/apache/maven/artifact/resolver/filter/ExclusionArtifactFilterTest.java @@ -80,7 +80,7 @@ void testExcludeGroupIdWildcard() { void testExcludeGroupIdWildcardNoMatch() { Exclusion exclusion = new Exclusion(); exclusion.setGroupId("*"); - exclusion.setArtifactId("maven-compat"); + exclusion.setArtifactId("maven-model"); ExclusionArtifactFilter filter = new ExclusionArtifactFilter(Collections.singletonList(exclusion)); assertThat(filter.include(artifact), is(true)); diff --git a/maven-core/src/test/projects/lifecycle-executor/project-with-inheritance/pom.xml b/maven-core/src/test/projects/lifecycle-executor/project-with-inheritance/pom.xml index 72144779adbf..1b507c77df1b 100644 --- a/maven-core/src/test/projects/lifecycle-executor/project-with-inheritance/pom.xml +++ b/maven-core/src/test/projects/lifecycle-executor/project-with-inheritance/pom.xml @@ -245,7 +245,6 @@ under the License. maven-mercury maven-embedder maven-toolchain - maven-compat maven-repository maven-repository-mercury @@ -323,11 +322,6 @@ under the License. maven-repository ${project.version}
- - org.apache.maven - maven-compat - ${project.version} - diff --git a/maven-core/src/test/projects/plugin-manager/project-with-inheritance/pom.xml b/maven-core/src/test/projects/plugin-manager/project-with-inheritance/pom.xml index 72144779adbf..1b507c77df1b 100644 --- a/maven-core/src/test/projects/plugin-manager/project-with-inheritance/pom.xml +++ b/maven-core/src/test/projects/plugin-manager/project-with-inheritance/pom.xml @@ -245,7 +245,6 @@ under the License. maven-mercury maven-embedder maven-toolchain - maven-compat maven-repository maven-repository-mercury @@ -323,11 +322,6 @@ under the License. maven-repository ${project.version} - - org.apache.maven - maven-compat - ${project.version} - diff --git a/maven-core/src/test/resources/org/apache/maven/lifecycle/pom.xml b/maven-core/src/test/resources/org/apache/maven/lifecycle/pom.xml index 39e165456d5f..1cede14fe997 100644 --- a/maven-core/src/test/resources/org/apache/maven/lifecycle/pom.xml +++ b/maven-core/src/test/resources/org/apache/maven/lifecycle/pom.xml @@ -245,7 +245,6 @@ under the License. maven-mercury maven-embedder maven-toolchain - maven-compat maven-repository maven-repository-mercury @@ -323,11 +322,6 @@ under the License. maven-repository ${project.version} - - org.apache.maven - maven-compat - ${project.version} - diff --git a/pom.xml b/pom.xml index 9a0ec80baa98..1ada7befdf79 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,6 @@ under the License. maven-slf4j-provider maven-slf4j-wrapper maven-embedder - maven-compat apache-maven maven-toolchain-model maven-toolchain-builder @@ -337,11 +336,6 @@ under the License. maven-xml-impl ${project.version} - - org.apache.maven - maven-compat - ${project.version} - org.apache.maven maven-slf4j-provider diff --git a/src/site/resources/images/maven-deps.svg b/src/site/resources/images/maven-deps.svg index ae738b0799e0..6c854c0941a8 100644 --- a/src/site/resources/images/maven-deps.svg +++ b/src/site/resources/images/maven-deps.svg @@ -707,6 +707,7 @@ +