From 753a6c60f47f3ac4f270005b65e9d6481de8eb68 Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Fri, 23 Oct 2015 10:00:02 -0700 Subject: Adding maven and ant source trees Change-Id: I0a39b9add833a31b9c3f98d193983ae2f3a5a445 Signed-off-by: Ashlee Young --- .../maven/apache-maven-3.3.3/maven-compat/pom.xml | 115 +++ .../apache/maven/artifact/ArtifactScopeEnum.java | 133 +++ .../org/apache/maven/artifact/ArtifactStatus.java | 124 +++ .../artifact/UnknownRepositoryLayoutException.java | 54 ++ .../maven/artifact/deployer/ArtifactDeployer.java | 61 ++ .../deployer/ArtifactDeploymentException.java | 43 + .../artifact/deployer/DefaultArtifactDeployer.java | 161 ++++ .../installer/ArtifactInstallationException.java | 43 + .../artifact/installer/ArtifactInstaller.java | 60 ++ .../installer/DefaultArtifactInstaller.java | 135 +++ .../artifact/manager/DefaultWagonManager.java | 182 ++++ .../manager/WagonConfigurationException.java | 38 + .../maven/artifact/manager/WagonManager.java | 56 ++ .../repository/ArtifactRepositoryFactory.java | 55 ++ .../repository/DefaultArtifactRepository.java | 267 ++++++ .../DefaultArtifactRepositoryFactory.java | 124 +++ .../repository/layout/FlatRepositoryLayout.java | 92 ++ .../metadata/DefaultRepositoryMetadataManager.java | 558 ++++++++++++ .../metadata/GroupRepositoryMetadata.java | 119 +++ .../repository/metadata/MetadataBridge.java | 172 ++++ .../repository/metadata/MetadataUtils.java | 39 + .../metadata/RepositoryMetadataReadException.java | 40 + .../SnapshotArtifactRepositoryMetadata.java | 98 ++ .../maven/artifact/resolver/ArtifactCollector.java | 42 + .../maven/artifact/resolver/ArtifactResolver.java | 108 +++ .../artifact/resolver/DebugResolutionListener.java | 167 ++++ .../resolver/DefaultArtifactCollector.java | 30 + .../artifact/resolver/DefaultArtifactResolver.java | 643 ++++++++++++++ .../resolver/ResolutionListenerForDepMgmt.java | 43 + .../artifact/resolver/UnresolvedArtifacts.java | 66 ++ .../resolver/WarningResolutionListener.java | 90 ++ .../resolver/filter/InversionArtifactFilter.java | 65 ++ .../artifact/resolver/filter/OrArtifactFilter.java | 93 ++ .../resolver/filter/TypeArtifactFilter.java | 66 ++ .../artifact/versioning/ManagedVersionMap.java | 56 ++ .../maven/execution/DefaultRuntimeInformation.java | 64 ++ .../apache/maven/execution/RuntimeInformation.java | 34 + .../profiles/DefaultMavenProfilesBuilder.java | 93 ++ .../maven/profiles/DefaultProfileManager.java | 248 ++++++ .../maven/profiles/MavenProfilesBuilder.java | 37 + .../org/apache/maven/profiles/ProfileManager.java | 58 ++ .../maven/profiles/ProfilesConversionUtils.java | 151 ++++ .../activation/DetectedProfileActivator.java | 35 + .../profiles/activation/FileProfileActivator.java | 109 +++ .../activation/JdkPrefixProfileActivator.java | 97 ++ .../OperatingSystemProfileActivator.java | 161 ++++ .../activation/ProfileActivationException.java | 39 + .../profiles/activation/ProfileActivator.java | 33 + .../activation/SystemPropertyProfileActivator.java | 114 +++ .../maven/project/DefaultMavenProjectBuilder.java | 324 +++++++ .../DefaultProjectBuilderConfiguration.java | 107 +++ .../project/InvalidProjectModelException.java | 74 ++ .../apache/maven/project/MavenProjectBuilder.java | 76 ++ .../project/MissingRepositoryElementException.java | 38 + .../java/org/apache/maven/project/ModelUtils.java | 367 ++++++++ .../maven/project/ProjectBuilderConfiguration.java | 55 ++ .../org/apache/maven/project/ProjectUtils.java | 118 +++ .../DefaultModelInheritanceAssembler.java | 752 ++++++++++++++++ .../inheritance/ModelInheritanceAssembler.java | 41 + .../AbstractStringBasedModelInterpolator.java | 407 +++++++++ .../interpolation/BuildTimestampValueSource.java | 63 ++ .../interpolation/ModelInterpolationException.java | 72 ++ .../project/interpolation/ModelInterpolator.java | 66 ++ .../PathTranslatingPostProcessor.java | 64 ++ .../interpolation/RegexBasedModelInterpolator.java | 58 ++ .../StringSearchModelInterpolator.java | 410 +++++++++ .../maven/project/path/DefaultPathTranslator.java | 261 ++++++ .../project/validation/DefaultModelValidator.java | 76 ++ .../project/validation/ModelValidationResult.java | 95 ++ .../maven/project/validation/ModelValidator.java | 37 + .../maven/reporting/MavenReportException.java | 39 + .../maven/repository/DefaultMirrorSelector.java | 205 +++++ .../maven/repository/MavenArtifactMetadata.java | 119 +++ .../org/apache/maven/repository/MetadataGraph.java | 96 ++ .../apache/maven/repository/MetadataGraphNode.java | 101 +++ .../repository/MetadataResolutionRequest.java | 202 +++++ .../maven/repository/MetadataResolutionResult.java | 356 ++++++++ .../apache/maven/repository/MirrorSelector.java | 44 + .../repository/UserLocalArtifactRepository.java | 74 ++ .../maven/repository/VersionNotFoundException.java | 83 ++ .../repository/legacy/ChecksumFailedException.java | 42 + .../legacy/DefaultUpdateCheckManager.java | 438 +++++++++ .../repository/legacy/DefaultWagonManager.java | 823 +++++++++++++++++ .../repository/legacy/LegacyRepositorySystem.java | 906 +++++++++++++++++++ .../maven/repository/legacy/MavenArtifact.java | 96 ++ .../repository/legacy/TransferListenerAdapter.java | 187 ++++ .../repository/legacy/UpdateCheckManager.java | 41 + .../legacy/WagonConfigurationException.java | 63 ++ .../maven/repository/legacy/WagonManager.java | 79 ++ .../repository/ArtifactRepositoryFactory.java | 56 ++ .../DefaultArtifactRepositoryFactory.java | 144 +++ .../resolver/DefaultLegacyArtifactCollector.java | 796 +++++++++++++++++ .../legacy/resolver/LegacyArtifactCollector.java | 62 ++ .../legacy/resolver/conflict/ConflictResolver.java | 44 + .../resolver/conflict/ConflictResolverFactory.java | 48 + .../ConflictResolverNotFoundException.java | 47 + .../resolver/conflict/DefaultConflictResolver.java | 36 + .../conflict/DefaultConflictResolverFactory.java | 80 ++ .../conflict/FarthestConflictResolver.java | 47 + .../resolver/conflict/NearestConflictResolver.java | 48 + .../resolver/conflict/NewestConflictResolver.java | 62 ++ .../resolver/conflict/OldestConflictResolver.java | 62 ++ .../transform/AbstractVersionTransformation.java | 135 +++ .../resolver/transform/ArtifactTransformation.java | 86 ++ .../transform/ArtifactTransformationManager.java | 82 ++ .../DefaultArtifactTransformationManager.java | 86 ++ .../transform/LatestArtifactTransformation.java | 74 ++ .../transform/ReleaseArtifactTransformation.java | 100 +++ .../resolver/transform/SnapshotTransformation.java | 171 ++++ .../repository/metadata/ArtifactMetadata.java | 353 ++++++++ .../repository/metadata/ClasspathContainer.java | 144 +++ .../metadata/ClasspathTransformation.java | 46 + .../metadata/DefaultClasspathTransformation.java | 183 ++++ .../DefaultGraphConflictResolutionPolicy.java | 73 ++ .../metadata/DefaultGraphConflictResolver.java | 249 ++++++ .../metadata/GraphConflictResolutionException.java | 51 ++ .../metadata/GraphConflictResolutionPolicy.java | 35 + .../repository/metadata/GraphConflictResolver.java | 48 + .../maven/repository/metadata/MetadataGraph.java | 523 +++++++++++ .../repository/metadata/MetadataGraphEdge.java | 189 ++++ .../MetadataGraphTransformationException.java | 50 ++ .../repository/metadata/MetadataGraphVertex.java | 216 +++++ .../repository/metadata/MetadataResolution.java | 71 ++ .../metadata/MetadataResolutionException.java | 49 + .../metadata/MetadataResolutionRequest.java | 79 ++ .../MetadataResolutionRequestTypeEnum.java | 45 + .../metadata/MetadataResolutionResult.java | 172 ++++ .../metadata/MetadataRetrievalException.java | 59 ++ .../maven/repository/metadata/MetadataSource.java | 39 + .../repository/metadata/MetadataTreeNode.java | 148 ++++ .../plugin/ExpressionDocumentationException.java | 37 + .../usability/plugin/ExpressionDocumenter.java | 175 ++++ .../maven-compat/src/main/mdo/paramdoc.mdo | 154 ++++ .../maven-compat/src/main/mdo/profiles.mdo | 398 +++++++++ .../maven/plugin-expressions/project.paramdoc.xml | 172 ++++ .../maven/plugin-expressions/rootless.paramdoc.xml | 48 + .../maven/plugin-expressions/settings.paramdoc.xml | 53 ++ .../src/main/resources/META-INF/maven/plugin.xml | 218 +++++ .../maven-compat/src/site/site.xml | 36 + .../AbstractArtifactComponentTestCase.java | 371 ++++++++ .../apache/maven/artifact/ArtifactUtilsTest.java | 79 ++ .../apache/maven/artifact/DefaultArtifactTest.java | 140 +++ .../artifact/deployer/ArtifactDeployerTest.java | 67 ++ .../deployer/SimpleArtifactMetadataSource.java | 66 ++ .../factory/DefaultArtifactFactoryTest.java | 49 + .../artifact/handler/ArtifactHandlerMock.java | 100 +++ .../artifact/installer/ArtifactInstallerTest.java | 61 ++ .../artifact/metadata/TestMetadataSource.java | 102 +++ .../repository/MavenArtifactRepositoryTest.java | 59 ++ .../resolver/ArtifactResolutionExceptionTest.java | 64 ++ .../artifact/resolver/ArtifactResolverTest.java | 283 ++++++ .../resolver/DefaultArtifactResolverTest.java | 111 +++ .../maven/artifact/resolver/TestFileWagon.java | 94 ++ .../artifact/resolver/TestTransferListener.java | 43 + .../resolver/filter/AndArtifactFilterTest.java | 62 ++ .../resolver/filter/FilterHashEqualsTest.java | 50 ++ .../resolver/filter/OrArtifactFilterTest.java | 62 ++ .../resolver/filter/ScopeArtifactFilterTest.java | 96 ++ .../maven/artifact/testutils/TestFileManager.java | 224 +++++ .../transform/TransformationManagerTest.java | 46 + .../manager/DefaultProfileManagerTest.java | 232 +++++ .../project/AbstractMavenProjectTestCase.java | 185 ++++ .../maven/project/ClasspathArtifactResolver.java | 89 ++ .../maven/project/EmptyLifecycleExecutor.java | 110 +++ .../project/EmptyLifecyclePluginAnalyzer.java | 78 ++ .../project/LegacyLocalRepositoryManager.java | 192 ++++ .../org/apache/maven/project/ModelUtilsTest.java | 616 +++++++++++++ .../apache/maven/project/ProjectClasspathTest.java | 149 ++++ .../apache/maven/project/TestArtifactResolver.java | 30 + .../maven/project/TestMavenRepositorySystem.java | 30 + .../apache/maven/project/TestProjectBuilder.java | 68 ++ .../AbstractProjectInheritanceTestCase.java | 57 ++ .../inheritance/t00/ProjectInheritanceTest.java | 93 ++ .../inheritance/t01/ProjectInheritanceTest.java | 92 ++ .../inheritance/t02/ProjectInheritanceTest.java | 169 ++++ .../inheritance/t03/ProjectInheritanceTest.java | 68 ++ .../inheritance/t04/ProjectInheritanceTest.java | 86 ++ .../inheritance/t05/ProjectInheritanceTest.java | 79 ++ .../inheritance/t06/ProjectInheritanceTest.java | 80 ++ .../inheritance/t07/ProjectInheritanceTest.java | 82 ++ .../inheritance/t08/ProjectInheritanceTest.java | 81 ++ .../inheritance/t09/ProjectInheritanceTest.java | 119 +++ .../inheritance/t10/ProjectInheritanceTest.java | 94 ++ .../inheritance/t11/ProjectInheritanceTest.java | 64 ++ .../inheritance/t12/ProjectInheritanceTest.java | 65 ++ .../inheritance/t12scm/ProjectInheritanceTest.java | 125 +++ .../project/path/DefaultPathTranslatorTest.java | 58 ++ .../repository/DefaultMirrorSelectorTest.java | 38 + .../maven/repository/LegacyRepositoryLayout.java | 89 ++ .../repository/LegacyRepositorySystemTest.java | 206 +++++ .../maven/repository/MirrorProcessorTest.java | 259 ++++++ .../legacy/DefaultUpdateCheckManagerTest.java | 240 +++++ .../repository/legacy/DefaultWagonManagerTest.java | 422 +++++++++ .../legacy/LegacyRepositorySystemTest.java | 88 ++ .../maven/repository/legacy/PerLookupWagon.java | 38 + .../maven/repository/legacy/StringWagon.java | 107 +++ .../org/apache/maven/repository/legacy/WagonA.java | 39 + .../org/apache/maven/repository/legacy/WagonB.java | 39 + .../org/apache/maven/repository/legacy/WagonC.java | 39 + .../apache/maven/repository/legacy/WagonMock.java | 50 ++ .../resolver/DefaultArtifactCollectorTest.java | 984 +++++++++++++++++++++ .../conflict/AbstractConflictResolverTest.java | 143 +++ .../conflict/FarthestConflictResolverTest.java | 107 +++ .../conflict/NearestConflictResolverTest.java | 107 +++ .../conflict/NewestConflictResolverTest.java | 107 +++ .../conflict/OldestConflictResolverTest.java | 107 +++ .../DefaultClasspathTransformationTest.java | 120 +++ .../DefaultGraphConflictResolutionPolicyTest.java | 59 ++ .../metadata/DefaultGraphConflictResolverTest.java | 153 ++++ .../repository/metadata/TestMetadataSource.java | 99 +++ .../org/apache/maven/its/a/0.1/a-0.1.jar | Bin 0 -> 1898 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 0 -> 1936 bytes .../org/apache/maven/its/b/0.1/b-0.1.pom | 49 + .../org/apache/maven/its/b/maven-metadata.xml | 12 + .../test/repository-system/maven-core-2.1.0.jar | 0 .../resources/artifact-install/artifact-1.0.jar | 1 + .../inheritance-repo/t00/maven/poms/p0-1.0.pom | 11 + .../inheritance-repo/t00/maven/poms/p1-1.0.pom | 16 + .../inheritance-repo/t00/maven/poms/p2-1.0.pom | 18 + .../inheritance-repo/t00/maven/poms/p3-1.0.pom | 14 + .../inheritance-repo/t00/maven/poms/p4-1.0.pom | 13 + .../inheritance-repo/t01/maven.t01/poms/p0-1.0.pom | 11 + .../inheritance-repo/t01/maven.t01/poms/p1-1.0.pom | 16 + .../inheritance-repo/t01/maven.t01/poms/p2-1.0.pom | 16 + .../inheritance-repo/t01/maven.t01/poms/p3-1.0.pom | 16 + .../inheritance-repo/t01/maven.t01/poms/p4-1.0.pom | 16 + .../inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml | 32 + .../inheritance-repo/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 + .../resources/inheritance-repo/t02/p0/p1/pom.xml | 51 ++ .../test/resources/inheritance-repo/t02/p0/pom.xml | 30 + .../resources/inheritance-repo/t03/p0/p1/pom.xml | 45 + .../test/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 + .../resources/inheritance-repo/t04/p0/p1/pom.xml | 41 + .../test/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 + .../resources/inheritance-repo/t05/p0/p1/pom.xml | 54 ++ .../test/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 + .../resources/inheritance-repo/t06/p0/p1/pom.xml | 54 ++ .../test/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 + .../resources/inheritance-repo/t07/p0/p1/pom.xml | 54 ++ .../test/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 + .../resources/inheritance-repo/t08/p0/p1/pom.xml | 59 ++ .../test/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 + .../resources/inheritance-repo/t09/p0/p1/pom.xml | 36 + .../resources/inheritance-repo/t09/p0/p2/pom.xml | 42 + .../test/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 + .../resources/inheritance-repo/t10/p0/p1/pom.xml | 42 + .../test/resources/inheritance-repo/t10/p0/pom.xml | 41 + .../resources/inheritance-repo/t11/p0/p1/pom.xml | 16 + .../test/resources/inheritance-repo/t11/p0/pom.xml | 27 + .../resources/inheritance-repo/t12/p0/p1/pom.xml | 29 + .../test/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 + .../inheritance-repo/t12scm/p0/modules/p1/pom.xml | 11 + .../resources/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 + ...en-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version | 1 + .../jars/maven-snapshot-b-1.0-SNAPSHOT.jar | 1 + ...en-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version | 1 + .../jars/maven-snapshot-e-1.0-SNAPSHOT.jar | 1 + ...en-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version | 1 + .../poms/maven-test-snapshot-resolving-1.0.pom | 49 + .../artifact/deployer/ArtifactDeployerTest.xml | 23 + .../artifact/installer/ArtifactInstallerTest.xml | 23 + .../artifact/manager/DefaultWagonManagerTest.xml | 48 + .../artifact/resolver/ArtifactResolverTest.xml | 71 ++ .../artifact/resolver/ArtifactUpdatePolicyTest.xml | 29 + .../maven/project/AbstractMavenProjectTestCase.xml | 9 + .../maven-compat/src/test/resources/pom.xml | 155 ++++ .../scope/project-with-scoped-dependencies.xml | 99 +++ .../projects/scope/transitive-compile-dep.xml | 57 ++ .../projects/scope/transitive-default-dep.xml | 58 ++ .../projects/scope/transitive-provided-dep.xml | 57 ++ .../projects/scope/transitive-runtime-dep.xml | 58 ++ .../projects/scope/transitive-test-dep.xml | 58 ++ 373 files changed, 31420 insertions(+) create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/paramdoc.mdo create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/profiles.mdo create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/site/site.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerMock.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecyclePluginAnalyzer.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/repository-system/maven-core-2.1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/marker.txt create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/project/AbstractMavenProjectTestCase.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/pom.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml create mode 100644 framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml (limited to 'framework/src/maven/apache-maven-3.3.3/maven-compat') diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/pom.xml new file mode 100644 index 00000000..1b4c6c1a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/pom.xml @@ -0,0 +1,115 @@ + + + + + + 4.0.0 + + + org.apache.maven + maven + 3.3.3 + + + maven-compat + + Maven Compat + Maven2 classes maintained as compatibility layer. + + + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + scm:git:https://git-wip-us.apache.org/repos/asf/maven.git + maven-3.3.3 + + + + false + + + + + org.apache.maven + maven-model + + + org.apache.maven + maven-model-builder + + + org.apache.maven + maven-settings + + + org.apache.maven + maven-artifact + + + org.apache.maven + maven-core + + + org.codehaus.plexus + plexus-utils + + + org.codehaus.plexus + plexus-interpolation + + + org.eclipse.sisu + org.eclipse.sisu.plexus + + + org.codehaus.plexus + plexus-component-annotations + + + org.apache.maven.wagon + wagon-provider-api + + + + org.apache.maven.wagon + wagon-file + test + + + org.eclipse.aether + aether-connector-basic + test + + + org.eclipse.aether + aether-transport-wagon + test + + + + + + + org.codehaus.plexus + plexus-component-metadata + + + org.codehaus.modello + modello-maven-plugin + + 1.0.0 + + src/main/mdo/profiles.mdo + src/main/mdo/paramdoc.mdo + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java new file mode 100644 index 00000000..7051e3bf --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactScopeEnum.java @@ -0,0 +1,133 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Type safe reincarnation of Artifact scope. Also supplies the DEFAULT_SCOPE as well + * as convenience method to deal with scope relationships. + * + * @author Oleg Gusakov + * + */ + +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 + * + * @return + */ + public static final 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 + * @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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java new file mode 100644 index 00000000..3bd1e341 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactStatus.java @@ -0,0 +1,124 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.HashMap; +import java.util.Map; + +/** + * Type safe enumeration for the artifact status field. + * + * @author Brett Porter + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java new file mode 100644 index 00000000..5abe1105 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/UnknownRepositoryLayoutException.java @@ -0,0 +1,54 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import 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 ArtifactRepositoryLayout} + * component in the current container. + * + * @author jdcasey + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java new file mode 100644 index 00000000..072552cc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeployer.java @@ -0,0 +1,61 @@ +package org.apache.maven.artifact.deployer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java new file mode 100644 index 00000000..6e44ed3c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/ArtifactDeploymentException.java @@ -0,0 +1,43 @@ +package org.apache.maven.artifact.deployer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jason van Zyl + */ +public class 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java new file mode 100644 index 00000000..abbab821 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -0,0 +1,161 @@ +package org.apache.maven.artifact.deployer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Map; +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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +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; + +@Component( role = ArtifactDeployer.class, instantiationStrategy = "per-lookup" ) +public class DefaultArtifactDeployer + extends AbstractLogEnabled + implements ArtifactDeployer +{ + + @Requirement + private RepositorySystem repoSystem; + + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java new file mode 100644 index 00000000..9f1e45b9 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstallationException.java @@ -0,0 +1,43 @@ +package org.apache.maven.artifact.installer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Jason van Zyl + */ +public class 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java new file mode 100644 index 00000000..376eba20 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/ArtifactInstaller.java @@ -0,0 +1,60 @@ +package org.apache.maven.artifact.installer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** + * @author Michal Maczka + */ +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 instlal/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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java new file mode 100644 index 00000000..a2529757 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java @@ -0,0 +1,135 @@ +package org.apache.maven.artifact.installer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +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; + +/** + * @author Jason van Zyl + */ +@Component( role = ArtifactInstaller.class ) +public class DefaultArtifactInstaller + extends AbstractLogEnabled + implements ArtifactInstaller +{ + + @Requirement + private RepositorySystem repoSystem; + + @Requirement + 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(); + versioning.updateTimestamp(); + versioning.addVersion( artifact.getBaseVersion() ); + if ( artifact.isRelease() ) + { + versioning.setRelease( artifact.getBaseVersion() ); + } + artifact.addMetadata( new ArtifactRepositoryMetadata( artifact, versioning ) ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java new file mode 100644 index 00000000..29876e24 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java @@ -0,0 +1,182 @@ +package org.apache.maven.artifact.manager; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.Logger; + +@Component( role = WagonManager.class ) +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 + @Requirement + private Logger log; + + @Requirement + private LegacySupport legacySupport; + + @Requirement + private SettingsDecrypter settingsDecrypter; + + @Requirement + private MirrorSelector mirrorSelector; + + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java new file mode 100644 index 00000000..8065116f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonConfigurationException.java @@ -0,0 +1,38 @@ +package org.apache.maven.artifact.manager; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Olivier Lamy + */ +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java new file mode 100644 index 00000000..fb7ca8b6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/manager/WagonManager.java @@ -0,0 +1,56 @@ +package org.apache.maven.artifact.manager; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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. + * + * @author Michal Maczka + */ +@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 + */ + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java new file mode 100644 index 00000000..ac18b3ad --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java @@ -0,0 +1,55 @@ +package org.apache.maven.artifact.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.UnknownRepositoryLayoutException; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; + +/** @author jdcasey */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java new file mode 100644 index 00000000..e0a55879 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java @@ -0,0 +1,267 @@ +package org.apache.maven.artifact.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.repository.Proxy; +import org.apache.maven.wagon.repository.Repository; + +/** + * This class is an abstraction of the location from/to resources can be + * transfered. + * + * @author Michal Maczka + */ +@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(); + + /** + * 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(); + + 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 = mirroredRepositories; + } + else + { + this.mirroredRepositories = Collections.emptyList(); + } + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java new file mode 100644 index 00000000..658dbdac --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java @@ -0,0 +1,124 @@ +package org.apache.maven.artifact.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.eclipse.aether.RepositorySystemSession; + +/** + * @author jdcasey + */ +@Component( role = ArtifactRepositoryFactory.class ) +public class DefaultArtifactRepositoryFactory + implements ArtifactRepositoryFactory +{ + + @Requirement + private org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory factory; + + @Requirement + private LegacySupport legacySupport; + + @Requirement + private RepositorySystem repositorySystem; + + 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 ); + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java new file mode 100644 index 00000000..8553a312 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java @@ -0,0 +1,92 @@ +package org.apache.maven.artifact.repository.layout; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.codehaus.plexus.component.annotations.Component; + +/** + * The code in this class is taken from DefaultRepositorylayout, located at: + * http://svn.apache.org/viewvc/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java + * + */ +@Component( role = ArtifactRepositoryLayout.class, hint = "flat" ) +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().length() > 0 ) + { + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java new file mode 100644 index 00000000..e7937134 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java @@ -0,0 +1,558 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +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.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; +import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; +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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.WriterFactory; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * @author Jason van Zyl + */ +@Component( role = RepositoryMetadataManager.class ) +public class DefaultRepositoryMetadataManager + extends AbstractLogEnabled + implements RepositoryMetadataManager +{ + @Requirement + private WagonManager wagonManager; + + @Requirement + 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 + { + Metadata result; + + Reader reader = null; + try + { + reader = ReaderFactory.newXmlReader( mappingFile ); + + MetadataXpp3Reader mappingReader = new MetadataXpp3Reader(); + + result = mappingReader.read( reader, false ); + } + catch ( FileNotFoundException e ) + { + throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "'", e ); + } + catch ( IOException e ) + { + throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + + e.getMessage(), e ); + } + catch ( XmlPullParserException e ) + { + throw new RepositoryMetadataReadException( "Cannot read metadata from '" + mappingFile + "': " + + e.getMessage(), e ); + } + finally + { + IOUtil.close( reader ); + } + + return result; + } + + /** + * 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 ); + + Writer writer = null; + try + { + writer = WriterFactory.newXmlWriter( metadataFile ); + new MetadataXpp3Writer().write( writer, metadata ); + } + catch ( IOException e ) + { + String msg = "Could not write fixed metadata to " + metadataFile + ": " + e.getMessage(); + if ( getLogger().isDebugEnabled() ) + { + getLogger().warn( msg, e ); + } + else + { + getLogger().warn( msg ); + } + } + finally + { + IOUtil.close( writer ); + } + } + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java new file mode 100644 index 00000000..490b47f3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/GroupRepositoryMetadata.java @@ -0,0 +1,119 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.repository.ArtifactRepository; + +import java.util.Iterator; +import java.util.List; + +/** + * Metadata for the group directory of the repository. + * + * @author Brett Porter + */ +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 = (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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java new file mode 100644 index 00000000..bf199218 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataBridge.java @@ -0,0 +1,172 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.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.codehaus.plexus.util.FileUtils; +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. + * + * @author Benjamin Bentmann + */ +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() ) + { + FileUtils.copyFile( current, result ); + } + 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; + } + + 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; + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java new file mode 100644 index 00000000..bdc4a795 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/MetadataUtils.java @@ -0,0 +1,39 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Assists in handling repository metadata. + * + * @author Benjamin Bentmann + */ +class MetadataUtils +{ + + public static Metadata cloneMetadata( Metadata src ) + { + if ( src == null ) + { + return null; + } + return src.clone(); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java new file mode 100644 index 00000000..23e59841 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/RepositoryMetadataReadException.java @@ -0,0 +1,40 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Problem storing the repository metadata in the local repository. + * + * @author Brett Porter + */ +public class RepositoryMetadataReadException + extends Exception +{ + public RepositoryMetadataReadException( String message ) + { + super( message ); + } + + public RepositoryMetadataReadException( String message, + Exception e ) + { + super( message, e ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java new file mode 100644 index 00000000..359ab2ce --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/SnapshotArtifactRepositoryMetadata.java @@ -0,0 +1,98 @@ +package org.apache.maven.artifact.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** + * Metadata for the artifact version directory of the repository. + * + * @author Brett Porter + * @todo split instantiation (versioning, plugin mappings) from definition + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java new file mode 100644 index 00000000..5ef86022 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactCollector.java @@ -0,0 +1,42 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java new file mode 100644 index 00000000..0ca940a1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java @@ -0,0 +1,108 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; + +/** + * @author Jason van Zyl + */ +// Just hide the one method we want behind the RepositorySystem interface. +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; + + @Deprecated + ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, + ArtifactRepository localRepository, ArtifactMetadataSource source ) + throws ArtifactResolutionException, ArtifactNotFoundException; + + @Deprecated + 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 + @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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java new file mode 100644 index 00000000..b066e4c0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DebugResolutionListener.java @@ -0,0 +1,167 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.HashSet; +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. + * + * @author Brett Porter + */ +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 ( omittedVersion != null ? !omittedVersion.equals( keptVersion ) : keptVersion != null ) + { + logger.debug( indent + omitted + " (removed - nearer found: " + kept.getVersion() + ")" ); + } + } + + 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 ); + } + } + +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java new file mode 100644 index 00000000..cefb9e28 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java @@ -0,0 +1,30 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.component.annotations.Component; + +@Deprecated +@Component( role = ArtifactCollector.class ) +public class DefaultArtifactCollector + extends org.apache.maven.repository.legacy.resolver.DefaultLegacyArtifactCollector + implements ArtifactCollector +{ +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java new file mode 100644 index 00000000..1631a013 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java @@ -0,0 +1,643 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.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.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.logging.Logger; +import org.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; + +/** + * @author Jason van Zyl + */ +@Component( role = ArtifactResolver.class ) +public class DefaultArtifactResolver + implements ArtifactResolver, Disposable +{ + @Requirement + private Logger logger; + + @Requirement + protected ArtifactFactory artifactFactory; + + @Requirement + private ArtifactCollector artifactCollector; + + @Requirement + private ResolutionErrorHandler resolutionErrorHandler; + + @Requirement + private ArtifactMetadataSource source; + + @Requirement + private PlexusContainer container; + + @Requirement + private LegacySupport legacySupport; + + @Requirement + private RepositorySystem repoSystem; + + private final Executor executor; + + public DefaultArtifactResolver() + { + int threads = Integer.getInteger( "maven.artifact.threads", 5 ); + if ( threads <= 1 ) + { + executor = new Executor() + { + public void execute( Runnable command ) + { + command.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(), repoSystem ); + } + + 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 ) ); + + result = repoSystem.resolveArtifact( session, artifactRequest ); + } + 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.EMPTY_MAP, 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.EMPTY_MAP, localRepository, + remoteRepositories, source, null, listeners ); + } + + 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 ); + } + + 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; + } + + // ------------------------------------------------------------------------ + // + // ------------------------------------------------------------------------ + + 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. + */ + 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; + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java new file mode 100644 index 00000000..06da7e3e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/ResolutionListenerForDepMgmt.java @@ -0,0 +1,43 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; + +/** + * Do not use! + *

+ * Should only be implmemented 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 ); +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java new file mode 100644 index 00000000..b9ccf706 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/UnresolvedArtifacts.java @@ -0,0 +1,66 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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. + * + * @author Jason van Zyl + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java new file mode 100644 index 00000000..825d595a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/WarningResolutionListener.java @@ -0,0 +1,90 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.versioning.VersionRange; +import org.codehaus.plexus.logging.Logger; + +/** + * Send resolution warning events to the warning log. + * + * @author Brett Porter + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java new file mode 100644 index 00000000..0499db51 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/InversionArtifactFilter.java @@ -0,0 +1,65 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java new file mode 100644 index 00000000..8cd02ccf --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilter.java @@ -0,0 +1,93 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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. + * + * @author Benjamin Bentmann + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java new file mode 100644 index 00000000..76c39ec3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/resolver/filter/TypeArtifactFilter.java @@ -0,0 +1,66 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; + +/** Artifact Filter which filters on artifact type */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java new file mode 100644 index 00000000..86b49499 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/artifact/versioning/ManagedVersionMap.java @@ -0,0 +1,56 @@ +package org.apache.maven.artifact.versioning; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.maven.artifact.Artifact; + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java new file mode 100644 index 00000000..7767aff1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java @@ -0,0 +1,64 @@ +package org.apache.maven.execution; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.codehaus.plexus.util.StringUtils; + +/** + * Describes runtime information about the application. + * + * @author Brett Porter + */ +@Deprecated +@Component( role = RuntimeInformation.class ) +public class DefaultRuntimeInformation + implements RuntimeInformation, Initializable +{ + + @Requirement + 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 ( StringUtils.isEmpty( mavenVersion ) ) + { + throw new InitializationException( "Unable to read Maven version from maven-core" ); + } + + applicationVersion = new DefaultArtifactVersion( mavenVersion ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java new file mode 100644 index 00000000..22e522d2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/execution/RuntimeInformation.java @@ -0,0 +1,34 @@ +package org.apache.maven.execution; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.versioning.ArtifactVersion; + +/** + * Describes runtime information about the application. + * + * @deprecated Use {@link org.apache.maven.rtinfo.RuntimeInformation} instead. + * @author Brett Porter + */ +@Deprecated +public interface RuntimeInformation +{ + ArtifactVersion getApplicationVersion(); +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java new file mode 100644 index 00000000..4745749b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultMavenProfilesBuilder.java @@ -0,0 +1,93 @@ +package org.apache.maven.profiles; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.profiles.io.xpp3.ProfilesXpp3Reader; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.interpolation.EnvarBasedValueSource; +import org.codehaus.plexus.interpolation.RegexBasedInterpolator; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; + +@Deprecated +@Component( role = MavenProfilesBuilder.class ) +public class DefaultMavenProfilesBuilder + extends AbstractLogEnabled + implements MavenProfilesBuilder +{ + private static final String PROFILES_XML_FILE = "profiles.xml"; + + public ProfilesRoot buildProfiles( File basedir ) + throws IOException, XmlPullParserException + { + File profilesXml = new File( basedir, PROFILES_XML_FILE ); + + ProfilesRoot profilesRoot = null; + + if ( profilesXml.exists() ) + { + ProfilesXpp3Reader reader = new ProfilesXpp3Reader(); + Reader profileReader = null; + try + { + profileReader = ReaderFactory.newXmlReader( profilesXml ); + + StringWriter sWriter = new StringWriter(); + + IOUtil.copy( profileReader, sWriter ); + + String rawInput = sWriter.toString(); + + try + { + RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); + interpolator.addValueSource( new EnvarBasedValueSource() ); + + rawInput = interpolator.interpolate( rawInput, "settings" ); + } + catch ( Exception e ) + { + getLogger().warn( "Failed to initialize environment variable resolver. Skipping environment " + + "substitution in " + PROFILES_XML_FILE + "." ); + getLogger().debug( "Failed to initialize envar resolver. Skipping resolution.", e ); + } + + StringReader sReader = new StringReader( rawInput ); + + profilesRoot = reader.read( sReader ); + } + finally + { + IOUtil.close( profileReader ); + } + } + + return profilesRoot; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java new file mode 100644 index 00000000..3b99e9e2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java @@ -0,0 +1,248 @@ +package org.apache.maven.profiles; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Activation; +import org.apache.maven.model.Profile; +import org.apache.maven.model.building.ModelProblem; +import org.apache.maven.model.building.ModelProblemCollector; +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.annotations.Requirement; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.logging.Logger; + +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.building.ModelProblemCollectorRequest; + +@Deprecated +public class DefaultProfileManager + implements ProfileManager +{ + + @Requirement + private Logger logger; + + @Requirement + 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 envirnments. + */ + 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 = (Profile) 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 ( Object profileId1 : profileIds ) + { + String profileId = (String) profileId1; + + explicitlyActivate( profileId ); + } + } + + /* (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 ( Object profileId1 : profileIds ) + { + String profileId = (String) profileId1; + + explicitlyDeactivate( profileId ); + } + } + + /* (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, new ModelProblemCollector() + { + + public void add( ModelProblemCollectorRequest 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 ( Object profile1 : profiles ) + { + Profile profile = (Profile) profile1; + + addProfile( profile ); + } + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java new file mode 100644 index 00000000..32fb6aaa --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/MavenProfilesBuilder.java @@ -0,0 +1,37 @@ +package org.apache.maven.profiles; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +import java.io.File; +import java.io.IOException; + +/** + * @author jdcasey + */ +@Deprecated +public interface MavenProfilesBuilder +{ + String ROLE = MavenProfilesBuilder.class.getName(); + + ProfilesRoot buildProfiles( File basedir ) + throws IOException, XmlPullParserException; +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java new file mode 100644 index 00000000..ddda3d7f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfileManager.java @@ -0,0 +1,58 @@ +package org.apache.maven.profiles; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Profile; +import org.apache.maven.profiles.activation.ProfileActivationException; + +import java.util.List; +import java.util.Map; +import java.util.Properties; + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java new file mode 100644 index 00000000..72527b09 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/ProfilesConversionUtils.java @@ -0,0 +1,151 @@ +package org.apache.maven.profiles; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Activation; +import org.apache.maven.model.ActivationFile; +import org.apache.maven.model.ActivationProperty; +import org.apache.maven.model.Profile; +import org.apache.maven.model.Repository; + +import java.util.List; + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java new file mode 100644 index 00000000..5d6a8bf6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/DetectedProfileActivator.java @@ -0,0 +1,35 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Profile; + +@Deprecated +public abstract class DetectedProfileActivator + implements ProfileActivator +{ + public boolean canDetermineActivation( Profile profile ) + { + return canDetectActivation( profile ); + } + + protected abstract boolean canDetectActivation( Profile profile ); + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java new file mode 100644 index 00000000..de4ba2ed --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/FileProfileActivator.java @@ -0,0 +1,109 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.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; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; + +@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 ( StringUtils.isNotEmpty( fileString ) ) + { + fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" ); + return FileUtils.fileExists( fileString ); + } + + // check if the file is missing, if it is then the profile will be active + fileString = actFile.getMissing(); + + if ( StringUtils.isNotEmpty( fileString ) ) + { + fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" ); + return !FileUtils.fileExists( fileString ); + } + } + 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 + + ". Run in debug mode (-X) for more information." ); + } + } + } + + return false; + } + + public void enableLogging( Logger logger ) + { + this.logger = logger; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java new file mode 100644 index 00000000..dfae95f6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java @@ -0,0 +1,97 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.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; +import org.codehaus.plexus.util.StringUtils; + +@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.replaceAll( "_", "-" ); + } + + protected String getJdkVersion() + { + return JDK_VERSION; + } + + protected boolean canDetectActivation( Profile profile ) + { + return profile.getActivation() != null && StringUtils.isNotEmpty( profile.getActivation().getJdk() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java new file mode 100644 index 00000000..7464a303 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/OperatingSystemProfileActivator.java @@ -0,0 +1,161 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Activation; +import org.apache.maven.model.ActivationOS; +import org.apache.maven.model.Profile; +import org.codehaus.plexus.util.Os; + +@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.isVersion( 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.isArch( 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.isName( 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java new file mode 100644 index 00000000..7fc372cb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivationException.java @@ -0,0 +1,39 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java new file mode 100644 index 00000000..d0a9ecb5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/ProfileActivator.java @@ -0,0 +1,33 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Profile; + +@Deprecated +public interface ProfileActivator +{ + final String ROLE = ProfileActivator.class.getName(); + + boolean canDetermineActivation( Profile profile ); + + boolean isActive( Profile profile ) + throws ProfileActivationException; +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java new file mode 100644 index 00000000..a03267dc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/profiles/activation/SystemPropertyProfileActivator.java @@ -0,0 +1,114 @@ +package org.apache.maven.profiles.activation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; +import org.codehaus.plexus.util.StringUtils; + +@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 ( StringUtils.isNotEmpty( propValue ) ) + { + boolean reverseValue = false; + if ( propValue.startsWith( "!" ) ) + { + reverseValue = true; + propValue = propValue.substring( 1 ); + } + + // we have a value, so it has to match the system value... + boolean result = propValue.equals( sysValue ); + + if ( reverseValue ) + { + return !result; + } + else + { + return result; + } + } + else + { + boolean result = StringUtils.isNotEmpty( sysValue ); + + if ( reverseName ) + { + return !result; + } + else + { + return result; + } + } + } + + return false; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java new file mode 100644 index 00000000..fff2de10 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -0,0 +1,324 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + */ +@Component( role = MavenProjectBuilder.class ) +@Deprecated +public class DefaultMavenProjectBuilder + implements MavenProjectBuilder +{ + + @Requirement + private ProjectBuilder projectBuilder; + + @Requirement + private RepositorySystem repositorySystem; + + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java new file mode 100644 index 00000000..d08f18e0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/DefaultProjectBuilderConfiguration.java @@ -0,0 +1,107 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Date; +import java.util.Properties; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.profiles.ProfileManager; + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java new file mode 100644 index 00000000..cf85aa9e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/InvalidProjectModelException.java @@ -0,0 +1,74 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.project.validation.ModelValidationResult; + +@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 + */ + 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 + */ + public InvalidProjectModelException( String projectId, String pomLocation, String message ) + { + this( projectId, message, new File( pomLocation ) ); + } + + public final ModelValidationResult getValidationResult() + { + return validationResult; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java new file mode 100644 index 00000000..c44d8dbc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MavenProjectBuilder.java @@ -0,0 +1,76 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.List; + +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 -- Vincent, Dennis and Lukas are checking but this doesn't appear to be required anymore. + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java new file mode 100644 index 00000000..17c267e3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/MissingRepositoryElementException.java @@ -0,0 +1,38 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.InvalidRepositoryException; + +public class MissingRepositoryElementException + extends InvalidRepositoryException +{ + + public MissingRepositoryElementException( String message, String repositoryId ) + { + super( message, repositoryId ); + } + + public MissingRepositoryElementException( String message ) + { + super( message, "-unknown-" ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java new file mode 100644 index 00000000..1af061d3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ModelUtils.java @@ -0,0 +1,367 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginContainer; +import org.apache.maven.model.PluginExecution; +import org.apache.maven.model.Repository; +import org.codehaus.plexus.util.xml.Xpp3Dom; + +/** @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 ) + { + if ( ( childContainer == null ) || ( parentContainer == null ) ) + { + // nothing to do. + return; + } + + List parentPlugins = parentContainer.getPlugins(); + + if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) + { + parentPlugins = new ArrayList( parentPlugins ); + + // If we're processing this merge as an inheritance, we have to build up a list of + // plugins that were considered for inheritance. + if ( handleAsInheritance ) + { + for ( Iterator it = parentPlugins.iterator(); it.hasNext(); ) + { + Plugin plugin = it.next(); + + String inherited = plugin.getInherited(); + + if ( ( inherited != null ) && !Boolean.valueOf( inherited ) ) + { + it.remove(); + } + } + } + + List assembledPlugins = new ArrayList(); + + Map childPlugins = childContainer.getPluginsAsMap(); + + for ( Plugin parentPlugin : parentPlugins ) + { + String parentInherited = parentPlugin.getInherited(); + + // only merge plugin definition from the parent if at least one + // of these is true: + // 1. we're not processing the plugins in an inheritance-based merge + // 2. the parent's flag is not set + // 3. the parent's flag is set to true + if ( !handleAsInheritance || ( parentInherited == null ) + || Boolean.valueOf( parentInherited ) ) + { + Plugin childPlugin = childPlugins.get( parentPlugin.getKey() ); + + if ( ( childPlugin != null ) && !assembledPlugins.contains( childPlugin ) ) + { + Plugin assembledPlugin = childPlugin; + + mergePluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); + + // fix for MNG-2221 (assembly cache was not being populated for later reference): + assembledPlugins.add( assembledPlugin ); + } + + // if we're processing this as an inheritance-based merge, and + // the parent's flag is not set, then we need to + // clear the inherited flag in the merge result. + if ( handleAsInheritance && ( parentInherited == null ) ) + { + parentPlugin.unsetInheritanceApplied(); + } + } + + // very important to use the parentPlugins List, rather than parentContainer.getPlugins() + // since this list is a local one, and may have been modified during processing. + List results = + ModelUtils.orderAfterMerge( assembledPlugins, parentPlugins, childContainer.getPlugins() ); + + childContainer.setPlugins( results ); + + childContainer.flushPluginMap(); + } + } + } + + public static List orderAfterMerge( List merged, List highPrioritySource, + List lowPrioritySource ) + { + List results = new ArrayList(); + + if ( !merged.isEmpty() ) + { + results.addAll( merged ); + } + + List missingFromResults = new ArrayList(); + + List> sources = new ArrayList>(); + + sources.add( highPrioritySource ); + sources.add( lowPrioritySource ); + + for ( List source : sources ) + { + for ( Plugin item : source ) + { + if ( results.contains( item ) ) + { + if ( !missingFromResults.isEmpty() ) + { + int idx = results.indexOf( item ); + + if ( idx < 0 ) + { + idx = 0; + } + + results.addAll( idx, missingFromResults ); + + missingFromResults.clear(); + } + } + else + { + missingFromResults.add( item ); + } + } + + if ( !missingFromResults.isEmpty() ) + { + results.addAll( missingFromResults ); + + missingFromResults.clear(); + } + } + + return results; + } + + + public static void mergePluginDefinitions( Plugin child, Plugin parent, boolean handleAsInheritance ) + { + if ( ( child == null ) || ( parent == null ) ) + { + // nothing to do. + return; + } + + if ( parent.isExtensions() ) + { + child.setExtensions( true ); + } + + if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) + { + child.setVersion( parent.getVersion() ); + } + + Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); + Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); + + childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); + + child.setConfiguration( childConfiguration ); + + child.setDependencies( mergeDependencyList( child.getDependencies(), parent.getDependencies() ) ); + + // from here to the end of the method is dealing with merging of the section. + String parentInherited = parent.getInherited(); + + boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ); + + List parentExecutions = parent.getExecutions(); + + if ( ( parentExecutions != null ) && !parentExecutions.isEmpty() ) + { + List mergedExecutions = new ArrayList(); + + Map assembledExecutions = new TreeMap(); + + Map childExecutions = child.getExecutionsAsMap(); + + for ( PluginExecution parentExecution : parentExecutions ) + { + String inherited = parentExecution.getInherited(); + + boolean parentExecInherited = + parentIsInherited && ( ( inherited == null ) || Boolean.valueOf( inherited ) ); + + if ( !handleAsInheritance || parentExecInherited ) + { + PluginExecution assembled = parentExecution; + + PluginExecution childExecution = childExecutions.get( parentExecution.getId() ); + + if ( childExecution != null ) + { + mergePluginExecutionDefinitions( childExecution, parentExecution ); + + assembled = childExecution; + } + else if ( handleAsInheritance && ( parentInherited == null ) ) + { + parentExecution.unsetInheritanceApplied(); + } + + assembledExecutions.put( assembled.getId(), assembled ); + mergedExecutions.add( assembled ); + } + } + + for ( PluginExecution childExecution : child.getExecutions() ) + { + if ( !assembledExecutions.containsKey( childExecution.getId() ) ) + { + mergedExecutions.add( childExecution ); + } + } + + child.setExecutions( mergedExecutions ); + + child.flushExecutionMap(); + } + + } + + private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) + { + if ( child.getPhase() == null ) + { + child.setPhase( parent.getPhase() ); + } + + List parentGoals = parent.getGoals(); + List childGoals = child.getGoals(); + + List goals = new ArrayList(); + + if ( ( childGoals != null ) && !childGoals.isEmpty() ) + { + goals.addAll( childGoals ); + } + + if ( parentGoals != null ) + { + for ( String goal : parentGoals ) + { + if ( !goals.contains( goal ) ) + { + goals.add( goal ); + } + } + } + + child.setGoals( goals ); + + Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); + Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); + + childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); + + child.setConfiguration( childConfiguration ); + } + + public static List mergeRepositoryLists( List dominant, List recessive ) + { + List repositories = new ArrayList(); + + for ( Repository repository : dominant ) + { + repositories.add( repository ); + } + + for ( Repository repository : recessive ) + { + if ( !repositories.contains( repository ) ) + { + repositories.add( repository ); + } + } + + return repositories; + } + + public static void mergeFilterLists( List childFilters, List parentFilters ) + { + for ( String f : parentFilters ) + { + if ( !childFilters.contains( f ) ) + { + childFilters.add( f ); + } + } + } + + private static List mergeDependencyList( List child, List parent ) + { + Map depsMap = new LinkedHashMap(); + + if ( parent != null ) + { + for ( Dependency dependency : parent ) + { + depsMap.put( dependency.getManagementKey(), dependency ); + } + } + + if ( child != null ) + { + for ( Dependency dependency : child ) + { + depsMap.put( dependency.getManagementKey(), dependency ); + } + } + + return new ArrayList( depsMap.values() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java new file mode 100644 index 00000000..ddfad3cb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectBuilderConfiguration.java @@ -0,0 +1,55 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Date; +import java.util.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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java new file mode 100644 index 00000000..b70d3cff --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/ProjectUtils.java @@ -0,0 +1,118 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.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 the remote resources plugin started using it instead of +// getting the repositories from the project. + +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java new file mode 100644 index 00000000..4b08eb96 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java @@ -0,0 +1,752 @@ +package org.apache.maven.project.inheritance; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.TreeMap; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DependencyManagement; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Extension; +import org.apache.maven.model.Model; +import org.apache.maven.model.PluginManagement; +import org.apache.maven.model.ReportPlugin; +import org.apache.maven.model.ReportSet; +import org.apache.maven.model.Reporting; +import org.apache.maven.model.Resource; +import org.apache.maven.model.Scm; +import org.apache.maven.model.Site; +import org.apache.maven.project.ModelUtils; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.Xpp3Dom; + +@Component( role = ModelInheritanceAssembler.class ) +public class DefaultModelInheritanceAssembler + implements ModelInheritanceAssembler +{ + // TODO: Remove this! + @SuppressWarnings( "unchecked" ) + public void assembleBuildInheritance( Build childBuild, Build parentBuild, boolean handleAsInheritance ) + { + // The build has been set but we want to step in here and fill in + // values that have not been set by the child. + + if ( childBuild.getSourceDirectory() == null ) + { + childBuild.setSourceDirectory( parentBuild.getSourceDirectory() ); + } + + if ( childBuild.getScriptSourceDirectory() == null ) + { + childBuild.setScriptSourceDirectory( parentBuild.getScriptSourceDirectory() ); + } + + if ( childBuild.getTestSourceDirectory() == null ) + { + childBuild.setTestSourceDirectory( parentBuild.getTestSourceDirectory() ); + } + + if ( childBuild.getOutputDirectory() == null ) + { + childBuild.setOutputDirectory( parentBuild.getOutputDirectory() ); + } + + if ( childBuild.getTestOutputDirectory() == null ) + { + childBuild.setTestOutputDirectory( parentBuild.getTestOutputDirectory() ); + } + + // Extensions are accumulated + mergeExtensionLists( childBuild, parentBuild ); + + if ( childBuild.getDirectory() == null ) + { + childBuild.setDirectory( parentBuild.getDirectory() ); + } + + if ( childBuild.getDefaultGoal() == null ) + { + childBuild.setDefaultGoal( parentBuild.getDefaultGoal() ); + } + + if ( childBuild.getFinalName() == null ) + { + childBuild.setFinalName( parentBuild.getFinalName() ); + } + + ModelUtils.mergeFilterLists( childBuild.getFilters(), parentBuild.getFilters() ); + + List resources = childBuild.getResources(); + if ( ( resources == null ) || resources.isEmpty() ) + { + childBuild.setResources( parentBuild.getResources() ); + } + + resources = childBuild.getTestResources(); + if ( ( resources == null ) || resources.isEmpty() ) + { + childBuild.setTestResources( parentBuild.getTestResources() ); + } + + // Plugins are aggregated if Plugin.inherit != false + ModelUtils.mergePluginLists( childBuild, parentBuild, handleAsInheritance ); + + // Plugin management :: aggregate + PluginManagement dominantPM = childBuild.getPluginManagement(); + PluginManagement recessivePM = parentBuild.getPluginManagement(); + + if ( ( dominantPM == null ) && ( recessivePM != null ) ) + { + // FIXME: Filter out the inherited == false stuff! + childBuild.setPluginManagement( recessivePM ); + } + else + { + ModelUtils.mergePluginLists( childBuild.getPluginManagement(), parentBuild.getPluginManagement(), false ); + } + } + + private void assembleScmInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) + { + if ( parent.getScm() != null ) + { + Scm parentScm = parent.getScm(); + + Scm childScm = child.getScm(); + + if ( childScm == null ) + { + childScm = new Scm(); + + child.setScm( childScm ); + } + + if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) ) + { + childScm.setConnection( + appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); + } + + if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) + && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) ) + { + childScm + .setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), + childPathAdjustment, appendPaths ) ); + } + + if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) ) + { + childScm.setUrl( + appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); + } + } + } + + public void copyModel( Model dest, Model source ) + { + assembleModelInheritance( dest, source, null, false ); + } + + public void assembleModelInheritance( Model child, Model parent, String childPathAdjustment ) + { + assembleModelInheritance( child, parent, childPathAdjustment, true ); + } + + public void assembleModelInheritance( Model child, Model parent ) + { + assembleModelInheritance( child, parent, null, true ); + } + + private void assembleModelInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) + { + // cannot inherit from null parent. + if ( parent == null ) + { + return; + } + + // Group id + if ( child.getGroupId() == null ) + { + child.setGroupId( parent.getGroupId() ); + } + + // version + if ( child.getVersion() == null ) + { + // The parent version may have resolved to something different, so we take what we asked for... + // instead of - child.setVersion( parent.getVersion() ); + + if ( child.getParent() != null ) + { + child.setVersion( child.getParent().getVersion() ); + } + } + + // inceptionYear + if ( child.getInceptionYear() == null ) + { + child.setInceptionYear( parent.getInceptionYear() ); + } + + // url + if ( child.getUrl() == null ) + { + if ( parent.getUrl() != null ) + { + child.setUrl( appendPath( parent.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); + } + else + { + child.setUrl( parent.getUrl() ); + } + } + + assembleDistributionInheritence( child, parent, childPathAdjustment, appendPaths ); + + // issueManagement + if ( child.getIssueManagement() == null ) + { + child.setIssueManagement( parent.getIssueManagement() ); + } + + // description + if ( child.getDescription() == null ) + { + child.setDescription( parent.getDescription() ); + } + + // Organization + if ( child.getOrganization() == null ) + { + child.setOrganization( parent.getOrganization() ); + } + + // Scm + assembleScmInheritance( child, parent, childPathAdjustment, appendPaths ); + + // ciManagement + if ( child.getCiManagement() == null ) + { + child.setCiManagement( parent.getCiManagement() ); + } + + // developers + if ( child.getDevelopers().size() == 0 ) + { + child.setDevelopers( parent.getDevelopers() ); + } + + // licenses + if ( child.getLicenses().size() == 0 ) + { + child.setLicenses( parent.getLicenses() ); + } + + // developers + if ( child.getContributors().size() == 0 ) + { + child.setContributors( parent.getContributors() ); + } + + // mailingLists + if ( child.getMailingLists().size() == 0 ) + { + child.setMailingLists( parent.getMailingLists() ); + } + + // Build + assembleBuildInheritance( child, parent ); + + assembleDependencyInheritance( child, parent ); + + child.setRepositories( ModelUtils.mergeRepositoryLists( child.getRepositories(), parent.getRepositories() ) ); +// child.setPluginRepositories( +// ModelUtils.mergeRepositoryLists( child.getPluginRepositories(), parent.getPluginRepositories() ) ); + + assembleReportingInheritance( child, parent ); + + assembleDependencyManagementInheritance( child, parent ); + + Properties props = new Properties(); + props.putAll( parent.getProperties() ); + props.putAll( child.getProperties() ); + + child.setProperties( props ); + } + + // TODO: Remove this! + @SuppressWarnings( "unchecked" ) + private void assembleDependencyManagementInheritance( Model child, Model parent ) + { + DependencyManagement parentDepMgmt = parent.getDependencyManagement(); + + DependencyManagement childDepMgmt = child.getDependencyManagement(); + + if ( parentDepMgmt != null ) + { + if ( childDepMgmt == null ) + { + child.setDependencyManagement( parentDepMgmt ); + } + else + { + List childDeps = childDepMgmt.getDependencies(); + + Map mappedChildDeps = new TreeMap(); + for ( Dependency dep : childDeps ) + { + mappedChildDeps.put( dep.getManagementKey(), dep ); + } + + for ( Dependency dep : parentDepMgmt.getDependencies() ) + { + if ( !mappedChildDeps.containsKey( dep.getManagementKey() ) ) + { + childDepMgmt.addDependency( dep ); + } + } + } + } + } + + private void assembleReportingInheritance( Model child, Model parent ) + { + // Reports :: aggregate + Reporting childReporting = child.getReporting(); + Reporting parentReporting = parent.getReporting(); + + if ( parentReporting != null ) + { + if ( childReporting == null ) + { + childReporting = new Reporting(); + child.setReporting( childReporting ); + } + + childReporting.setExcludeDefaults( parentReporting.isExcludeDefaults() ); + + if ( StringUtils.isEmpty( childReporting.getOutputDirectory() ) ) + { + childReporting.setOutputDirectory( parentReporting.getOutputDirectory() ); + } + + mergeReportPluginLists( childReporting, parentReporting, true ); + } + } + + private static void mergeReportPluginLists( Reporting child, Reporting parent, boolean handleAsInheritance ) + { + if ( ( child == null ) || ( parent == null ) ) + { + // nothing to do. + return; + } + + List parentPlugins = parent.getPlugins(); + + if ( ( parentPlugins != null ) && !parentPlugins.isEmpty() ) + { + Map assembledPlugins = new TreeMap(); + + Map childPlugins = child.getReportPluginsAsMap(); + + for ( ReportPlugin parentPlugin : parentPlugins ) + { + String parentInherited = parentPlugin.getInherited(); + + if ( !handleAsInheritance || ( parentInherited == null ) || Boolean.valueOf( parentInherited ) ) + { + + ReportPlugin assembledPlugin = parentPlugin; + + ReportPlugin childPlugin = childPlugins.get( parentPlugin.getKey() ); + + if ( childPlugin != null ) + { + assembledPlugin = childPlugin; + + mergeReportPluginDefinitions( childPlugin, parentPlugin, handleAsInheritance ); + } + + if ( handleAsInheritance && ( parentInherited == null ) ) + { + assembledPlugin.unsetInheritanceApplied(); + } + + assembledPlugins.put( assembledPlugin.getKey(), assembledPlugin ); + } + } + + for ( ReportPlugin childPlugin : childPlugins.values() ) + { + if ( !assembledPlugins.containsKey( childPlugin.getKey() ) ) + { + assembledPlugins.put( childPlugin.getKey(), childPlugin ); + } + } + + child.setPlugins( new ArrayList( assembledPlugins.values() ) ); + + child.flushReportPluginMap(); + } + } + + private static void mergeReportSetDefinitions( ReportSet child, ReportSet parent ) + { + List parentReports = parent.getReports(); + List childReports = child.getReports(); + + List reports = new ArrayList(); + + if ( ( childReports != null ) && !childReports.isEmpty() ) + { + reports.addAll( childReports ); + } + + if ( parentReports != null ) + { + for ( String report : parentReports ) + { + if ( !reports.contains( report ) ) + { + reports.add( report ); + } + } + } + + child.setReports( reports ); + + Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); + Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); + + childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); + + child.setConfiguration( childConfiguration ); + } + + + public static void mergeReportPluginDefinitions( ReportPlugin child, ReportPlugin parent, + boolean handleAsInheritance ) + { + if ( ( child == null ) || ( parent == null ) ) + { + // nothing to do. + return; + } + + if ( ( child.getVersion() == null ) && ( parent.getVersion() != null ) ) + { + child.setVersion( parent.getVersion() ); + } + + // from here to the end of the method is dealing with merging of the section. + String parentInherited = parent.getInherited(); + + boolean parentIsInherited = ( parentInherited == null ) || Boolean.valueOf( parentInherited ); + + List parentReportSets = parent.getReportSets(); + + if ( ( parentReportSets != null ) && !parentReportSets.isEmpty() ) + { + Map assembledReportSets = new TreeMap(); + + Map childReportSets = child.getReportSetsAsMap(); + + for ( Object parentReportSet1 : parentReportSets ) + { + ReportSet parentReportSet = (ReportSet) parentReportSet1; + + if ( !handleAsInheritance || parentIsInherited ) + { + ReportSet assembledReportSet = parentReportSet; + + ReportSet childReportSet = childReportSets.get( parentReportSet.getId() ); + + if ( childReportSet != null ) + { + mergeReportSetDefinitions( childReportSet, parentReportSet ); + + assembledReportSet = childReportSet; + } + else if ( handleAsInheritance && ( parentInherited == null ) ) + { + parentReportSet.unsetInheritanceApplied(); + } + + assembledReportSets.put( assembledReportSet.getId(), assembledReportSet ); + } + } + + for ( Map.Entry entry : childReportSets.entrySet() ) + { + String id = entry.getKey(); + + if ( !assembledReportSets.containsKey( id ) ) + { + assembledReportSets.put( id, entry.getValue() ); + } + } + + child.setReportSets( new ArrayList( assembledReportSets.values() ) ); + + child.flushReportSetMap(); + } + + } + + // TODO: Remove this! + @SuppressWarnings( "unchecked" ) + private void assembleDependencyInheritance( Model child, Model parent ) + { + Map depsMap = new LinkedHashMap(); + + List deps = parent.getDependencies(); + + if ( deps != null ) + { + for ( Dependency dependency : deps ) + { + depsMap.put( dependency.getManagementKey(), dependency ); + } + } + + deps = child.getDependencies(); + + if ( deps != null ) + { + for ( Dependency dependency : deps ) + { + depsMap.put( dependency.getManagementKey(), dependency ); + } + } + + child.setDependencies( new ArrayList( depsMap.values() ) ); + } + + private void assembleBuildInheritance( Model child, Model parent ) + { + Build childBuild = child.getBuild(); + Build parentBuild = parent.getBuild(); + + if ( parentBuild != null ) + { + if ( childBuild == null ) + { + childBuild = new Build(); + child.setBuild( childBuild ); + } + + assembleBuildInheritance( childBuild, parentBuild, true ); + } + } + + private void assembleDistributionInheritence( Model child, Model parent, String childPathAdjustment, + boolean appendPaths ) + { + if ( parent.getDistributionManagement() != null ) + { + DistributionManagement parentDistMgmt = parent.getDistributionManagement(); + + DistributionManagement childDistMgmt = child.getDistributionManagement(); + + if ( childDistMgmt == null ) + { + childDistMgmt = new DistributionManagement(); + + child.setDistributionManagement( childDistMgmt ); + } + + if ( childDistMgmt.getSite() == null ) + { + if ( parentDistMgmt.getSite() != null ) + { + Site site = new Site(); + + childDistMgmt.setSite( site ); + + site.setId( parentDistMgmt.getSite().getId() ); + + site.setName( parentDistMgmt.getSite().getName() ); + + site.setUrl( parentDistMgmt.getSite().getUrl() ); + + if ( site.getUrl() != null ) + { + site.setUrl( + appendPath( site.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); + } + } + } + + if ( childDistMgmt.getRepository() == null ) + { + if ( parentDistMgmt.getRepository() != null ) + { + DeploymentRepository repository = copyDistributionRepository( parentDistMgmt.getRepository() ); + childDistMgmt.setRepository( repository ); + } + } + + if ( childDistMgmt.getSnapshotRepository() == null ) + { + if ( parentDistMgmt.getSnapshotRepository() != null ) + { + DeploymentRepository repository = + copyDistributionRepository( parentDistMgmt.getSnapshotRepository() ); + childDistMgmt.setSnapshotRepository( repository ); + } + } + + if ( StringUtils.isEmpty( childDistMgmt.getDownloadUrl() ) ) + { + childDistMgmt.setDownloadUrl( parentDistMgmt.getDownloadUrl() ); + } + + // NOTE: We SHOULD NOT be inheriting status, since this is an assessment of the POM quality. + // NOTE: We SHOULD NOT be inheriting relocation, since this relates to a single POM + } + } + + private static DeploymentRepository copyDistributionRepository( DeploymentRepository parentRepository ) + { + DeploymentRepository repository = new DeploymentRepository(); + + repository.setId( parentRepository.getId() ); + + repository.setName( parentRepository.getName() ); + + repository.setUrl( parentRepository.getUrl() ); + + repository.setLayout( parentRepository.getLayout() ); + + repository.setUniqueVersion( parentRepository.isUniqueVersion() ); + + return repository; + } + + // TODO: This should eventually be migrated to DefaultPathTranslator. + protected String appendPath( String parentPath, String childPath, String pathAdjustment, boolean appendPaths ) + { + String uncleanPath = parentPath; + + if ( appendPaths ) + { + if ( pathAdjustment != null ) + { + uncleanPath += "/" + pathAdjustment; + } + + if ( childPath != null ) + { + uncleanPath += "/" + childPath; + } + } + + String cleanedPath = ""; + + int protocolIdx = uncleanPath.indexOf( "://" ); + + if ( protocolIdx > -1 ) + { + cleanedPath = uncleanPath.substring( 0, protocolIdx + 3 ); + uncleanPath = uncleanPath.substring( protocolIdx + 3 ); + } + + if ( uncleanPath.startsWith( "/" ) ) + { + cleanedPath += "/"; + } + + return cleanedPath + resolvePath( uncleanPath ); + } + + // TODO: Move this to plexus-utils' PathTool. + private static String resolvePath( String uncleanPath ) + { + LinkedList pathElements = new LinkedList(); + + StringTokenizer tokenizer = new StringTokenizer( uncleanPath, "/" ); + + while ( tokenizer.hasMoreTokens() ) + { + String token = tokenizer.nextToken(); + + if ( token.equals( "" ) ) + { + // Empty path entry ("...//.."), remove. + } + else if ( token.equals( ".." ) ) + { + if ( pathElements.isEmpty() ) + { + // FIXME: somehow report to the user + // that there are too many '..' elements. + // For now, ignore the extra '..'. + } + else + { + pathElements.removeLast(); + } + } + else + { + pathElements.addLast( token ); + } + } + + StringBuilder cleanedPath = new StringBuilder(); + + while ( !pathElements.isEmpty() ) + { + cleanedPath.append( pathElements.removeFirst() ); + if ( !pathElements.isEmpty() ) + { + cleanedPath.append( '/' ); + } + } + + return cleanedPath.toString(); + } + + private static void mergeExtensionLists( Build childBuild, Build parentBuild ) + { + for ( Extension e : parentBuild.getExtensions() ) + { + if ( !childBuild.getExtensions().contains( e ) ) + { + childBuild.addExtension( e ); + } + } + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java new file mode 100644 index 00000000..ef4edca5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/inheritance/ModelInheritanceAssembler.java @@ -0,0 +1,41 @@ +package org.apache.maven.project.inheritance; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Build; +import org.apache.maven.model.Model; + +/** + * @author Jason van Zyl + * @deprecated + */ +@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 handleAsInheriance ); + + void copyModel( Model dest, Model source ); +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java new file mode 100644 index 00000000..dfc3deec --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java @@ -0,0 +1,407 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.apache.maven.project.DefaultProjectBuilderConfiguration; +import org.apache.maven.project.ProjectBuilderConfiguration; +import org.apache.maven.project.path.PathTranslator; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.interpolation.AbstractValueSource; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.InterpolationPostProcessor; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.MapBasedValueSource; +import org.codehaus.plexus.interpolation.ObjectBasedValueSource; +import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor; +import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; +import org.codehaus.plexus.interpolation.PrefixedValueSourceWrapper; +import org.codehaus.plexus.interpolation.RecursionInterceptor; +import org.codehaus.plexus.interpolation.ValueSource; +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; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +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; + +/** + * Use a regular expression search to find and resolve expressions within the POM. + * + * @author jdcasey Created on Feb 3, 2005 + * @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; + } + + @Requirement + private PathTranslator pathTranslator; + + private Interpolator interpolator; + + private RecursionInterceptor recursionInterceptor; + + // for testing. + protected AbstractStringBasedModelInterpolator( PathTranslator pathTranslator ) + { + this.pathTranslator = pathTranslator; + } + + /** + * @todo: Remove the throws clause. + * @throws IOException This exception is not thrown any more, and needs to be removed. + */ + 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. + */ + 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 ); + + MavenXpp3Writer writer = new MavenXpp3Writer(); + try + { + writer.write( sWriter, model ); + } + catch ( IOException 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 ); + + MavenXpp3Reader modelReader = new MavenXpp3Reader(); + try + { + model = modelReader.read( sReader ); + } + catch ( IOException e ) + { + throw new ModelInterpolationException( + "Cannot read project model from interpolating filter of serialized version.", e ); + } + catch ( XmlPullParserException 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.
  • + *
  • + * @param overrideContext + * @param outputDebugMessages + */ + 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().toURI().toString(); + } + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java new file mode 100644 index 00000000..f6319fa6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/BuildTimestampValueSource.java @@ -0,0 +1,63 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.text.SimpleDateFormat; +import java.util.Date; + +import 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java new file mode 100644 index 00000000..5b02880b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java @@ -0,0 +1,72 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author jdcasey + *

    + * Created on Feb 2, 2005 + */ +@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; + } + +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java new file mode 100644 index 00000000..e1556eaf --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java @@ -0,0 +1,66 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Model; +import org.apache.maven.project.ProjectBuilderConfiguration; + +import java.io.File; +import java.util.Map; + +/** + * @author jdcasey + *

    + * Created on Feb 2, 2005 + */ +@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. + */ + Model interpolate( Model project, Map context ) + throws ModelInterpolationException; + + /** + * @deprecated Use {@link ModelInterpolator#interpolate(Model, File, ProjectBuilderConfiguration, boolean)} instead. + */ + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java new file mode 100644 index 00000000..da2ba056 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/PathTranslatingPostProcessor.java @@ -0,0 +1,64 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.project.path.PathTranslator; +import org.codehaus.plexus.interpolation.InterpolationPostProcessor; +import org.codehaus.plexus.interpolation.util.ValueSourceUtils; + +import java.io.File; +import java.util.List; + +/** + * + */ +@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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java new file mode 100644 index 00000000..4e251aee --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java @@ -0,0 +1,58 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.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. + * + * @author jdcasey Created on Feb 3, 2005 + * @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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java new file mode 100644 index 00000000..864f57f0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/interpolation/StringSearchModelInterpolator.java @@ -0,0 +1,410 @@ +package org.apache.maven.project.interpolation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Model; +import org.apache.maven.project.ProjectBuilderConfiguration; +import org.apache.maven.project.path.PathTranslator; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.interpolation.InterpolationPostProcessor; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.StringSearchInterpolator; +import org.codehaus.plexus.interpolation.ValueSource; +import org.codehaus.plexus.logging.Logger; + +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; + +@Deprecated +@Component( role = ModelInterpolator.class ) +public class StringSearchModelInterpolator + extends AbstractStringBasedModelInterpolator +{ + + private static final Map, Field[]> fieldsByClass = new WeakHashMap, Field[]>(); + private static final Map, Boolean> fieldIsPrimitiveByClass = new WeakHashMap, Boolean>(); + + 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; + + public 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" ) + private void traverseObjectWithParents( Class cls, Object target ) + throws ModelInterpolationException + { + if ( cls == null ) + { + return; + } + + + if ( cls.isArray() ) + { + evaluateArray( target ); + } + else if ( isQualifiedForInterpolation( cls ) ) + { + Field[] fields = fieldsByClass.get( cls ); + if ( fields == null ) + { + fields = cls.getDeclaredFields(); + fieldsByClass.put( cls, fields ); + } + + 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 e ) + { + throw new ModelInterpolationException( + "Failed to interpolate field: " + field + " on class: " + cls.getName(), e ); + } + catch ( 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" ); + } + + private boolean isQualifiedForInterpolation( Field field, Class fieldType ) + { + if ( !fieldIsPrimitiveByClass.containsKey( fieldType ) ) + { + fieldIsPrimitiveByClass.put( fieldType, fieldType.isPrimitive() ); + } + + if ( fieldIsPrimitiveByClass.get( fieldType ) ) + { + return false; + } + +// if ( fieldType.isPrimitive() ) +// { +// return false; +// } + + if ( "parent".equals( field.getName() ) ) + { + return false; + } + + return true; + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java new file mode 100644 index 00000000..ece7c397 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/path/DefaultPathTranslator.java @@ -0,0 +1,261 @@ +package org.apache.maven.project.path; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Model; +import org.apache.maven.model.Reporting; +import org.apache.maven.model.Resource; +import org.codehaus.plexus.component.annotations.Component; + +@Deprecated +@Component( role = PathTranslator.class ) +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 BASEDIR_EXPRESSION : BASEDIR_EXPRESSIONS ) + { + basedirExpr = BASEDIR_EXPRESSION; + if ( s.startsWith( basedirExpr ) ) + { + break; + } + else + { + basedirExpr = null; + } + } + + 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.length() <= 0 ) + { + path = "."; + } + + if ( !new File( path ).isAbsolute() ) + { + path = path.replace( '\\', '/' ); + } + + return path; + } + +} + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java new file mode 100644 index 00000000..0095f803 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java @@ -0,0 +1,76 @@ +package org.apache.maven.project.validation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Model; +import org.apache.maven.model.building.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * @author Trygve Laugstøl + */ +@Component( role = ModelValidator.class ) +@Deprecated +public class DefaultModelValidator + implements ModelValidator +{ + + @Requirement + 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; + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java new file mode 100644 index 00000000..cb8c6012 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidationResult.java @@ -0,0 +1,95 @@ +package org.apache.maven.project.validation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @author Trygve Laugstøl + */ +public class ModelValidationResult +{ + + /** */ + private static final String NEWLINE = System.getProperty( "line.separator" ); + + /** */ + 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: " + NEWLINE ); +// } +// + for ( int i = 0; i < messages.size(); i++ ) + { + message.append( indentation ).append( "[" ).append( i ).append( "] " ).append( messages.get( i ) ).append( + NEWLINE ); + } + + return message.toString(); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java new file mode 100644 index 00000000..54fd04ca --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/project/validation/ModelValidator.java @@ -0,0 +1,37 @@ +package org.apache.maven.project.validation; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.Model; + +/** + * Checks the model for missing or invalid values. + * + * @author Trygve Laugstøl + */ +@Deprecated +public interface ModelValidator +{ + + String ROLE = ModelValidator.class.getName(); + + ModelValidationResult validate( Model model ); + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java new file mode 100644 index 00000000..af27a840 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/reporting/MavenReportException.java @@ -0,0 +1,39 @@ +package org.apache.maven.reporting; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * An exception occurring during the execution of a Maven report. + * + * @author Brett Porter + * @author Emmanuel Venisse + */ +public class MavenReportException extends Exception +{ + public MavenReportException( String msg ) + { + super( msg ); + } + + public MavenReportException( String msg, Exception e ) + { + super( msg, e ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java new file mode 100644 index 00000000..53e7bd4a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/DefaultMirrorSelector.java @@ -0,0 +1,205 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.StringUtils; + +@Component( role = MirrorSelector.class ) +public class DefaultMirrorSelector + implements MirrorSelector +{ + + private static final String WILDCARD = "*"; + + private static final String EXTERNAL_WILDCARD = "external:*"; + + 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: * = + * everything external:* = everything not on the localhost and not file based. repo,repo1 = repo + * or repo1 *,!repo1 = everything except repo1 + * + * @param originalRepository to compare for a match. + * @param pattern used for match. Currently only '*' is supported. + * @return true if the repository is a match to this pattern. + */ + static boolean matchPattern( ArtifactRepository originalRepository, String pattern ) + { + boolean result = false; + String originalId = originalRepository.getId(); + + // simple checks first to short circuit processing below. + if ( WILDCARD.equals( pattern ) || pattern.equals( originalId ) ) + { + result = true; + } + else + { + // process the list + String[] repos = pattern.split( "," ); + for ( String repo : repos ) + { + 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 + } + else if ( WILDCARD.equals( repo ) ) + { + result = true; + // don't stop processing in case a future segment explicitly excludes this repo + } + } + } + return result; + } + + /** + * Checks the URL to see if this repository refers to an external repository + * + * @param originalRepository + * @return true if external. + */ + static boolean isExternalRepo( ArtifactRepository originalRepository ) + { + try + { + URL url = new URL( originalRepository.getUrl() ); + return !( url.getHost().equals( "localhost" ) || url.getHost().equals( "127.0.0.1" ) + || url.getProtocol().equals( "file" ) ); + } + catch ( MalformedURLException e ) + { + // bad url just skip it here. It should have been validated already, but the wagon lookup will deal with it + return false; + } + } + + static boolean matchesLayout( ArtifactRepository repository, Mirror mirror ) + { + return matchesLayout( RepositoryUtils.getLayout( repository ), mirror.getMirrorOfLayouts() ); + } + + /** + * Checks whether the layouts configured for a mirror match with the layout of the repository. + * + * @param repoLayout The layout of the repository, may be {@code null}. + * @param mirrorLayout The layouts supported by the mirror, may be {@code null}. + * @return {@code true} if the layouts associated with the mirror match the layout of the original repository, + * {@code false} otherwise. + */ + static boolean matchesLayout( String repoLayout, String mirrorLayout ) + { + boolean result = false; + + // simple checks first to short circuit processing below. + if ( StringUtils.isEmpty( mirrorLayout ) || WILDCARD.equals( mirrorLayout ) ) + { + result = true; + } + else if ( mirrorLayout.equals( repoLayout ) ) + { + result = true; + } + else + { + // process the list + String[] layouts = mirrorLayout.split( "," ); + for ( String layout : layouts ) + { + // see if this is a negative match + if ( layout.length() > 1 && layout.startsWith( "!" ) ) + { + if ( layout.substring( 1 ).equals( repoLayout ) ) + { + // explicitly exclude. Set result and stop processing. + result = false; + break; + } + } + // check for exact match + else if ( layout.equals( repoLayout ) ) + { + result = true; + break; + } + else if ( WILDCARD.equals( layout ) ) + { + result = true; + // don't stop processing in case a future segment explicitly excludes this repo + } + } + } + + return result; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java new file mode 100644 index 00000000..c507bf70 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MavenArtifactMetadata.java @@ -0,0 +1,119 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java new file mode 100644 index 00000000..fcaddd2c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraph.java @@ -0,0 +1,96 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collection; + +/** + * This is the main graph data structure used by the RepositorySystem to present tree and graph objects. + * + * @author Oleg Gusakov + * + */ +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 + * @return + */ + 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 + * + * @return + */ + public MetadataGraphNode getEntry() + { + return entry; + } + + /** + * getter + * + * @return + */ + public Collection getNodes() + { + return nodes; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java new file mode 100644 index 00000000..c8b9ab4e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataGraphNode.java @@ -0,0 +1,101 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +/** + * MetadataGraph node - as it's a directed graph - holds adjacency lists for incident and exident nodes + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java new file mode 100644 index 00000000..c98dd053 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionRequest.java @@ -0,0 +1,202 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** + * + * + * @author Oleg Gusakov + * + */ +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; + } + + public List getRemoteRepostories() + { + return remoteRepositories; + } + + public MetadataResolutionRequest setRemoteRepostories( List remoteRepostories ) + { + this.remoteRepositories = remoteRepostories; + + return this; + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java new file mode 100644 index 00000000..209c36fa --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MetadataResolutionResult.java @@ -0,0 +1,356 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.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; + +/** + * + * + * @author Oleg Gusakov + * + */ +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() : 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() : exceptions; + } + + // ------------------------------------------------------------------------ + // Version Range Violations + // ------------------------------------------------------------------------ + + public boolean hasVersionRangeViolations() + { + return versionRangeViolations != null; + } + + /** + * @TODO this needs to accept a {@link OverConstrainedVersionException} as returned by + * {@link #getVersionRangeViolation(int)} but it's not used like that in + * {@link DefaultLegacyArtifactCollector} + */ + public 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() : 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() + : metadataResolutionExceptions; + } + + // ------------------------------------------------------------------------ + // ErrorArtifactExceptions: ArtifactResolutionExceptions + // ------------------------------------------------------------------------ + + public boolean hasErrorArtifactExceptions() + { + return errorArtifactExceptions != null; + } + + public MetadataResolutionResult addError( Exception e ) + { + if ( exceptions == null ) + { + initList( exceptions ); + } + + exceptions.add( e ); + + return this; + } + + public List getErrorArtifactExceptions() + { + if ( errorArtifactExceptions == null ) + { + return Collections.emptyList(); + } + + return 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 circularDependencyExceptions; + } + + // ------------------------------------------------------------------------ + // Repositories + // ------------------------------------------------------------------------ + + public List getRepositories() + { + if ( repositories == null ) + { + return Collections.emptyList(); + } + + return 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() + { + StringBuilder sb = new StringBuilder(); + + if ( artifacts != null ) + { + int i = 1; + sb.append( "---------" ).append( "\n" ); + sb.append( artifacts.size() ).append( "\n" ); + for ( Artifact a : artifacts ) + { + sb.append( i ).append( " " ).append( a ).append( "\n" ); + i++; + } + sb.append( "---------" ).append( "\n" ); + } + + return sb.toString(); + } + + public MetadataGraph getResolvedTree() + { + return resolvedTree; + } + + public void setResolvedTree( MetadataGraph resolvedTree ) + { + this.resolvedTree = resolvedTree; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java new file mode 100644 index 00000000..c15899ed --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/MirrorSelector.java @@ -0,0 +1,44 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.settings.Mirror; + +/** + * Handles the selection of mirrors for repositories. + * + * @author Benjamin Bentmann + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java new file mode 100644 index 00000000..70d3e0a0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/UserLocalArtifactRepository.java @@ -0,0 +1,74 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java new file mode 100644 index 00000000..77b1af12 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/VersionNotFoundException.java @@ -0,0 +1,83 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import 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. + * + * @author Brett Porter + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java new file mode 100644 index 00000000..4e0c4a6b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/ChecksumFailedException.java @@ -0,0 +1,42 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.wagon.TransferFailedException; + +/** + * Occurs when a download checksum fails. + * + * @author Brett Porter + */ +public class ChecksumFailedException + extends TransferFailedException +{ + public ChecksumFailedException( String s ) + { + super( s ); + } + + public ChecksumFailedException( String message, + Throwable cause ) + { + super( message, cause ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java new file mode 100644 index 00000000..57b307ef --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManager.java @@ -0,0 +1,438 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.ByteBuffer; +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.component.annotations.Component; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.IOUtil; + +@Component( role = UpdateCheckManager.class ) +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( 0, channel.size(), false ); + + if ( touchfile.canRead() ) + { + getLogger().debug( "Reading resolution-state from: " + touchfile ); + ByteBuffer buffer = ByteBuffer.allocate( (int) channel.size() ); + + channel.read( buffer ); + buffer.flip(); + + ByteArrayInputStream stream = new ByteArrayInputStream( buffer.array() ); + props.load( stream ); + } + + props.setProperty( key, Long.toString( System.currentTimeMillis() ) ); + + if ( error != null ) + { + props.setProperty( key + ERROR_KEY_SUFFIX, error ); + } + else + { + props.remove( key + ERROR_KEY_SUFFIX ); + } + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + + getLogger().debug( "Writing resolution-state to: " + touchfile ); + props.store( stream, "Last modified on: " + new Date() ); + + byte[] data = stream.toByteArray(); + ByteBuffer buffer = ByteBuffer.allocate( data.length ); + buffer.put( data ); + buffer.flip(); + + channel.position( 0 ); + channel.write( buffer ); + } + 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() ) + { + FileLock lock = null; + FileChannel channel = null; + try + { + Properties props = new Properties(); + + FileInputStream stream = new FileInputStream( touchfile ); + try + { + channel = stream.getChannel(); + lock = channel.lock( 0, channel.size(), true ); + + getLogger().debug( "Reading resolution-state from: " + touchfile ); + props.load( stream ); + + return props; + } + finally + { + IOUtil.close( stream ); + } + } + catch ( IOException e ) + { + getLogger().debug( "Failed to read resolution tracking file " + touchfile, e ); + + return null; + } + finally + { + if ( lock != null ) + { + try + { + lock.release(); + } + catch ( IOException e ) + { + getLogger().debug( "Error releasing shared 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 ); + } + } + } + } + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java new file mode 100644 index 00000000..2c4a60ec --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -0,0 +1,823 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.Method; +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.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.FileUtils; +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 +@Component( role = WagonManager.class ) +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" }; + + @Requirement + private Logger logger; + + @Requirement + private PlexusContainer container; + + @Requirement + private UpdateCheckManager updateCheckManager; + + @Requirement + 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; + } + + @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 + { + FileUtils.copyFile( temp, destination ); + + 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 intermediatary - improve wagon to take a stream + File temp = File.createTempFile( "maven-artifact", null ); + temp.deleteOnExit(); + FileUtils.fileWrite( temp.getAbsolutePath(), "UTF-8", sums.get( extension ) ); + + 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 aCHECKSUM_IDS : CHECKSUM_IDS ) + { + TransferListener checksumListener = checksums.get( aCHECKSUM_IDS ); + 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 ); + + String expectedChecksum = FileUtils.fileRead( tempChecksumFile, "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 + } + FileUtils.copyFile( tempChecksumFile, checksumFile ); + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java new file mode 100644 index 00000000..6dd84dbc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java @@ -0,0 +1,906 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.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.repository.legacy.repository.ArtifactRepositoryFactory; +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.DelegatingLocalArtifactRepository; +import org.apache.maven.repository.LocalArtifactRepository; +import org.apache.maven.repository.ArtifactTransferListener; +import org.apache.maven.repository.MirrorSelector; +import org.apache.maven.repository.Proxy; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.repository.ArtifactDoesNotExistException; +import org.apache.maven.repository.ArtifactTransferFailedException; +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.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.util.StringUtils; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.repository.AuthenticationContext; +import org.eclipse.aether.repository.AuthenticationSelector; +import org.eclipse.aether.repository.ProxySelector; +import org.eclipse.aether.repository.RemoteRepository; + +/** + * @author Jason van Zyl + */ +@Component( role = RepositorySystem.class, hint = "default" ) +public class LegacyRepositorySystem + implements RepositorySystem +{ + + @Requirement + private Logger logger; + + @Requirement + private ArtifactFactory artifactFactory; + + @Requirement + private ArtifactResolver artifactResolver; + + @Requirement + private ArtifactRepositoryFactory artifactRepositoryFactory; + + @Requirement( role = ArtifactRepositoryLayout.class ) + private Map layouts; + + @Requirement + private WagonManager wagonManager; + + @Requirement + private PlexusContainer plexus; + + @Requirement + private MirrorSelector mirrorSelector; + + @Requirement + 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 ) + { + 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 ) + { + 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 ) + { + VersionRange versionRange; + try + { + String version = plugin.getVersion(); + if ( StringUtils.isEmpty( version ) ) + { + version = "RELEASE"; + } + versionRange = VersionRange.createFromVersionSpec( version ); + } + catch ( InvalidVersionSpecificationException 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 sub-modules 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.getIdeWorspace(); + + 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.get( key ); + + if ( aliasedRepos == null ) + { + aliasedRepos = new ArrayList(); + reposByKey.put( key, aliasedRepos ); + } + + 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 ); + + 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() ); + 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 ( StringUtils.isNotEmpty( mirror.getLayout() ) ) + { + repository.setLayout( getLayout( mirror.getLayout() ) ); + } + } + } + + 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 ( StringUtils.isNotEmpty( proxy.getNonProxyHosts() ) ) + { + 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 ( StringUtils.isEmpty( id ) ) + { + throw new InvalidRepositoryException( "Repository identifier missing", "" ); + } + + String url = repo.getUrl(); + + if ( StringUtils.isEmpty( url ) ) + { + throw new InvalidRepositoryException( "URL missing for repository " + id, id ); + } + + ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() ); + + ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() ); + + 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" ); + } + + ArtifactRepository artifactRepository = + artifactRepositoryFactory.createArtifactRepository( repositoryId, url, repositoryLayout, snapshots, + releases ); + + return artifactRepository; + } + + private static String getMessage( Throwable error, String def ) + { + if ( error == null ) + { + return def; + } + String msg = error.getMessage(); + if ( StringUtils.isNotEmpty( msg ) ) + { + 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; + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java new file mode 100644 index 00000000..29b9b82d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/MavenArtifact.java @@ -0,0 +1,96 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.repository.ArtifactTransferResource; +import org.apache.maven.wagon.resource.Resource; + +class MavenArtifact + implements ArtifactTransferResource +{ + + private String repositoryUrl; + + private Resource resource; + + private long transferStartTime; + + public MavenArtifact( String repositoryUrl, Resource resource ) + { + if ( repositoryUrl == null ) + { + this.repositoryUrl = ""; + } + else if ( !repositoryUrl.endsWith( "/" ) && repositoryUrl.length() > 0 ) + { + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java new file mode 100644 index 00000000..b20bd72b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/TransferListenerAdapter.java @@ -0,0 +1,187 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java new file mode 100644 index 00000000..f4e969b6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/UpdateCheckManager.java @@ -0,0 +1,41 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.metadata.RepositoryMetadata; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java new file mode 100644 index 00000000..078de00c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonConfigurationException.java @@ -0,0 +1,63 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.wagon.TransferFailedException; + + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java new file mode 100644 index 00000000..73ead269 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/WagonManager.java @@ -0,0 +1,79 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.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; + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java new file mode 100644 index 00000000..b982f917 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/ArtifactRepositoryFactory.java @@ -0,0 +1,56 @@ +package org.apache.maven.repository.legacy.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.UnknownRepositoryLayoutException; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; + +/** @author jdcasey */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java new file mode 100644 index 00000000..4bc91167 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java @@ -0,0 +1,144 @@ +package org.apache.maven.repository.legacy.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * @author jdcasey + */ +@Component( role = ArtifactRepositoryFactory.class ) +public class DefaultArtifactRepositoryFactory + implements ArtifactRepositoryFactory +{ + // TODO: use settings? + private String globalUpdatePolicy; + + private String globalChecksumPolicy; + + @Requirement( role = ArtifactRepositoryLayout.class ) + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java new file mode 100644 index 00000000..f734416b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java @@ -0,0 +1,796 @@ +package org.apache.maven.repository.legacy.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.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.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.logging.Logger; + +/** + * @author Brett Porter + * @author Jason van Zyl + */ +@Component( role = LegacyArtifactCollector.class ) +public class DefaultLegacyArtifactCollector + implements LegacyArtifactCollector +{ + @Requirement( hint = "nearest" ) + private ConflictResolver defaultConflictResolver; + + @Requirement + private Logger logger; + + @Requirement + 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() ); + } + } + + 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 ); + } + + 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 != null ) && ( 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; + } + + 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 = (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 = (ResolutionNode) 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 retrive 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 effecient 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 ); + } + } + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java new file mode 100644 index 00000000..fa7fb7a4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/LegacyArtifactCollector.java @@ -0,0 +1,62 @@ +package org.apache.maven.repository.legacy.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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. + * + * @author Brett Porter + */ +@Deprecated +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java new file mode 100644 index 00000000..4d129b7e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolver.java @@ -0,0 +1,44 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.resolver.ResolutionNode; + +/** + * Determines which version of an artifact to use when there are conflicting declarations. + * + * @author Jason van Zyl + * @author Mark Hobson + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java new file mode 100644 index 00000000..8f3f9f43 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverFactory.java @@ -0,0 +1,48 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * A factory that produces conflict resolvers of various types. + * + * @author Mark Hobson + * @see ConflictResolver + * @since 3.0 + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java new file mode 100644 index 00000000..b5f61ed1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/ConflictResolverNotFoundException.java @@ -0,0 +1,47 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Indicates that a specified conflict resolver implementation could not be found. + * + * @author Mark Hobson + * @since 3.0 + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java new file mode 100644 index 00000000..76f1929d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolver.java @@ -0,0 +1,36 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.component.annotations.Component; + +/** + * The default conflict resolver that delegates to the nearest strategy. + * + * @author Jason van Zyl + * @see NearestConflictResolver + * @deprecated As of 3.0, use a specific implementation instead, e.g. {@link NearestConflictResolver} + */ +@Deprecated +@Component( role = ConflictResolver.class ) +public class DefaultConflictResolver + extends NearestConflictResolver +{ +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java new file mode 100644 index 00000000..66716d1e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java @@ -0,0 +1,80 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.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. + * + * @author Mark Hobson + * @todo you don't need the container in here with the active maps (jvz). + * @since 3.0 + */ +@Component( role = ConflictResolverFactory.class ) +public class DefaultConflictResolverFactory + implements ConflictResolverFactory, Contextualizable +{ + // fields ----------------------------------------------------------------- + + /** + * The plexus container used to obtain instances from. + */ + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java new file mode 100644 index 00000000..726e9a6d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolver.java @@ -0,0 +1,47 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.codehaus.plexus.component.annotations.Component; + +/** + * 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. + * + * @author Mark Hobson + * @since 3.0 + */ +@Component( role = ConflictResolver.class, hint = "farthest" ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java new file mode 100644 index 00000000..338baed6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolver.java @@ -0,0 +1,48 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.codehaus.plexus.component.annotations.Component; + +/** + * 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. + * + * @author Jason van Zyl + * @author Mark Hobson + * @since 3.0 + */ +@Component( role = ConflictResolver.class, hint = "nearest" ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java new file mode 100644 index 00000000..1879a813 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolver.java @@ -0,0 +1,62 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.OverConstrainedVersionException; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Resolves conflicting artifacts by always selecting the newest declaration. Newest is defined as the + * declaration whose version is greater according to ArtifactVersion.compareTo. + * + * @author Mark Hobson + * @see ArtifactVersion#compareTo + * @since 3.0 + */ +@Component( role = ConflictResolver.class, hint = "newest" ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java new file mode 100644 index 00000000..5c5c12d6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolver.java @@ -0,0 +1,62 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.OverConstrainedVersionException; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Resolves conflicting artifacts by always selecting the oldest declaration. Oldest is defined as the + * declaration whose version is less according to ArtifactVersion.compareTo. + * + * @author Mark Hobson + * @see ArtifactVersion#compareTo + * @since 3.0 + */ +@Component( role = ConflictResolver.class, hint = "oldest" ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java new file mode 100644 index 00000000..3a5c7c6a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/AbstractVersionTransformation.java @@ -0,0 +1,135 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultRepositoryRequest; +import org.apache.maven.artifact.repository.RepositoryRequest; +import org.apache.maven.artifact.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.component.annotations.Requirement; +import org.codehaus.plexus.logging.AbstractLogEnabled; + +/** + * Describes a version transformation during artifact resolution. + * + * @author Brett Porter + * @todo try and refactor to remove abstract methods - not particular happy about current design + */ +public abstract class AbstractVersionTransformation + extends AbstractLogEnabled + implements ArtifactTransformation +{ + @Requirement + protected RepositoryMetadataManager repositoryMetadataManager; + + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java new file mode 100644 index 00000000..42604d75 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformation.java @@ -0,0 +1,86 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.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; + +/** + * @author Jason van Zyl + */ +public interface ArtifactTransformation +{ + String ROLE = ArtifactTransformation.class.getName(); + + /** + * Take in a 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 a 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 a 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 a 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java new file mode 100644 index 00000000..f0ac9c89 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ArtifactTransformationManager.java @@ -0,0 +1,82 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.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. */ +public interface ArtifactTransformationManager +{ + String ROLE = ArtifactTransformationManager.class.getName(); + + /** + * Take in a 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 a 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 a 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 a 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java new file mode 100644 index 00000000..e9b1afbc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/DefaultArtifactTransformationManager.java @@ -0,0 +1,86 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * @author Jason van Zyl + */ +@Component( role = ArtifactTransformationManager.class ) +public class DefaultArtifactTransformationManager + implements ArtifactTransformationManager +{ + @Requirement( role = ArtifactTransformation.class, hints = { "release", "latest", "snapshot" } ) + private List artifactTransformations; + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java new file mode 100644 index 00000000..7b0e8513 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/LatestArtifactTransformation.java @@ -0,0 +1,74 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.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; +import org.codehaus.plexus.component.annotations.Component; + +@Component( role = ArtifactTransformation.class, hint = "latest" ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java new file mode 100644 index 00000000..3714924c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/ReleaseArtifactTransformation.java @@ -0,0 +1,100 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.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; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Change the version RELEASE to the appropriate release version from the remote repository. + * + * @author Brett Porter + */ +@Component( role = ArtifactTransformation.class, hint = "release" ) +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(); + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java new file mode 100644 index 00000000..94f0ec0b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/transform/SnapshotTransformation.java @@ -0,0 +1,171 @@ +package org.apache.maven.repository.legacy.resolver.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.util.StringUtils; + +/** + * @author Brett Porter + * @author Michal Maczka + */ +@Component( role = ArtifactTransformation.class, hint = "snapshot" ) +public class SnapshotTransformation + extends AbstractVersionTransformation +{ + private String deploymentTimestamp; + + private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" ); + + private static final String UTC_TIMESTAMP_PATTERN = "yyyyMMdd.HHmmss"; + + 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(); + + 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 = StringUtils.replace( baseVersion, 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( UTC_TIMESTAMP_PATTERN ); + utcDateFormatter.setTimeZone( UTC_TIME_ZONE ); + return utcDateFormatter; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java new file mode 100644 index 00000000..2666eafb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ArtifactMetadata.java @@ -0,0 +1,353 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collection; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * Artifact Metadata that is resolved independent of Artifact itself. + * + * @author Oleg Gusakov + */ +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 it's 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 ); + } + //------------------------------------------------------------------ + 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; + } + //------------------------------------------------------------------ + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java new file mode 100644 index 00000000..b0cb5b2f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java @@ -0,0 +1,144 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * classpath container that is aware of the classpath scope + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java new file mode 100644 index 00000000..eece4133 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathTransformation.java @@ -0,0 +1,46 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * Helper class to conver an Md Graph into some form of a classpath + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java new file mode 100644 index 00000000..03984fbd --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultClasspathTransformation.java @@ -0,0 +1,183 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import org.apache.maven.artifact.ArtifactScopeEnum; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * default implementation of the metadata classpath transformer + * + * @author Oleg Gusakov + * + */ +@Component( role = ClasspathTransformation.class ) +public class DefaultClasspathTransformation + implements ClasspathTransformation +{ + @Requirement + 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[exits.size()] ); + Arrays.sort( sortedExits + , + 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(); + } + } + ); + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java new file mode 100644 index 00000000..bb764227 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicy.java @@ -0,0 +1,73 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Configuration; + +/** + * @author Oleg Gusakov + * + */ +@Component( role = GraphConflictResolutionPolicy.class ) +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java new file mode 100644 index 00000000..77060299 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolver.java @@ -0,0 +1,249 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.TreeSet; + +import org.apache.maven.artifact.ArtifactScopeEnum; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +/** + * Default conflict resolver.Implements closer newer first policy by default, but could be configured via plexus + * + * @author Oleg Gusakov + */ +@Component( role = GraphConflictResolver.class ) +public class DefaultGraphConflictResolver + implements GraphConflictResolver +{ + /** + * artifact, closer to the entry point, is selected + */ + @Requirement( role = GraphConflictResolutionPolicy.class ) + 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 any more + 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 ); + } + } + MetadataGraph linkedRes = findLinkedSubgraph( res ); + // 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 linkedRes; + } + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java new file mode 100644 index 00000000..035904aa --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionException.java @@ -0,0 +1,51 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java new file mode 100644 index 00000000..979d3831 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolutionPolicy.java @@ -0,0 +1,35 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * MetadataGraph edge selection policy. Complements + * GraphConflictResolver by being injected into it + * + * @author Oleg Gusakov + * + */ + +public interface GraphConflictResolutionPolicy +{ + String ROLE = GraphConflictResolutionPolicy.class.getName(); + + MetadataGraphEdge apply( MetadataGraphEdge e1, MetadataGraphEdge e2 ); +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java new file mode 100644 index 00000000..ef70baa2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/GraphConflictResolver.java @@ -0,0 +1,48 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * Resolves conflicts in the supplied dependency graph. + * Different implementations will implement different conflict resolution policies. + * + * @author Oleg Gusakov + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java new file mode 100644 index 00000000..55b02504 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraph.java @@ -0,0 +1,523 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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 + * + * @author Oleg Gusakov + * + */ +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.get( vFrom ); + if ( exList == null ) + { + exList = new ArrayList(); + excidentEdges.put( vFrom, exList ); + } + + if ( !exList.contains( e ) ) + { + exList.add( e ); + } + + List inList = incidentEdges.get( vTo ); + if ( inList == null ) + { + inList = new ArrayList(); + incidentEdges.put( vTo, inList ); + } + + 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() + { + StringBuilder sb = new StringBuilder( 512 ); + if ( isEmpty() ) + { + return "empty"; + } + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java new file mode 100644 index 00000000..5f16df06 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphEdge.java @@ -0,0 +1,189 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * metadata graph edge - combination of version, scope and depth define + * an edge in the graph + * + * @author Oleg Gusakov + * + */ + +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 + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java new file mode 100644 index 00000000..16a34a8c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphTransformationException.java @@ -0,0 +1,50 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java new file mode 100644 index 00000000..bdccf6a5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataGraphVertex.java @@ -0,0 +1,216 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * metadata graph vertice - just a wrapper around artifact's metadata + * + * @author Oleg Gusakov + */ +public class MetadataGraphVertex + implements Comparable +{ + ArtifactMetadata md; + + // indications to use these in comparrison + 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 == null || !( 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java new file mode 100644 index 00000000..9a9130b2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolution.java @@ -0,0 +1,71 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collection; + +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** + * + * @author Jason van Zyl + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java new file mode 100644 index 00000000..24f832ef --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionException.java @@ -0,0 +1,49 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java new file mode 100644 index 00000000..e1f6fe1e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequest.java @@ -0,0 +1,79 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** @author Oleg Gusakov */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java new file mode 100644 index 00000000..f305497a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionRequestTypeEnum.java @@ -0,0 +1,45 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java new file mode 100644 index 00000000..1d9e9c46 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataResolutionResult.java @@ -0,0 +1,172 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.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 + * + * @author Oleg Gusakov + */ +public class MetadataResolutionResult +{ + MetadataTreeNode treeRoot; + + /** + * these components are 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.classpathRuntime ) ) + { + return conflictResolver.resolveConflicts( getGraph(), ArtifactScopeEnum.test ); + } + else if ( requestType.equals( MetadataResolutionRequestTypeEnum.classpathRuntime ) ) + { + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java new file mode 100644 index 00000000..f5461d71 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataRetrievalException.java @@ -0,0 +1,59 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Error while retrieving repository metadata from the repository. + * + * @author Jason van Zyl + */ +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; + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java new file mode 100644 index 00000000..3ca6ce84 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataSource.java @@ -0,0 +1,39 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.artifact.repository.ArtifactRepository; + +/** + * Provides some metadata operations, like querying the remote repository for a list of versions available for an + * artifact. + * + * @author Jason van Zyl + */ +public interface MetadataSource +{ + String ROLE = MetadataSource.class.getName(); + + MetadataResolution retrieve( ArtifactMetadata artifact, ArtifactRepository localRepository, + List remoteRepositories ) + throws MetadataRetrievalException; +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java new file mode 100644 index 00000000..dd720d38 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/repository/metadata/MetadataTreeNode.java @@ -0,0 +1,148 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactScopeEnum; + +/** + * metadata [dirty] Tree + * + * @author Oleg Gusakov + * + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java new file mode 100644 index 00000000..050d135c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java @@ -0,0 +1,37 @@ +package org.apache.maven.usability.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java new file mode 100644 index 00000000..0e98b0cb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java @@ -0,0 +1,175 @@ +package org.apache.maven.usability.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +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 EXPRESSION_ROOT : EXPRESSION_ROOTS ) + { + InputStream docStream = null; + try + { + docStream = + docLoader.getResourceAsStream( EXPRESSION_DOCO_ROOTPATH + EXPRESSION_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: " + EXPRESSION_ROOT, e ); + } + catch ( XmlPullParserException e ) + { + throw new ExpressionDocumentationException( + "Failed to parse documentation for expression root: " + EXPRESSION_ROOT, e ); + } + finally + { + IOUtil.close( docStream ); + } + } + } + + 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 + { + Reader reader = new BufferedReader( ReaderFactory.newXmlReader( docStream ) ); + + ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader(); + + ExpressionDocumentation documentation = paramdocReader.read( reader, true ); + + List expressions = documentation.getExpressions(); + + Map bySyntax = new HashMap(); + + if ( expressions != null && !expressions.isEmpty() ) + { + for ( Object expression : expressions ) + { + Expression expr = (Expression) expression; + + bySyntax.put( expr.getSyntax(), expr ); + } + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/paramdoc.mdo b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/paramdoc.mdo new file mode 100644 index 00000000..ab253316 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/paramdoc.mdo @@ -0,0 +1,154 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/profiles.mdo b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/profiles.mdo new file mode 100644 index 00000000..3dcc9962 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/mdo/profiles.mdo @@ -0,0 +1,398 @@ + + + + profiles + Profiles + + + + 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 repoistory + + + + 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 - warn, fail, etc. Valid values are + "fail" or "warn" + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml new file mode 100644 index 00000000..9acebefc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml @@ -0,0 +1,172 @@ + + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml new file mode 100644 index 00000000..27f03435 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml @@ -0,0 +1,48 @@ + + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml new file mode 100644 index 00000000..e058218a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml @@ -0,0 +1,53 @@ + + + + + + + settings.offline + + true + ]]> + + + + + settings.interactiveMode + + true + ]]> + + + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin.xml new file mode 100644 index 00000000..da5a62c0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/main/resources/META-INF/maven/plugin.xml @@ -0,0 +1,218 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/site/site.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/site/site.xml new file mode 100644 index 00000000..3a16bf98 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/site/site.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java new file mode 100644 index 00000000..010c566b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java @@ -0,0 +1,371 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.plugin.LegacySupport; +import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +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.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusTestCase; +import org.eclipse.aether.DefaultRepositorySystemSession; +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.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.selector.OptionalDependencySelector; +import org.eclipse.aether.util.graph.selector.ScopeDependencySelector; +import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer; +import org.eclipse.aether.util.graph.transformer.ConflictResolver; +import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver; +import org.eclipse.aether.util.graph.transformer.JavaScopeSelector; +import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner; +import org.eclipse.aether.util.graph.transformer.NearestVersionSelector; +import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector; +import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser; +import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy; + +/** + * @author Jason van Zyl + */ +public abstract class AbstractArtifactComponentTestCase + extends PlexusTestCase +{ + protected ArtifactFactory artifactFactory; + + protected ArtifactRepositoryFactory artifactRepositoryFactory; + + @Override + protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) + { + super.customizeContainerConfiguration( containerConfiguration ); + containerConfiguration.setAutoWiring( true ); + containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); + } + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + artifactFactory = lookup( ArtifactFactory.class); + artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class ); + + RepositorySystemSession repoSession = initRepoSession(); + MavenSession session = + new MavenSession( getContainer(), repoSession, new DefaultMavenExecutionRequest(), + new DefaultMavenExecutionResult() ); + + LegacySupport legacySupport = lookup(LegacySupport.class); + legacySupport.setSession( session ); + } + + @Override + protected void tearDown() + throws Exception + { + release( artifactFactory ); + + super.tearDown(); + } + + 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(); + + ArtifactRepositoryLayout repoLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + 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 ); + + ArtifactRepositoryLayout repoLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + 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 ); + + ArtifactRepositoryLayout repoLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + return artifactRepositoryFactory.createArtifactRepository( "test", "file://" + f.getPath(), repoLayout, + new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() ); + } + + protected ArtifactRepository badRemoteRepository() + throws Exception + { + ArtifactRepositoryLayout repoLayout = + (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + 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 ); + + if ( !file.exists() ) + { + fail( "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 ); + + if ( !file.exists() ) + { + fail( "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 ); + + if ( file.exists() ) + { + fail( "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 ); + + if ( file.exists() ) + { + fail( "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(); + } + + Writer writer = new OutputStreamWriter( new FileOutputStream( artifactFile ), "ISO-8859-1" ); + + writer.write( artifact.getId() ); + + writer.close(); + } + + 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 RepositorySystemSession initRepoSession() + throws Exception + { + DefaultRepositorySystemSession session = new DefaultRepositorySystemSession(); + session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) ); + DependencyTraverser depTraverser = new FatArtifactTraverser(); + session.setDependencyTraverser( depTraverser ); + + DependencyManager depManager = new ClassicDependencyManager(); + session.setDependencyManager( depManager ); + + DependencySelector depFilter = + new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ), + new OptionalDependencySelector(), new ExclusionDependencySelector() ); + session.setDependencySelector( depFilter ); + + DependencyGraphTransformer transformer = + new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(), + new SimpleOptionalitySelector(), new JavaScopeDeriver() ); + new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() ); + session.setDependencyGraphTransformer( transformer ); + + LocalRepository localRepo = new LocalRepository( localRepository().getBasedir() ); + session.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( session, localRepo ) ); + + return session; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java new file mode 100644 index 00000000..7b20eb5d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java @@ -0,0 +1,79 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.maven.artifact.versioning.VersionRange; + +import junit.framework.TestCase; + +/** + * Tests {@link ArtifactUtils}. + * + * @author Benjamin Bentmann + */ +public class ArtifactUtilsTest + extends TestCase +{ + + private Artifact newArtifact( String aid ) + { + return new DefaultArtifact( "group", aid, VersionRange.createFromVersion( "1.0" ), "test", "jar", "tests", null ); + } + + public void testIsSnapshot() + { + assertEquals( false, ArtifactUtils.isSnapshot( null ) ); + assertEquals( false, ArtifactUtils.isSnapshot( "" ) ); + assertEquals( false, ArtifactUtils.isSnapshot( "1.2.3" ) ); + assertEquals( true, ArtifactUtils.isSnapshot( "1.2.3-SNAPSHOT" ) ); + assertEquals( true, ArtifactUtils.isSnapshot( "1.2.3-snapshot" ) ); + assertEquals( true, ArtifactUtils.isSnapshot( "1.2.3-20090413.094722-2" ) ); + } + + public void testToSnapshotVersion() + { + assertEquals( "1.2.3", ArtifactUtils.toSnapshotVersion( "1.2.3" ) ); + assertEquals( "1.2.3-SNAPSHOT", ArtifactUtils.toSnapshotVersion( "1.2.3-SNAPSHOT" ) ); + assertEquals( "1.2.3-SNAPSHOT", ArtifactUtils.toSnapshotVersion( "1.2.3-20090413.094722-2" ) ); + } + + /** + * Tests that the ordering of the map resembles the ordering of the input collection of artifacts. + */ + public void testArtifactMapByVersionlessIdOrdering() + throws Exception + { + List list = new ArrayList(); + list.add( newArtifact( "b" ) ); + list.add( newArtifact( "a" ) ); + list.add( newArtifact( "c" ) ); + list.add( newArtifact( "e" ) ); + list.add( newArtifact( "d" ) ); + + Map map = ArtifactUtils.artifactMapByVersionlessId( list ); + assertNotNull( map ); + assertEquals( list, new ArrayList( map.values() ) ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java new file mode 100644 index 00000000..fbd01191 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java @@ -0,0 +1,140 @@ +package org.apache.maven.artifact; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import junit.framework.TestCase; + +import org.apache.maven.artifact.handler.ArtifactHandlerMock; +import org.apache.maven.artifact.versioning.VersionRange; + +public class DefaultArtifactTest + extends TestCase +{ + + private DefaultArtifact artifact; + + private DefaultArtifact snapshotArtifact; + + private String groupId = "groupid", artifactId = "artifactId", version = "1.0", scope = "artifactScope", type = "type", + classifier = "classifier"; + + private String snapshotSpecVersion = "1.0-SNAPSHOT"; + private String snapshotResolvedVersion = "1.0-20070606.010101-1"; + + private VersionRange versionRange; + private VersionRange snapshotVersionRange; + + private ArtifactHandlerMock artifactHandler; + + protected void setUp() + throws Exception + { + super.setUp(); + artifactHandler = new ArtifactHandlerMock(); + versionRange = VersionRange.createFromVersion( version ); + artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler ); + + snapshotVersionRange = VersionRange.createFromVersion( snapshotResolvedVersion ); + snapshotArtifact = new DefaultArtifact( groupId, artifactId, snapshotVersionRange, scope, type, classifier, artifactHandler ); + } + + public void testGetVersionReturnsResolvedVersionOnSnapshot() + { + assertEquals( snapshotResolvedVersion, snapshotArtifact.getVersion() ); + + // this is FOUL! +// snapshotArtifact.isSnapshot(); + + assertEquals( snapshotSpecVersion, snapshotArtifact.getBaseVersion() ); + } + + public void testGetDependencyConflictId() + { + assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() ); + } + + public void testGetDependencyConflictIdNullGroupId() + { + artifact.setGroupId( null ); + assertEquals( null + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() ); + } + + public void testGetDependencyConflictIdNullClassifier() + { + artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler ); + assertEquals( groupId + ":" + artifactId + ":" + type, artifact.getDependencyConflictId() ); + } + + public void testGetDependencyConflictIdNullScope() + { + artifact.setScope( null ); + assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() ); + } + + public void testToString() + { + assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, + artifact.toString() ); + } + + public void testToStringNullGroupId() + { + artifact.setGroupId( null ); + assertEquals( artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact.toString() ); + } + + public void testToStringNullClassifier() + { + artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler ); + assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact.toString() ); + } + + public void testToStringNullScope() + { + artifact.setScope( null ); + assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version, artifact.toString() ); + } + + public void testComparisonByVersion() + { + Artifact artifact1 = new DefaultArtifact( groupId, artifactId, VersionRange.createFromVersion( "5.0" ), scope, + type, classifier, artifactHandler ); + Artifact artifact2 = new DefaultArtifact( groupId, artifactId, VersionRange.createFromVersion( "12.0" ), scope, + type, classifier, artifactHandler ); + + assertTrue( artifact1.compareTo( artifact2 ) < 0 ); + assertTrue( artifact2.compareTo( artifact1 ) > 0 ); + + Artifact artifact = new DefaultArtifact( groupId, artifactId, VersionRange.createFromVersion( "5.0" ), scope, + type, classifier, artifactHandler ); + assertTrue( artifact.compareTo( artifact1 ) == 0 ); + assertTrue( artifact1.compareTo( artifact ) == 0 ); + } + + public void testNonResolvedVersionRangeConsistentlyYieldsNullVersions() + throws Exception + { + VersionRange vr = VersionRange.createFromVersionSpec( "[1.0,2.0)" ); + artifact = new DefaultArtifact( groupId, artifactId, vr, scope, type, null, artifactHandler ); + assertEquals( null, artifact.getVersion() ); + assertEquals( null, artifact.getBaseVersion() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java new file mode 100644 index 00000000..f929f480 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java @@ -0,0 +1,67 @@ +package org.apache.maven.artifact.deployer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.AbstractArtifactComponentTestCase; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.codehaus.plexus.util.FileUtils; + +/** + * @author Jason van Zyl + */ +public class ArtifactDeployerTest + extends AbstractArtifactComponentTestCase +{ + private ArtifactDeployer artifactDeployer; + + protected void setUp() + throws Exception + { + super.setUp(); + + artifactDeployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE ); + } + + protected String component() + { + return "deployer"; + } + + public void testArtifactInstallation() + throws Exception + { + 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", FileUtils.fileRead( file, "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", FileUtils.fileRead( deployedFile, "UTF-8" ).trim() ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java new file mode 100644 index 00000000..f6bebcba --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/deployer/SimpleArtifactMetadataSource.java @@ -0,0 +1,66 @@ +package org.apache.maven.artifact.deployer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.DefaultArtifactVersion; +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; + +/** @author Jason van Zyl */ +public class SimpleArtifactMetadataSource + implements ArtifactMetadataSource +{ + public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + throw new UnsupportedOperationException( "Cannot retrieve metadata in this test case" ); + } + + public List retrieveAvailableVersions( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + return Collections.singletonList( new DefaultArtifactVersion( "10.1.3" ) ); + } + + public List retrieveAvailableVersionsFromDeploymentRepository( Artifact artifact, + ArtifactRepository localRepository, + ArtifactRepository remoteRepository ) + throws ArtifactMetadataRetrievalException + { + return Collections.singletonList( new DefaultArtifactVersion( "10.1.3" ) ); + } + + public ResolutionGroup retrieve( MetadataResolutionRequest request ) + throws ArtifactMetadataRetrievalException + { + return retrieve( request.getArtifact(), request.getLocalRepository(), request.getRemoteRepositories() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java new file mode 100644 index 00000000..0d109acb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java @@ -0,0 +1,49 @@ +package org.apache.maven.artifact.factory; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.versioning.VersionRange; +import org.codehaus.plexus.PlexusTestCase; + +public class DefaultArtifactFactoryTest + extends PlexusTestCase +{ + + public void testPropagationOfSystemScopeRegardlessOfInheritedScope() throws Exception + { + ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerMock.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerMock.java new file mode 100644 index 00000000..a9f335e6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerMock.java @@ -0,0 +1,100 @@ +package org.apache.maven.artifact.handler; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +public class ArtifactHandlerMock + implements ArtifactHandler +{ + + private String extension, directory, classifier, packaging, language; + + private boolean includesDependencies, addedToClasspath; + + public void setExtension( String extension ) + { + this.extension = extension; + } + + public String getExtension() + { + return extension; + } + + public void setDirectory( String directory ) + { + this.directory = directory; + } + + public String getDirectory() + { + return directory; + } + + public void setClassifier( String classifier ) + { + this.classifier = classifier; + } + + public String getClassifier() + { + return classifier; + } + + public void setPackaging( String packaging ) + { + this.packaging = packaging; + } + + public String getPackaging() + { + return packaging; + } + + public void setIncludesDependencies( boolean includesDependencies ) + { + this.includesDependencies = includesDependencies; + } + + public boolean isIncludesDependencies() + { + return includesDependencies; + } + + public void setLanguage( String language ) + { + this.language = language; + } + + public String getLanguage() + { + return language; + } + + public void setAddedToClasspath( boolean addedToClasspath ) + { + this.addedToClasspath = addedToClasspath; + } + + public boolean isAddedToClasspath() + { + return addedToClasspath; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java new file mode 100644 index 00000000..21bfb2b7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java @@ -0,0 +1,61 @@ +package org.apache.maven.artifact.installer; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.AbstractArtifactComponentTestCase; +import org.apache.maven.artifact.Artifact; + +/** + * @author Jason van Zyl + */ +public class ArtifactInstallerTest + extends AbstractArtifactComponentTestCase +{ + private ArtifactInstaller artifactInstaller; + + protected void setUp() + throws Exception + { + super.setUp(); + + artifactInstaller = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE ); + } + + protected String component() + { + return "installer"; + } + + public void testArtifactInstallation() + throws Exception + { + 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 ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java new file mode 100644 index 00000000..f8bb1677 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/metadata/TestMetadataSource.java @@ -0,0 +1,102 @@ +package org.apache.maven.artifact.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +@Component(role = ArtifactMetadataSource.class, hint="test") +public class TestMetadataSource + implements ArtifactMetadataSource +{ + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java new file mode 100644 index 00000000..533f3042 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java @@ -0,0 +1,59 @@ +package org.apache.maven.artifact.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import junit.framework.TestCase; + +public class MavenArtifactRepositoryTest + extends TestCase +{ + private static class MavenArtifactRepositorySubclass extends MavenArtifactRepository + { + String id; + + public MavenArtifactRepositorySubclass(String id) + { + this.id = id; + } + + @Override + public String getId() + { + return id; + } + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java new file mode 100644 index 00000000..aeacfb81 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java @@ -0,0 +1,64 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; +import java.util.List; + +import junit.framework.TestCase; + +/** + * Test the artifact resolution exception message + * + * @author Mauro Talevi + */ +public class ArtifactResolutionExceptionTest + extends TestCase +{ + private static final String LS = System.getProperty( "line.separator" ); + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java new file mode 100644 index 00000000..117c0e22 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java @@ -0,0 +1,283 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.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.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.versioning.ArtifactVersion; +import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest; +import org.codehaus.plexus.component.repository.ComponentDescriptor; + +// It would be cool if there was a hook that i could use to setup a test environment. +// I want to setup 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. + +/** + * @author Jason van Zyl + */ +public class ArtifactResolverTest + extends AbstractArtifactComponentTestCase +{ + private DefaultArtifactResolver artifactResolver; + + private Artifact projectArtifact; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + artifactResolver = (DefaultArtifactResolver) lookup( ArtifactResolver.class ); + + projectArtifact = createLocalArtifact( "project", "3.0" ); + } + + @Override + protected void tearDown() + throws Exception + { + artifactFactory = null; + projectArtifact = null; + super.tearDown(); + } + + @Override + protected String component() + { + return "resolver"; + } + + public void testResolutionOfASingleArtifactWhereTheArtifactIsPresentInTheLocalRepository() + throws Exception + { + Artifact a = createLocalArtifact( "a", "1.0" ); + + artifactResolver.resolve( a, remoteRepositories(), localRepository() ); + + assertLocalArtifactPresent( a ); + } + + public 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 ); + } + + public 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 ); + } + + public 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 ); + } + + public void testResolutionFailureWhenArtifactNotPresentInRemoteRepository() + throws Exception + { + Artifact k = createArtifact( "k", "1.0" ); + + try + { + artifactResolver.resolve( k, remoteRepositories(), localRepository() ); + fail( "Resolution succeeded when it should have failed" ); + } + catch ( ArtifactNotFoundException expected ) + { + assertTrue( true ); + } + } + + public 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 testTransitiveResolutionOrder() + throws Exception + { + Artifact m = createLocalArtifact( "m", "1.0" ); + + Artifact n = createLocalArtifact( "n", "1.0" ); + + ArtifactMetadataSource mds = new ArtifactMetadataSource() + { + public ResolutionGroup retrieve( Artifact artifact, ArtifactRepository localRepository, + List remoteRepositories ) + throws ArtifactMetadataRetrievalException + { + Set dependencies = new HashSet(); + + 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() ); + } + }; + + 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 should be first", n, i.next() ); + assertEquals( "m should be second", m, i.next() ); + + // 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 should be first", m, i.next() ); + assertEquals( "n should be second", n, i.next() ); + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java new file mode 100644 index 00000000..914d9d1c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java @@ -0,0 +1,111 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; + +import org.apache.maven.artifact.AbstractArtifactComponentTestCase; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.resolver.DefaultArtifactResolver.DaemonThreadCreator; + +public class DefaultArtifactResolverTest + extends AbstractArtifactComponentTestCase +{ + private DefaultArtifactResolver artifactResolver; + + private Artifact projectArtifact; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + artifactResolver = (DefaultArtifactResolver) lookup( ArtifactResolver.class ); + + projectArtifact = createLocalArtifact( "project", "3.0" ); + } + + @Override + protected void tearDown() + throws Exception + { + artifactFactory = null; + projectArtifact = null; + super.tearDown(); + } + + @Override + protected String component() + { + return "resolver"; + } + + public 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( 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( name + " is no daemon Thread.", daemon ); + } + + } + + assertTrue( "Could not find ThreadGroup: " + DaemonThreadCreator.THREADGROUP_NAME, seen ); + } + + public void testLookup() + throws Exception + { + ArtifactResolver resolver = lookup( ArtifactResolver.class, "default" ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java new file mode 100644 index 00000000..c78c1901 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestFileWagon.java @@ -0,0 +1,94 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.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 annotates some methods. Note that this is not a thread-safe implementation. + */ +public class TestFileWagon + extends FileWagon +{ + private TestTransferListener testTransferListener; + private boolean insideGet; + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java new file mode 100644 index 00000000..afec3ef5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/TestTransferListener.java @@ -0,0 +1,43 @@ +package org.apache.maven.artifact.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.List; + +import 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java new file mode 100644 index 00000000..bca112b8 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java @@ -0,0 +1,62 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; + +import org.apache.maven.artifact.Artifact; + +import junit.framework.TestCase; + +/** + * Tests {@link AndArtifactFilter}. + * + * @author Benjamin Bentmann + */ +public class AndArtifactFilterTest + extends TestCase +{ + + private ArtifactFilter newSubFilter() + { + return new ArtifactFilter() + { + public boolean include( Artifact artifact ) + { + return false; + } + }; + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java new file mode 100644 index 00000000..fb465663 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java @@ -0,0 +1,50 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; +import java.util.List; + +import junit.framework.TestCase; + +/** + * @author Igor Fedorenko + */ +public class FilterHashEqualsTest + extends TestCase +{ + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java new file mode 100644 index 00000000..e161437f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java @@ -0,0 +1,62 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; + +import org.apache.maven.artifact.Artifact; + +import junit.framework.TestCase; + +/** + * Tests {@link OrArtifactFilter}. + * + * @author Benjamin Bentmann + */ +public class OrArtifactFilterTest + extends TestCase +{ + + private ArtifactFilter newSubFilter() + { + return new ArtifactFilter() + { + public boolean include( Artifact artifact ) + { + return false; + } + }; + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java new file mode 100644 index 00000000..1a65eca0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java @@ -0,0 +1,96 @@ +package org.apache.maven.artifact.resolver.filter; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DefaultArtifact; + +import junit.framework.TestCase; + +/** + * Tests {@link ScopeArtifactFilter}. + * + * @author Benjamin Bentmann + */ +public class ScopeArtifactFilterTest + extends TestCase +{ + + private Artifact newArtifact( String scope ) + { + return new DefaultArtifact( "g", "a", "1.0", scope, "jar", "", null ); + } + + public 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 ) ) ); + } + + public 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 ) ) ); + } + + public 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 ) ) ); + } + + public 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 ) ) ); + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java new file mode 100644 index 00000000..a9f1ab7d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java @@ -0,0 +1,224 @@ +package org.apache.maven.artifact.testutils; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import junit.framework.Assert; + +import org.codehaus.plexus.util.FileUtils; + +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 = new Runnable() + { + + public void run() + { + 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 ) + { + Assert.assertTrue( file.exists() ); + } + else + { + Assert.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 ); + + Assert.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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java new file mode 100644 index 00000000..38450929 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java @@ -0,0 +1,46 @@ +package org.apache.maven.artifact.transform; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.util.List; + +import org.apache.maven.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.PlexusTestCase; + +/** @author Jason van Zyl */ +public class TransformationManagerTest + extends PlexusTestCase +{ + public void testTransformationManager() + throws Exception + { + ArtifactTransformationManager tm = lookup( ArtifactTransformationManager.class ); + + List tms = tm.getArtifactTransformations(); + + assertEquals( 3, tms.size() ); + + assertTrue( "We expected the release transformation and got " + tms.get(0), tms.get(0) instanceof ReleaseArtifactTransformation ); + + assertTrue( "We expected the latest transformation and got " + tms.get(1), tms.get(1) instanceof LatestArtifactTransformation ); + + assertTrue( "We expected the snapshot transformation and got " + tms.get(2), tms.get(2) instanceof SnapshotTransformation ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java new file mode 100644 index 00000000..8e3b86a6 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java @@ -0,0 +1,232 @@ +package org.apache.maven.profiles.manager; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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.PlexusTestCase; + +public class DefaultProfileManagerTest + extends PlexusTestCase +{ + + public void setUp() + throws Exception + { + super.setUp(); + } + + public 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() ); + } + + public 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() ); + } + + + public 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() ); + } + + public 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() ); + } + + public 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() ); + } +/* + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java new file mode 100644 index 00000000..7e3f7e6b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java @@ -0,0 +1,185 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.io.File; +import java.io.FileNotFoundException; +import java.net.URI; +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.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.ContainerConfiguration; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusTestCase; +import org.eclipse.aether.DefaultRepositorySystemSession; + +/** + * @author Jason van Zyl + */ +public abstract class AbstractMavenProjectTestCase + extends PlexusTestCase +{ + protected ProjectBuilder projectBuilder; + + protected RepositorySystem repositorySystem; + + @Override + protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) + { + super.customizeContainerConfiguration( containerConfiguration ); + containerConfiguration.setAutoWiring( true ); + containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); + } + + protected void setUp() + throws Exception + { + super.setUp(); + + if ( getContainer().hasComponent( ProjectBuilder.class, "test" ) ) + { + projectBuilder = lookup( ProjectBuilder.class, "test" ); + } + else + { + // default over to the main project builder... + projectBuilder = lookup( ProjectBuilder.class ); + } + + repositorySystem = lookup( RepositorySystem.class ); + } + + @Override + protected void tearDown() + throws Exception + { + projectBuilder = null; + + super.tearDown(); + } + + protected ProjectBuilder getProjectBuilder() + { + return projectBuilder; + } + + @Override + protected String getCustomConfigurationName() + { + String name = AbstractMavenProjectTestCase.class.getName().replace( '.', '/' ) + ".xml"; + System.out.println( name ); + return name; + } + + // ---------------------------------------------------------------------- + // 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 + { + ClassLoader cloader = Thread.currentThread().getContextClassLoader(); + + URL resourceUrl = cloader.getResource( resource ); + + if ( resourceUrl == null ) + { + throw new FileNotFoundException( "Unable to find: " + resource ); + } + + return new File( URI.create( resourceUrl.toString().replaceAll( " ", "%20" ) ) ); + } + + protected ArtifactRepository getLocalRepository() + throws Exception + { + ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" ); + + 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 ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java new file mode 100644 index 00000000..36eaee8f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ClasspathArtifactResolver.java @@ -0,0 +1,89 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.codehaus.plexus.component.annotations.Component; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.Artifact; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.transfer.ArtifactNotFoundException; + +/** + * @author Benjamin Bentmann + */ +@Component( role = ArtifactResolver.class, hint = "classpath" ) +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( ProjectClasspathTest.getFileForClasspathResource( ProjectClasspathTest.dir + + "transitive-" + scope + "-dep.xml" ) ); + result.setArtifact( artifact ); + } + catch ( FileNotFoundException e ) + { + throw new IllegalStateException( "Missing test POM for " + artifact ); + } + } + else + { + result.addException( new ArtifactNotFoundException( artifact, 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java new file mode 100644 index 00000000..024917de --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecycleExecutor.java @@ -0,0 +1,110 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.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. + * + * @author Benjamin Bentmann + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecyclePluginAnalyzer.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecyclePluginAnalyzer.java new file mode 100644 index 00000000..5a78a7e5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/EmptyLifecyclePluginAnalyzer.java @@ -0,0 +1,78 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.apache.maven.lifecycle.LifeCyclePluginAnalyzer; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginExecution; + +/** + * @author Benjamin Bentmann + */ +public class EmptyLifecyclePluginAnalyzer + implements LifeCyclePluginAnalyzer +{ + 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; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java new file mode 100644 index 00000000..52fdd804 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java @@ -0,0 +1,192 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.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; + +/** + * @author Benjamin Bentmann + */ +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' ).append( '/' ); + + path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); + + if ( artifact.getClassifier().length() > 0 ) + { + 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().length() > 0 ) + { + path.append( metadata.getGroupId().replace( '.', '/' ) ).append( '/' ); + + if ( metadata.getArtifactId().length() > 0 ) + { + path.append( metadata.getArtifactId() ).append( '/' ); + + if ( metadata.getVersion().length() > 0 ) + { + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java new file mode 100644 index 00000000..6c3df9a0 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java @@ -0,0 +1,616 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.io.StringReader; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import junit.framework.TestCase; + +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Plugin; +import org.apache.maven.model.PluginContainer; +import org.apache.maven.model.PluginExecution; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class ModelUtilsTest + extends TestCase +{ + + public void testShouldUseMainPluginDependencyVersionOverManagedDepVersion() + { + Plugin mgtPlugin = createPlugin( "group", "artifact", "1", Collections.EMPTY_MAP ); + Dependency mgtDep = createDependency( "g", "a", "2" ); + mgtPlugin.addDependency( mgtDep ); + + Plugin plugin = createPlugin( "group", "artifact", "1", Collections.EMPTY_MAP ); + Dependency dep = createDependency( "g", "a", "1" ); + plugin.addDependency( dep ); + + ModelUtils.mergePluginDefinitions( plugin, mgtPlugin, false ); + + assertEquals( dep.getVersion(), plugin.getDependencies().get( 0 ).getVersion() ); + } + + private Dependency createDependency( String gid, + String aid, + String ver ) + { + Dependency dep = new Dependency(); + dep.setGroupId( gid ); + dep.setArtifactId( aid ); + dep.setVersion( ver ); + + return dep; + } + + public void testShouldNotInheritPluginWithInheritanceSetToFalse() + { + PluginContainer parent = new PluginContainer(); + + Plugin parentPlugin = createPlugin( "group", "artifact", "1.0", Collections.EMPTY_MAP ); + parentPlugin.setInherited( "false" ); + + parent.addPlugin( parentPlugin ); + + PluginContainer child = new PluginContainer(); + + child.addPlugin( createPlugin( "group3", "artifact3", "1.0", Collections.EMPTY_MAP ) ); + + ModelUtils.mergePluginLists( child, parent, true ); + + List results = child.getPlugins(); + + assertEquals( 1, results.size() ); + + Plugin result1 = (Plugin) results.get( 0 ); + assertEquals( "group3", result1.getGroupId() ); + assertEquals( "artifact3", result1.getArtifactId() ); + } + + /** + * Test that this is 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 void testShouldPreserveChildOrderingOfPluginsAfterParentMerge() + { + PluginContainer parent = new PluginContainer(); + + parent.addPlugin( createPlugin( "group", "artifact", "1.0", Collections.EMPTY_MAP ) ); + parent.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key", "value" ) ) ); + + PluginContainer child = new PluginContainer(); + + child.addPlugin( createPlugin( "group3", "artifact3", "1.0", Collections.EMPTY_MAP ) ); + child.addPlugin( createPlugin( "group2", "artifact2", "1.0", Collections.singletonMap( "key2", "value2" ) ) ); + + ModelUtils.mergePluginLists( child, parent, true ); + + List results = child.getPlugins(); + + assertEquals( 3, results.size() ); + + Plugin result1 = (Plugin) results.get( 0 ); + + assertEquals( "group", result1.getGroupId() ); + assertEquals( "artifact", result1.getArtifactId() ); + + Plugin result2 = (Plugin) results.get( 1 ); + + assertEquals( "group3", result2.getGroupId() ); + assertEquals( "artifact3", result2.getArtifactId() ); + + Plugin result3 = (Plugin) results.get( 2 ); + + assertEquals( "group2", result3.getGroupId() ); + assertEquals( "artifact2", result3.getArtifactId() ); + + Xpp3Dom result3Config = (Xpp3Dom) result3.getConfiguration(); + + assertNotNull( result3Config ); + + assertEquals( "value", result3Config.getChild( "key" ).getValue() ); + assertEquals( "value2", result3Config.getChild( "key2" ).getValue() ); + } + + private Plugin createPlugin( String groupId, String artifactId, String version, Map configuration ) + { + Plugin plugin = new Plugin(); + plugin.setGroupId( groupId ); + plugin.setArtifactId( artifactId ); + plugin.setVersion( version ); + + Xpp3Dom config = new Xpp3Dom( "configuration" ); + + if( configuration != null ) + { + for ( Object o : configuration.entrySet() ) + { + Map.Entry entry = (Map.Entry) o; + + Xpp3Dom param = new Xpp3Dom( String.valueOf( entry.getKey() ) ); + param.setValue( String.valueOf( entry.getValue() ) ); + + config.addChild( param ); + } + } + + plugin.setConfiguration( config ); + + return plugin; + } + + public void testShouldInheritOnePluginWithExecution() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + + PluginExecution parentExecution = new PluginExecution(); + parentExecution.setId( "testExecution" ); + + parent.addExecution( parentExecution ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + ModelUtils.mergePluginDefinitions( child, parent, false ); + + assertEquals( 1, child.getExecutions().size() ); + } + + public void testShouldMergeInheritedPluginHavingExecutionWithLocalPlugin() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + + PluginExecution parentExecution = new PluginExecution(); + parentExecution.setId( "testExecution" ); + + parent.addExecution( parentExecution ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + PluginExecution childExecution = new PluginExecution(); + childExecution.setId( "testExecution2" ); + + child.addExecution( childExecution ); + + ModelUtils.mergePluginDefinitions( child, parent, false ); + + assertEquals( 2, child.getExecutions().size() ); + } + + public void testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + + PluginExecution parentExecution = new PluginExecution(); + parentExecution.setId( "testExecution" ); + + parent.addExecution( parentExecution ); + + Build parentContainer = new Build(); + parentContainer.addPlugin( parent ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + Build childContainer = new Build(); + childContainer.addPlugin( child ); + + ModelUtils.mergePluginLists( childContainer, parentContainer, true ); + + List plugins = childContainer.getPlugins(); + + assertEquals( 1, plugins.size() ); + + Plugin plugin = (Plugin) plugins.get( 0 ); + + assertEquals( 1, plugin.getExecutions().size() ); + } + + public void testShouldMergePluginWithDifferentExecutionFromParentWithoutDuplicatingPluginInList() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + + PluginExecution parentExecution = new PluginExecution(); + parentExecution.setId( "testExecution" ); + + parent.addExecution( parentExecution ); + + Build parentContainer = new Build(); + parentContainer.addPlugin( parent ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + PluginExecution childExecution = new PluginExecution(); + childExecution.setId( "testExecution2" ); + + child.addExecution( childExecution ); + + + Build childContainer = new Build(); + childContainer.addPlugin( child ); + + ModelUtils.mergePluginLists( childContainer, parentContainer, true ); + + List plugins = childContainer.getPlugins(); + + assertEquals( 1, plugins.size() ); + + Plugin plugin = (Plugin) plugins.get( 0 ); + + assertEquals( 2, plugin.getExecutions().size() ); + } + + public void testShouldNOTMergeInheritedPluginHavingInheritEqualFalse() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + parent.setInherited( "false" ); + + PluginExecution parentExecution = new PluginExecution(); + parentExecution.setId( "testExecution" ); + + parent.addExecution( parentExecution ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + ModelUtils.mergePluginDefinitions( child, parent, true ); + + assertEquals( 0, child.getExecutions().size() ); + } + + /** + * Verifies MNG-1499: The order of the merged list should be the plugins specified by the parent followed by the + * child list. + */ + public void testShouldKeepOriginalPluginOrdering() + { + Plugin parentPlugin1 = new Plugin(); + parentPlugin1.setArtifactId( "testArtifact" ); + parentPlugin1.setGroupId( "zzz" ); // This will put this plugin last in the sorted map + parentPlugin1.setVersion( "1.0" ); + + PluginExecution parentExecution1 = new PluginExecution(); + parentExecution1.setId( "testExecution" ); + + parentPlugin1.addExecution( parentExecution1 ); + + Plugin parentPlugin2 = new Plugin(); + parentPlugin2.setArtifactId( "testArtifact" ); + parentPlugin2.setGroupId( "yyy" ); + parentPlugin2.setVersion( "1.0" ); + + PluginExecution parentExecution2 = new PluginExecution(); + parentExecution2.setId( "testExecution" ); + + parentPlugin2.addExecution( parentExecution2 ); + + PluginContainer parentContainer = new PluginContainer(); + parentContainer.addPlugin(parentPlugin1); + parentContainer.addPlugin(parentPlugin2); + + + Plugin childPlugin1 = new Plugin(); + childPlugin1.setArtifactId( "testArtifact" ); + childPlugin1.setGroupId( "bbb" ); + childPlugin1.setVersion( "1.0" ); + + PluginExecution childExecution1 = new PluginExecution(); + childExecution1.setId( "testExecution" ); + + childPlugin1.addExecution( childExecution1 ); + + Plugin childPlugin2 = new Plugin(); + childPlugin2.setArtifactId( "testArtifact" ); + childPlugin2.setGroupId( "aaa" ); + childPlugin2.setVersion( "1.0" ); + + PluginExecution childExecution2 = new PluginExecution(); + childExecution2.setId( "testExecution" ); + + childPlugin2.addExecution( childExecution2 ); + + PluginContainer childContainer = new PluginContainer(); + childContainer.addPlugin(childPlugin1); + childContainer.addPlugin(childPlugin2); + + + ModelUtils.mergePluginLists(childContainer, parentContainer, true); + + assertEquals( 4, childContainer.getPlugins().size() ); + assertSame(parentPlugin1, childContainer.getPlugins().get(0)); + assertSame(parentPlugin2, childContainer.getPlugins().get(1)); + assertSame(childPlugin1, childContainer.getPlugins().get(2)); + assertSame(childPlugin2, childContainer.getPlugins().get(3)); + } + + /** + * Verifies MNG-1499: The ordering of plugin executions should also be in the specified order. + */ + public void testShouldKeepOriginalPluginExecutionOrdering() + { + Plugin parent = new Plugin(); + parent.setArtifactId( "testArtifact" ); + parent.setGroupId( "testGroup" ); + parent.setVersion( "1.0" ); + + PluginExecution parentExecution1 = new PluginExecution(); + parentExecution1.setId( "zzz" ); // Will show up last in the sorted map + PluginExecution parentExecution2 = new PluginExecution(); + parentExecution2.setId( "yyy" ); // Will show up last in the sorted map + + parent.addExecution( parentExecution1 ); + parent.addExecution( parentExecution2 ); + + // this block verifies MNG-1703 + Dependency dep = new Dependency(); + dep.setGroupId( "depGroupId" ); + dep.setArtifactId( "depArtifactId" ); + dep.setVersion( "depVersion" ); + parent.setDependencies( Collections.singletonList( dep ) ); + + Plugin child = new Plugin(); + child.setArtifactId( "testArtifact" ); + child.setGroupId( "testGroup" ); + child.setVersion( "1.0" ); + + PluginExecution childExecution1 = new PluginExecution(); + childExecution1.setId( "bbb" ); + PluginExecution childExecution2 = new PluginExecution(); + childExecution2.setId( "aaa" ); + + child.addExecution( childExecution1 ); + child.addExecution( childExecution2 ); + + ModelUtils.mergePluginDefinitions( child, parent, false ); + + assertEquals( 4, child.getExecutions().size() ); + assertSame(parentExecution1, child.getExecutions().get(0)); + assertSame(parentExecution2, child.getExecutions().get(1)); + assertSame(childExecution1, child.getExecutions().get(2)); + assertSame(childExecution2, child.getExecutions().get(3)); + + // this block prevents MNG-1703 + assertEquals( 1, child.getDependencies().size() ); + Dependency dep2 = child.getDependencies().get( 0 ); + assertEquals( dep.getManagementKey(), dep2.getManagementKey() ); + } + + public void testShouldOverwritePluginConfigurationSubItemsByDefault() + throws XmlPullParserException, IOException + { + String parentConfigStr = "onetwo"; + Xpp3Dom parentConfig = Xpp3DomBuilder.build( new StringReader( parentConfigStr ) ); + + Plugin parentPlugin = createPlugin( "group", "artifact", "1", null ); + parentPlugin.setConfiguration( parentConfig ); + + String childConfigStr = "three"; + Xpp3Dom childConfig = Xpp3DomBuilder.build( new StringReader( childConfigStr ) ); + + Plugin childPlugin = createPlugin( "group", "artifact", "1", null ); + childPlugin.setConfiguration( childConfig ); + + ModelUtils.mergePluginDefinitions( childPlugin, parentPlugin, true ); + + Xpp3Dom result = (Xpp3Dom) childPlugin.getConfiguration(); + Xpp3Dom items = result.getChild( "items" ); + + assertEquals( 1, items.getChildCount() ); + + Xpp3Dom item = items.getChild( 0 ); + assertEquals( "three", item.getValue() ); + } + + public void testShouldMergePluginConfigurationSubItemsWithMergeAttributeSet() + throws XmlPullParserException, IOException + { + String parentConfigStr = "onetwo"; + Xpp3Dom parentConfig = Xpp3DomBuilder.build( new StringReader( parentConfigStr ) ); + + Plugin parentPlugin = createPlugin( "group", "artifact", "1", null ); + parentPlugin.setConfiguration( parentConfig ); + + String childConfigStr = "three"; + Xpp3Dom childConfig = Xpp3DomBuilder.build( new StringReader( childConfigStr ) ); + + Plugin childPlugin = createPlugin( "group", "artifact", "1", null ); + childPlugin.setConfiguration( childConfig ); + + ModelUtils.mergePluginDefinitions( childPlugin, parentPlugin, true ); + + Xpp3Dom result = (Xpp3Dom) childPlugin.getConfiguration(); + Xpp3Dom items = result.getChild( "items" ); + + assertEquals( 3, items.getChildCount() ); + + Xpp3Dom[] item = items.getChildren(); + + List actual = Arrays.asList( item[0].getValue(), item[1].getValue(), item[2].getValue() ); + List expected = Arrays.asList( "one", "two", "three" ); + Collections.sort( actual ); + Collections.sort( expected ); + assertEquals( expected, actual ); + } + + public void testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue() + { + String gid = "group"; + String aid = "artifact"; + String ver = "1"; + + PluginContainer parent = new PluginContainer(); + Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + + pParent.setInherited( Boolean.toString( true ) ); + + PluginExecution eParent = new PluginExecution(); + + String testId = "test"; + + eParent.setId( testId ); + eParent.addGoal( "run" ); + eParent.setPhase( "initialize" ); + eParent.setInherited( Boolean.toString( false ) ); + + pParent.addExecution( eParent ); + parent.addPlugin( pParent ); + + PluginContainer child = new PluginContainer(); + Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + PluginExecution eChild = new PluginExecution(); + + eChild.setId( "child-specified" ); + eChild.addGoal( "child" ); + eChild.setPhase( "compile" ); + + pChild.addExecution( eChild ); + child.addPlugin( pChild ); + + ModelUtils.mergePluginDefinitions( pChild, pParent, true ); + + Map executionMap = pChild.getExecutionsAsMap(); + assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) ); + } + + public void testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue() + { + String gid = "group"; + String aid = "artifact"; + String ver = "1"; + + PluginContainer parent = new PluginContainer(); + Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + + pParent.setInherited( Boolean.toString( false ) ); + + PluginExecution eParent = new PluginExecution(); + + String testId = "test"; + + eParent.setId( testId ); + eParent.addGoal( "run" ); + eParent.setPhase( "initialize" ); + eParent.setInherited( Boolean.toString( true ) ); + + pParent.addExecution( eParent ); + parent.addPlugin( pParent ); + + PluginContainer child = new PluginContainer(); + Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + PluginExecution eChild = new PluginExecution(); + + eChild.setId( "child-specified" ); + eChild.addGoal( "child" ); + eChild.setPhase( "compile" ); + + pChild.addExecution( eChild ); + child.addPlugin( pChild ); + + ModelUtils.mergePluginDefinitions( pChild, pParent, true ); + + Map executionMap = pChild.getExecutionsAsMap(); + assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) ); + } + + public void testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue() + { + String gid = "group"; + String aid = "artifact"; + String ver = "1"; + + PluginContainer parent = new PluginContainer(); + Plugin pParent = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + + pParent.setInherited( Boolean.toString( true ) ); + + PluginExecution eParent = new PluginExecution(); + + String testId = "test"; + + eParent.setId( testId ); + eParent.addGoal( "run" ); + eParent.setPhase( "initialize" ); + eParent.setInherited( Boolean.toString( true ) ); + + pParent.addExecution( eParent ); + parent.addPlugin( pParent ); + + PluginContainer child = new PluginContainer(); + Plugin pChild = createPlugin( gid, aid, ver, Collections.EMPTY_MAP ); + PluginExecution eChild = new PluginExecution(); + + eChild.setId( "child-specified" ); + eChild.addGoal( "child" ); + eChild.setPhase( "compile" ); + + pChild.addExecution( eChild ); + child.addPlugin( pChild ); + + ModelUtils.mergePluginDefinitions( pChild, pParent, true ); + + Map executionMap = pChild.getExecutionsAsMap(); + assertNotNull( "test execution should be inherited from parent.", executionMap.get( testId ) ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java new file mode 100644 index 00000000..d9e7beb2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java @@ -0,0 +1,149 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader; +import org.eclipse.aether.impl.ArtifactDescriptorReader; +import org.eclipse.aether.impl.ArtifactResolver; + +public class ProjectClasspathTest + extends AbstractMavenProjectTestCase +{ + static final String dir = "projects/scope/"; + + public void setUp() + throws Exception + { + ArtifactResolver resolver = lookup( ArtifactResolver.class, "classpath" ); + DefaultArtifactDescriptorReader pomReader = (DefaultArtifactDescriptorReader)lookup(ArtifactDescriptorReader.class); + pomReader.setArtifactResolver( resolver ); + + projectBuilder = lookup( ProjectBuilder.class, "classpath" ); + + // the metadata source looks up the default impl, so we have to trick it + getContainer().addComponent( projectBuilder, ProjectBuilder.class, "default" ); + + repositorySystem = lookup( RepositorySystem.class ); + } + + @Override + protected String getCustomConfigurationName() + { + return null; + } + + public void testProjectClasspath() + throws Exception + { + File f = getFileForClasspathResource( dir + "project-with-scoped-dependencies.xml" ); + + MavenProject project = getProjectWithDependencies( f ); + + Artifact artifact; + + assertNotNull( "Test project can't be null!", project ); + + 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( "Check no provided dependencies are transitive", artifact ); + artifact = getArtifact( project, "maven-test-test", "scope-test" ); + assertNull( "Check no test dependencies are transitive", artifact ); + + artifact = getArtifact( project, "maven-test-test", "scope-compile" ); + assertNotNull( artifact ); + + System.out.println( "a = " + artifact ); + System.out.println( "b = " + artifact.getScope() ); + assertEquals( "Check scope", "test", artifact.getScope() ); + artifact = getArtifact( project, "maven-test-test", "scope-default" ); + assertEquals( "Check scope", "test", artifact.getScope() ); + artifact = getArtifact( project, "maven-test-test", "scope-runtime" ); + assertEquals( "Check scope", "test", artifact.getScope() ); + + // 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( "Check scope", "provided", artifact.getScope() ); + + // 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( "Check scope", "runtime", artifact.getScope() ); + + // 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( "Check scope", "runtime", artifact.getScope() ); + + // 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( "Check scope", "runtime", artifact.getScope() ); + } + + private void checkGroupIdScope( MavenProject project, String scopeValue, String groupId ) + { + Artifact artifact; + artifact = getArtifact( project, groupId, "scope-compile" ); + assertEquals( "Check scope", scopeValue, artifact.getScope() ); + artifact = getArtifact( project, groupId, "scope-test" ); + assertNull( "Check test dependency is not transitive", artifact ); + artifact = getArtifact( project, groupId, "scope-provided" ); + assertNull( "Check provided dependency is not transitive", artifact ); + artifact = getArtifact( project, groupId, "scope-default" ); + assertEquals( "Check scope", scopeValue, artifact.getScope() ); + } + + private void checkArtifactIdScope( MavenProject project, String scope, String scopeValue ) + { + String artifactId = "scope-" + scope; + Artifact artifact = getArtifact( project, "maven-test", artifactId ); + assertNotNull( artifact ); + assertEquals( "Check scope", scopeValue, artifact.getScope() ); + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java new file mode 100644 index 00000000..9f389d6d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestArtifactResolver.java @@ -0,0 +1,30 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.DefaultArtifactResolver; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +@Component(role=ArtifactResolver.class,hint="classpath") +public class TestArtifactResolver + extends DefaultArtifactResolver +{ + @Requirement(hint="classpath") + private ArtifactMetadataSource source; +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java new file mode 100644 index 00000000..2818df06 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestMavenRepositorySystem.java @@ -0,0 +1,30 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.repository.legacy.LegacyRepositorySystem; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +@Component(role = RepositorySystem.class, hint = "classpath") +public class TestMavenRepositorySystem + extends LegacyRepositorySystem +{ + @Requirement(hint="classpath") + private ArtifactResolver artifactResolver; +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java new file mode 100644 index 00000000..754487f4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/TestProjectBuilder.java @@ -0,0 +1,68 @@ +package org.apache.maven.project; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Collections; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.codehaus.plexus.component.annotations.Component; + +@Component(role=ProjectBuilder.class,hint="classpath") +public class TestProjectBuilder + extends DefaultProjectBuilder +{ + + @Override + public ProjectBuildingResult build( Artifact artifact, ProjectBuildingRequest request ) + throws ProjectBuildingException + { + if ( "maven-test".equals( artifact.getGroupId() ) ) + { + String scope = artifact.getArtifactId().substring( "scope-".length() ); + + try + { + artifact.setFile( ProjectClasspathTest.getFileForClasspathResource( ProjectClasspathTest.dir + "transitive-" + scope + "-dep.xml" ) ); + } + catch ( FileNotFoundException e ) + { + throw new IllegalStateException( "Missing test POM for " + artifact ); + } + } + if ( artifact.getFile() == null ) + { + MavenProject project = new MavenProject(); + project.setArtifact( artifact ); + return new DefaultProjectBuildingResult( project, null, null ); + } + return build( artifact.getFile(), request ); + } + + @Override + public ProjectBuildingResult build( File pomFile, ProjectBuildingRequest configuration ) + throws ProjectBuildingException + { + ProjectBuildingResult result = super.build( pomFile, configuration ); + + result.getProject().setRemoteArtifactRepositories( Collections. emptyList() ); + + return result; + } + +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java new file mode 100644 index 00000000..413d6fea --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/AbstractProjectInheritanceTestCase.java @@ -0,0 +1,57 @@ +package org.apache.maven.project.inheritance; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.project.AbstractMavenProjectTestCase; + +/** + * @author Jason van Zyl + */ +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() ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java new file mode 100644 index 00000000..0ee79807 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java @@ -0,0 +1,93 @@ +package org.apache.maven.project.inheritance.t00; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.model.MailingList; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's recursive inheritance where + * a distinct value is taken from each parent contributing to the + * 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. + * + * @author Jason van Zyl + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p4 inherits from p3 + // p3 inherits from p2 + // p2 inherits from p1 + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java new file mode 100644 index 00000000..e6efcc4d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java @@ -0,0 +1,92 @@ +package org.apache.maven.project.inheritance.t01; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * 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. + * + * @author Jason van Zyl + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p4 inherits from p3 + // p3 inherits from p2 + // p2 inherits from p1 + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java new file mode 100644 index 00000000..339c81ff --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java @@ -0,0 +1,169 @@ +package org.apache.maven.project.inheritance.t02; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.maven.model.Build; +import org.apache.maven.model.MailingList; +import org.apache.maven.model.Plugin; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's recursive inheritance where + * a distinct value is taken from each parent contributing to the + * 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. + * + * @author Jason van Zyl + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p4 inherits from p3 + // p3 inherits from p2 + // p2 inherits from p1 + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p4 ---> p3 ---> p2 ---> p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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(); + + if ( !validPluginCounts.containsKey( pluginArtifactId ) ) + { + fail( "Illegal plugin found: " + pluginArtifactId ); + } + else + { + if ( pluginArtifactId.equals( testPluginArtifactId ) ) + { + testPlugin = plugin; + } + + Integer count = (Integer) validPluginCounts.get( pluginArtifactId ); + + if ( count > 0 ) + { + fail( "Multiple copies of plugin: " + pluginArtifactId + " found in POM." ); + } + else + { + count = count + 1; + + validPluginCounts.put( pluginArtifactId, count ); + } + } + } + + List executions = testPlugin.getExecutions(); + + assertEquals( 1, executions.size() ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java new file mode 100644 index 00000000..73f518e4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java @@ -0,0 +1,68 @@ +package org.apache.maven.project.inheritance.t03; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's recursive inheritance where + * a distinct value is taken from each parent contributing to the + * 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. + * + * @author Jason van Zyl + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java new file mode 100644 index 00000000..e24262f1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java @@ -0,0 +1,86 @@ +package org.apache.maven.project.inheritance.t04; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies the version of a dependency listed in a parent's + * dependencyManagement section is chosen over another version of the same + * dependency, listed transitively. + * + * @author Patrick Schneider + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis 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. + // + // ---------------------------------------------------------------------- + + public 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( "No artifacts", set ); + assertTrue( "No Artifacts", set.size() > 0 ); + assertTrue( "Set size should be 3, is " + set.size(), set.size() == 3 ); + + for ( Object aSet : set ) + { + Artifact artifact = (Artifact) aSet; + System.out.println( + "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Optional=" + ( + artifact.isOptional() + ? "true" + : "false" ) ); + assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), + artifact.getVersion().equals( "1.0" ) ); + } + + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java new file mode 100644 index 00000000..1d2bd182 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java @@ -0,0 +1,79 @@ +package org.apache.maven.project.inheritance.t05; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's dependency management + * + * @author Ralph Goers + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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( "No artifacts", set ); + assertTrue( "No Artifacts", set.size() > 0 ); + + for ( Object aSet : set ) + { + Artifact artifact = (Artifact) aSet; + System.out.println( + "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + " Scope: " + + artifact.getScope() ); + assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), + artifact.getVersion().equals( "1.0" ) ); + } + + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java new file mode 100644 index 00000000..1b80dfeb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java @@ -0,0 +1,80 @@ +package org.apache.maven.project.inheritance.t06; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's dependency management + * + * @author Ralph Goers + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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( "No artifacts", set ); + assertTrue( "No Artifacts", set.size() > 0 ); + Iterator iter = set.iterator(); + assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4 ); + + while ( iter.hasNext() ) + { + Artifact artifact = (Artifact) iter.next(); + System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) ); + assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), + artifact.getVersion().equals( "1.0" ) ); + } + + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java new file mode 100644 index 00000000..68586aaf --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java @@ -0,0 +1,82 @@ +package org.apache.maven.project.inheritance.t07; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's dependency management + * + * @author Jason van Zyl + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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("No artifacts", set); + assertTrue("No Artifacts", set.size() > 0); + assertTrue("Set size should be 3, is " + set.size(), set.size() == 3 ); + + 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( "Incorrect version for " + artifact.getDependencyConflictId(), + artifact.getVersion().equals( "1.0" ) ); + } + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java new file mode 100644 index 00000000..1afb8e8e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java @@ -0,0 +1,81 @@ +package org.apache.maven.project.inheritance.t08; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Iterator; +import java.util.Set; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * A test which demonstrates maven's dependency management + * + * @author Ralph Goers + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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( "No artifacts", set ); + assertTrue( "No Artifacts", set.size() > 0 ); + Iterator iter = set.iterator(); + assertTrue( "Set size should be 4, is " + set.size(), set.size() == 4 ); + + while ( iter.hasNext() ) + { + Artifact artifact = (Artifact) iter.next(); + System.out.println( "Artifact: " + artifact.getDependencyConflictId() + " " + artifact.getVersion() + + " Optional=" + ( artifact.isOptional() ? "true" : "false" ) ); + assertTrue( "Incorrect version for " + artifact.getDependencyConflictId(), + artifact.getVersion().equals( "1.0" ) ); + } + + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java new file mode 100644 index 00000000..6a29b732 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java @@ -0,0 +1,119 @@ +package org.apache.maven.project.inheritance.t09; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import java.io.File; +import java.util.Map; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies exclusions listed in dependencyManagement are valid for + * transitive dependencies. + * + * @author Patrick Schneider + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis 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. + */ + public 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("Parent is null", project1.getParent()); + assertEquals( pom0Basedir, project1.getParent().getBasedir() ); + Map map = project1.getArtifactMap(); + + assertNotNull("No artifacts", map); + assertTrue("No Artifacts", map.size() > 0); + assertTrue("Set size should be 2, is " + map.size(), map.size() == 2); + + assertTrue("maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" )); + assertTrue("maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" )); + assertFalse("maven-test:t09-c is in the project", map.containsKey( "maven-test:t09-c" )); + } + + /** + * 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 + */ + public 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( "No artifacts", map ); + assertTrue( "No Artifacts", map.size() > 0 ); + assertTrue( "Set size should be 4, is " + map.size(), map.size() == 4 ); + + assertTrue( "maven-test:t09-a is not in the project", map.containsKey( "maven-test:t09-a" ) ); + assertTrue( "maven-test:t09-b is not in the project", map.containsKey( "maven-test:t09-b" ) ); + assertTrue( "maven-test:t09-c is not in the project", map.containsKey( "maven-test:t09-c" ) ); + assertTrue( "maven-test:t09-d is not in the project", map.containsKey( "maven-test:t09-d" ) ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java new file mode 100644 index 00000000..9e5137f2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java @@ -0,0 +1,94 @@ +package org.apache.maven.project.inheritance.t10; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Map; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies scope inheritence 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. + * + * @author Patrick Schneider + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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("No artifacts", map); + assertTrue("No Artifacts", map.size() > 0); + assertTrue("Set size should be 3, is " + map.size(), map.size() == 3); + + 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("Incorrect scope for " + a.getDependencyConflictId(), a.getScope().equals("test")); + + // transitive dep, overridden b depMgmt + assertTrue("Incorrect scope for " + b.getDependencyConflictId(), b.getScope().equals("runtime")); + + // direct dep, overrides depMgmt + assertTrue("Incorrect scope for " + c.getDependencyConflictId(), c.getScope().equals("runtime")); + + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java new file mode 100644 index 00000000..bbdecd7a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java @@ -0,0 +1,64 @@ +package org.apache.maven.project.inheritance.t11; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies scope of root project is preserved regardless of parent depenedency management. + * + * @author Patrick Schneider + * @see MNG-2919 + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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( "dependencyManagement has overwritten the scope of the currently building child project", + project1.getArtifact().getScope() ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java new file mode 100644 index 00000000..814e4871 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java @@ -0,0 +1,65 @@ +package org.apache.maven.project.inheritance.t12; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.util.Map; + +import org.apache.maven.model.Plugin; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies that plugin execution sections in the parent POM that have + * inherit == false are not inherited to the child POM. + */ +public class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inherits from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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( "Plugin execution: \'test\' should NOT exist in the compiler plugin specification for the child project!", executionMap.get( "test" ) ); + } +} \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java new file mode 100644 index 00000000..3b086624 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java @@ -0,0 +1,125 @@ +package org.apache.maven.project.inheritance.t12scm; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase; + +/** + * Verifies SCM inheritance uses modules statement from parent. + * + * @author jdcasey + */ +public class ProjectInheritanceTest + extends AbstractProjectInheritanceTestCase +{ + // ---------------------------------------------------------------------- + // + // p1 inherits from p0 + // p0 inhertis from super model + // + // or we can show it graphically as: + // + // p1 ---> p0 --> super model + // + // ---------------------------------------------------------------------- + + public 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" ); + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java new file mode 100644 index 00000000..b19ef996 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java @@ -0,0 +1,58 @@ +package org.apache.maven.project.path; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import junit.framework.TestCase; + +@SuppressWarnings( "deprecation" ) +public class DefaultPathTranslatorTest + extends TestCase +{ + + public void testAlignToBasedirWhereBasedirExpressionIsTheCompleteValue() + { + File basedir = new File( System.getProperty( "java.io.tmpdir" ), "test" ).getAbsoluteFile(); + + String aligned = new DefaultPathTranslator().alignToBaseDirectory( "${basedir}", basedir ); + + assertEquals( basedir.getAbsolutePath(), aligned ); + } + + public 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 ); + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java new file mode 100644 index 00000000..fb32f0f2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/DefaultMirrorSelectorTest.java @@ -0,0 +1,38 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.DefaultArtifactRepository; +import org.codehaus.plexus.PlexusTestCase; + +public class DefaultMirrorSelectorTest + extends PlexusTestCase +{ + + public void testMirrorWithMirroOfPatternContainingANegationIsNotSelected() + { + ArtifactRepository repository = new DefaultArtifactRepository( "snapshots.repo", "http://whatever", null ); + String pattern = "external:*, !snapshots.repo"; + boolean matches = DefaultMirrorSelector.matchPattern( repository, pattern ); + System.out.println( matches ); + assertFalse( matches ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java new file mode 100644 index 00000000..77a6baef --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositoryLayout.java @@ -0,0 +1,89 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.codehaus.plexus.component.annotations.Component; + +/** + * @author jdcasey + */ +@Component(role=ArtifactRepositoryLayout.class, hint="legacy") +public class LegacyRepositoryLayout + implements ArtifactRepositoryLayout +{ + private static final String PATH_SEPARATOR = "/"; + + public String getId() + { + return "legacy"; + } + + public String pathOf( Artifact artifact ) + { + ArtifactHandler artifactHandler = artifact.getArtifactHandler(); + + StringBuilder path = new StringBuilder( 128 ); + + path.append( artifact.getGroupId() ).append( '/' ); + path.append( artifactHandler.getDirectory() ).append( '/' ); + path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() ); + + if ( artifact.hasClassifier() ) + { + path.append( '-' ).append( artifact.getClassifier() ); + } + + if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) + { + path.append( '.' ).append( artifactHandler.getExtension() ); + } + + return path.toString(); + } + + public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, + ArtifactRepository repository ) + { + return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) ); + } + + private String pathOfRepositoryMetadata( ArtifactMetadata metadata, + String filename ) + { + StringBuilder path = new StringBuilder( 128 ); + + path.append( metadata.getGroupId() ).append( PATH_SEPARATOR ).append( "poms" ).append( PATH_SEPARATOR ); + + path.append( filename ); + + return path.toString(); + } + + public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata ) + { + return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java new file mode 100644 index 00000000..96af590c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java @@ -0,0 +1,206 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +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.model.Dependency; +import org.apache.maven.model.Repository; +import org.apache.maven.model.RepositoryPolicy; +import org.apache.maven.plugin.LegacySupport; +import org.apache.maven.repository.RepositorySystem; +import org.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusTestCase; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; + +/** + * Tests {@link LegacyRepositorySystem}. + * + * @author Benjamin Bentmann + */ +public class LegacyRepositorySystemTest + extends PlexusTestCase +{ + private RepositorySystem repositorySystem; + + private ResolutionErrorHandler resolutionErrorHandler; + + @Override + protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) + { + super.customizeContainerConfiguration( containerConfiguration ); + containerConfiguration.setAutoWiring( true ); + containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); + } + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + repositorySystem = lookup( RepositorySystem.class, "default" ); + resolutionErrorHandler = lookup( ResolutionErrorHandler.class ); + } + + @Override + protected void tearDown() + throws Exception + { + repositorySystem = null; + resolutionErrorHandler = null; + super.tearDown(); + } + + 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 ); + } + + public 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 = lookup( LegacySupport.class ); + legacySupport.setSession( new MavenSession( getContainer(), session, new DefaultMavenExecutionRequest(), + new DefaultMavenExecutionResult() ) ); + + 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() ); + } + } + + public 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 ); + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java new file mode 100644 index 00000000..57645750 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java @@ -0,0 +1,259 @@ +package org.apache.maven.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Arrays; +import java.util.List; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.settings.Mirror; +import org.codehaus.plexus.PlexusTestCase; + +public class MirrorProcessorTest + extends PlexusTestCase +{ + private DefaultMirrorSelector mirrorSelector; + private ArtifactRepositoryFactory repositorySystem; + + protected void setUp() + throws Exception + { + mirrorSelector = (DefaultMirrorSelector) lookup( MirrorSelector.class ); + repositorySystem = lookup( ArtifactRepositoryFactory.class ); + } + + @Override + protected void tearDown() + throws Exception + { + mirrorSelector = null; + repositorySystem = null; + + super.tearDown(); + } + + public 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", "" ) ) ); + } + + public 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 ) ); + } + + public 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 ) ); + } + + public 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 ) ); + } + + public 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*" ) ); + } + + public 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:*" ) ); + } + + public 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,*" ) ); + } + + public 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java new file mode 100644 index 00000000..1c5f34c3 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java @@ -0,0 +1,240 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; + +import org.apache.maven.artifact.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.apache.maven.repository.legacy.DefaultUpdateCheckManager; +import org.codehaus.plexus.logging.Logger; +import org.codehaus.plexus.logging.console.ConsoleLogger; + +public class DefaultUpdateCheckManagerTest + extends AbstractArtifactComponentTestCase +{ + + DefaultUpdateCheckManager updateCheckManager; + + @Override + protected String component() + { + return "updateCheckManager"; + } + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + updateCheckManager = new DefaultUpdateCheckManager( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) ); + } + + public 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() ); + } + + public 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 ) ) ); + } + + public 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() ); + } + + public 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 ) ) ); + } + + public 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 ) ) ); + } + + public 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 ) ) ); + } + + public void testArtifactTouchFileName() throws Exception + { + ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + + ArtifactRepository localRepository = localRepository(); + + Artifact a = artifactFactory.createArtifactWithClassifier( "groupdId", "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( "groupdId", "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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java new file mode 100644 index 00000000..068c0e0a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java @@ -0,0 +1,422 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.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.repository.legacy.repository.ArtifactRepositoryFactory; +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.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.authorization.AuthorizationException; +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.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +/** + * @author Michal Maczka + */ +public class DefaultWagonManagerTest + extends PlexusTestCase +{ + private DefaultWagonManager wagonManager; + + private TransferListener transferListener = new Debug(); + + private ArtifactFactory artifactFactory; + + private ArtifactRepositoryFactory artifactRepositoryFactory; + + protected void setUp() + throws Exception + { + super.setUp(); + wagonManager = (DefaultWagonManager) lookup( WagonManager.class ); + artifactFactory = lookup( ArtifactFactory.class ); + artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class ); + } + + @Override + protected void tearDown() + throws Exception + { + wagonManager = null; + artifactFactory = null; + super.tearDown(); + } + + public 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( 1 ).getLayout().pathOf( artifact ), "expected" ); + + 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() ); + } + + public void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolException, IOException + { + Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" ); + + ArtifactRepository repo = createStringRepo(); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + + fail(); + } + catch ( ResourceDoesNotExistException e ) + { + assertTrue( true ); + } + + assertFalse( artifact.getFile().exists() ); + } + + public void testGetMissingJarForced() throws TransferFailedException, UnsupportedProtocolException, IOException + { + Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" ); + + ArtifactRepository repo = createStringRepo(); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + + fail(); + } + catch ( ResourceDoesNotExistException e ) + { + assertTrue( true ); + } + + assertFalse( artifact.getFile().exists() ); + } + + public void testGetRemoteJar() + throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException, + AuthorizationException + { + 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" ); + + 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" ); + } + + public void testDefaultWagonManager() + throws Exception + { + assertWagon( "a" ); + + assertWagon( "b" ); + + assertWagon( "c" ); + + assertWagon( "string" ); + + try + { + assertWagon( "d" ); + + fail( "Expected :" + UnsupportedProtocolException.class.getName() ); + } + catch ( UnsupportedProtocolException e ) + { + // ok + assertTrue( true ); + } + } + + /** + * Check that transfer listeners are properly removed after getArtifact and putArtifact + */ + public 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" ); + + /* getArtifact */ + assertFalse( "Transfer listener is registered before test", + wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + wagonManager.getArtifact( artifact, repo, transferListener, false ); + assertFalse( "Transfer listener still registered after getArtifact", + wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + + /* putArtifact */ + File sampleFile = getTestFile( "target/test-file" ); + FileUtils.fileWrite( sampleFile.getAbsolutePath(), "sample file" ); + + assertFalse( "Transfer listener is registered before test", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + wagonManager.putArtifact( sampleFile, artifact, repo, transferListener ); + assertFalse( "Transfer listener still registered after putArtifact", wagon.getTransferEventSupport().hasTransferListener( transferListener ) ); + } + + /** + * Checks the verification of checksums. + */ + public void xtestChecksumVerification() + 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" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + } + catch ( ChecksumFailedException e ) + { + fail( "Checksum verification did not pass: " + e.getMessage() ); + } + + wagon.clearExpectedContent(); + wagon.addExpectedContent( "path", "upper-case-checksum" ); + wagon.addExpectedContent( "path.sha1", "B7BB97D7D0B9244398D9B47296907F73313663E6" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + } + catch ( ChecksumFailedException e ) + { + fail( "Checksum verification did not pass: " + e.getMessage() ); + } + + wagon.clearExpectedContent(); + wagon.addExpectedContent( "path", "expected-failure" ); + wagon.addExpectedContent( "path.sha1", "b7bb97d7d0b9244398d9b47296907f73313663e6" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + fail( "Checksum verification did not fail" ); + } + catch ( ChecksumFailedException e ) + { + // expected + } + + wagon.clearExpectedContent(); + wagon.addExpectedContent( "path", "lower-case-checksum" ); + wagon.addExpectedContent( "path.md5", "50b2cf50a103a965efac62b983035cac" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + } + catch ( ChecksumFailedException e ) + { + fail( "Checksum verification did not pass: " + e.getMessage() ); + } + + wagon.clearExpectedContent(); + wagon.addExpectedContent( "path", "upper-case-checksum" ); + wagon.addExpectedContent( "path.md5", "842F568FCCFEB7E534DC72133D42FFDC" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + } + catch ( ChecksumFailedException e ) + { + fail( "Checksum verification did not pass: " + e.getMessage() ); + } + + wagon.clearExpectedContent(); + wagon.addExpectedContent( "path", "expected-failure" ); + wagon.addExpectedContent( "path.md5", "b7bb97d7d0b9244398d9b47296907f73313663e6" ); + + try + { + wagonManager.getArtifact( artifact, repo, null, false ); + fail( "Checksum verification did not fail" ); + } + catch ( ChecksumFailedException e ) + { + // expected + } + } + + public 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( "Check wagon, protocol=" + protocol, wagon ); + } + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java new file mode 100644 index 00000000..f34c05fb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java @@ -0,0 +1,88 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.io.File; +import java.util.Arrays; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.Authentication; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.settings.Server; +import org.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusTestCase; + +/** + * Tests {@link LegacyRepositorySystem}. + * + * @author Benjamin Bentmann + */ +public class LegacyRepositorySystemTest + extends PlexusTestCase +{ + private RepositorySystem repositorySystem; + + @Override + protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration ) + { + super.customizeContainerConfiguration( containerConfiguration ); + containerConfiguration.setAutoWiring( true ); + containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); + } + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + repositorySystem = lookup( RepositorySystem.class, "default" ); + } + + @Override + protected void tearDown() + throws Exception + { + repositorySystem = null; + super.tearDown(); + } + + public void testThatLocalRepositoryWithSpacesIsProperlyHandled() + throws Exception + { + File basedir = new File( "target/spacy path" ).getAbsoluteFile(); + ArtifactRepository repo = repositorySystem.createLocalRepository( basedir ); + assertEquals( basedir, new File( repo.getBasedir() ) ); + } + + public void testAuthenticationHandling() + throws Exception + { + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java new file mode 100644 index 00000000..051f3e46 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/PerLookupWagon.java @@ -0,0 +1,38 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + +/** + * Wagon with per-lookup instantiation strategy. + */ +@Component( role = Wagon.class, hint = "perlookup", instantiationStrategy = "per-lookup" ) +public class PerLookupWagon + extends WagonMock +{ + + public String[] getSupportedProtocols() + { + return new String[] { "perlookup" }; + } + +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java new file mode 100644 index 00000000..d0325db4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/StringWagon.java @@ -0,0 +1,107 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.UnsupportedEncodingException; +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.Wagon; +import org.apache.maven.wagon.authentication.AuthenticationException; +import org.apache.maven.wagon.authorization.AuthorizationException; +import org.apache.maven.wagon.resource.Resource; +import org.codehaus.plexus.component.annotations.Component; + +@Component(role=Wagon.class,hint="string") +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() ); + + try + { + inputData.setInputStream( new ByteArrayInputStream( content.getBytes( "UTF-8" ) ) ); + } + catch ( UnsupportedEncodingException e ) + { + throw new Error( "broken JVM", e ); + } + } + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java new file mode 100644 index 00000000..601eefac --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonA.java @@ -0,0 +1,39 @@ +package org.apache.maven.repository.legacy; + +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Wagon for testing, for protocol a + * + * @author Carlos Sanchez + * @author Jason van Zyl + */ +@Component(role=Wagon.class,hint="a") +public class WagonA + extends WagonMock +{ + public String[] getSupportedProtocols() + { + return new String[]{ "a" }; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java new file mode 100644 index 00000000..ecaef642 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonB.java @@ -0,0 +1,39 @@ +package org.apache.maven.repository.legacy; + +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Wagon for testing, for protocols b1 and b2 + * + * @author Carlos Sanchez + * @author Jason van Zyl + */ +@Component(role=Wagon.class,hint="b") +public class WagonB + extends WagonMock +{ + public String[] getSupportedProtocols() + { + return new String[]{ "b1", "b2" }; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java new file mode 100644 index 00000000..29316ed5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonC.java @@ -0,0 +1,39 @@ +package org.apache.maven.repository.legacy; + +import org.apache.maven.wagon.Wagon; +import org.codehaus.plexus.component.annotations.Component; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Wagon for testing, for protocol c + * + * @author Carlos Sanchez + * @author Jason van Zyl + */ +@Component(role=Wagon.class,hint="c") +public class WagonC + extends WagonMock +{ + public String[] getSupportedProtocols() + { + return new String[]{ "c" }; + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java new file mode 100644 index 00000000..c5163609 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/WagonMock.java @@ -0,0 +1,50 @@ +package org.apache.maven.repository.legacy; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.wagon.providers.file.FileWagon; + +/** + * Mock of a Wagon for testing + * + * @author Carlos Sanchez + */ +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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java new file mode 100644 index 00000000..58dd3fa2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java @@ -0,0 +1,984 @@ +package org.apache.maven.repository.legacy.resolver; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +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.PlexusTestCase; + +/** + * Test the default artifact collector. + * + * @author Brett Porter + */ +public class DefaultArtifactCollectorTest + extends PlexusTestCase +{ + private LegacyArtifactCollector artifactCollector; + + private ArtifactFactory artifactFactory; + + private ArtifactSpec projectArtifact; + + private Source source; + + private static final String GROUP_ID = "test"; + + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + source = new Source(); + artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + artifactCollector = lookup( LegacyArtifactCollector.class ); + + projectArtifact = createArtifactSpec( "project", "1.0", null ); + } + + @Override + protected void tearDown() + throws Exception + { + artifactCollector = null; + artifactFactory = null; + super.tearDown(); + } + + // works, but we don't fail on cycles presently + public void disabledtestCircularDependencyNotIncludingCurrentProject() + throws ArtifactResolutionException, InvalidVersionSpecificationException + { + ArtifactSpec a = createArtifactSpec( "a", "1.0" ); + ArtifactSpec b = a.addDependency( "b", "1.0" ); + b.addDependency( "a", "1.0" ); + try + { + collect( a ); + fail( "Should have failed on cyclic dependency not involving project" ); + } + catch ( CyclicDependencyException expected ) + { + assertTrue( true ); + } + } + + // works, but we don't fail on cycles presently + public void disabledtestCircularDependencyIncludingCurrentProject() + throws ArtifactResolutionException, InvalidVersionSpecificationException + { + ArtifactSpec a = createArtifactSpec( "a", "1.0" ); + ArtifactSpec b = a.addDependency( "b", "1.0" ); + b.addDependency( "project", "1.0" ); + try + { + collect( a ); + fail( "Should have failed on cyclic dependency involving project" ); + } + catch ( CyclicDependencyException expected ) + { + assertTrue( true ); + } + } + + public 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( "Check artifact list", + createSet( new Object[] { a.artifact, b.artifact, c.artifact, d.artifact } ), res.getArtifacts() ); + + ArtifactFilter filter = new ExclusionSetFilter( new String[] { "b" } ); + res = collect( a, filter ); + assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c1.artifact, + f.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "1.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public void disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewest() + 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, e.artifact, c2.artifact, + d.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public void disabledtestResolveCorrectDependenciesWhenDifferentDependenciesOnNewestVersionReplaced() + 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( "Check artifact list", createSet( artifacts ), res.getArtifacts() ); + assertEquals( "Check version", "1.0", getArtifact( "d", res.getArtifacts() ).getVersion() ); + assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ), + res.getArtifacts() ); + assertEquals( "Check version", "3.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ), + res.getArtifacts() ); + assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "3.0", getArtifact( "b", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "3.8.1", getArtifact( "junit", res.getArtifacts() ).getVersion() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "3.8.1", getArtifact( "junit", res.getArtifacts() ).getVersion() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ), + res.getArtifacts() ); + assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, managedB.artifact } ), + res.getArtifacts() ); + assertEquals( "Check version", "5.0", getArtifact( "b", res.getArtifacts() ).getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact } ), + res.getArtifacts() ); + assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public 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() ); + } + + public 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() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() ); + assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() ); + } + + public 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() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, modifiedB } ), res.getArtifacts() ); + } + + public 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( "collect has modified version in originating artifact", "1.0", artifact.getVersion() ); + + Artifact resolvedArtifact = result.getArtifacts().iterator().next(); + + assertEquals( "Resolved version don't match original artifact version", "1.0", resolvedArtifact.getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + // local wins now, and irrelevant if not local as test/provided aren't transitive + // assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getArtifactScope() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + // local wins now, and irrelevant if not local as test/provided aren't transitive + // assertEquals( "Check artifactScope", Artifact.SCOPE_RUNTIME, artifact.getArtifactScope() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, root.artifact, modifiedC } ), + res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + // local wins now, and irrelevant if not local as test/provided aren't transitive + // assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getArtifactScope() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, modifiedC } ), res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + // local wins now, and irrelevant if not local as test/provided aren't transitive + // assertEquals( "Check artifactScope", Artifact.SCOPE_RUNTIME, artifact.getArtifactScope() ); + assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + } + + public 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( "MNG-1895 Dependency was not added to resolution", artifact ); + assertEquals( "Check artifactScope", expectedScope, artifact.getScope() ); + assertEquals( "Check version", expectedVersion, artifact.getVersion() ); + + ArtifactSpec d = createArtifactSpec( "d", "1.0" ); + res = collect( createSet( new Object[] { a.artifact, b.artifact, d.artifact } ), filter ); + artifact = getArtifact( "d", res.getArtifacts() ); + assertNotNull( "MNG-1895 Dependency was not added to resolution", artifact ); + assertEquals( "Check artifactScope", d.artifact.getScope(), artifact.getScope() ); + assertEquals( "Check version", "1.0", artifact.getVersion() ); + } + + public void disabledtestOptionalNotTransitiveButVersionIsInfluential() + 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact, c.artifact, d.artifact, + e.artifact } ), res.getArtifacts() ); + Artifact artifact = getArtifact( "c", res.getArtifacts() ); + assertEquals( "Check version", "3.0", artifact.getVersion() ); + } + + public 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( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() ); + } + + public 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,)" ) ); } + */ + } + + public 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" ); + + try + { + ArtifactResolutionResult res = collect( createSet( new Object[] { a.artifact } ) ); + } + catch ( OverConstrainedVersionException e ) + { + assertTrue( "Versions unordered", e.getMessage().contains( "[3.2.1-v3235e, 3.3.0-v3346]" ) ); + assertTrue( "DependencyTrail unresolved", e.getMessage().contains( "Path to dependency:" ) ); + } + } + + 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.EMPTY_LIST, null ); + } + + private ArtifactResolutionResult collect( ArtifactSpec a ) + throws ArtifactResolutionException + { + return artifactCollector.collect( Collections.singleton( a.artifact ), projectArtifact.artifact, null, null, + null, source, null, Collections.EMPTY_LIST, 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.EMPTY_LIST, 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.EMPTY_LIST, 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; + } + + 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.EMPTY_LIST ); + } + 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 ( Object dependency : dependencies ) + { + Artifact d = (Artifact) dependency; + + 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 = (List) versions.get( key ); + if ( artifactVersions == null ) + { + artifactVersions = new ArrayList(); + versions.put( key, artifactVersions ); + } + 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 = (List) versions.get( artifact.getDependencyConflictId() ); + if ( artifactVersions == null ) + { + artifactVersions = Collections.EMPTY_LIST; + } + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java new file mode 100644 index 00000000..bfab0d26 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java @@ -0,0 +1,143 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; +import org.codehaus.plexus.PlexusTestCase; + +/** + * Provides a basis for testing conflict resolvers. + * + * @author Mark Hobson + */ +public abstract class AbstractConflictResolverTest + extends PlexusTestCase +{ + // constants -------------------------------------------------------------- + + private static final String GROUP_ID = "test"; + + // fields ----------------------------------------------------------------- + + protected Artifact a1; + + protected Artifact a2; + + protected Artifact b1; + + private final String roleHint; + + private ArtifactFactory artifactFactory; + + private ConflictResolver conflictResolver; + + // constructors ----------------------------------------------------------- + + public AbstractConflictResolverTest( String roleHint ) + throws Exception + { + this.roleHint = roleHint; + } + + // TestCase methods ------------------------------------------------------- + + /* + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception + { + super.setUp(); + + artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + conflictResolver = (ConflictResolver) lookup( ConflictResolver.ROLE, roleHint ); + + a1 = createArtifact( "a", "1.0" ); + a2 = createArtifact( "a", "2.0" ); + b1 = createArtifact( "b", "1.0" ); + } + + /* + * @see org.codehaus.plexus.PlexusTestCase#tearDown() + */ + protected void tearDown() throws Exception + { + a1 = null; + a2 = null; + b1 = null; + + artifactFactory = null; + conflictResolver = null; + + super.tearDown(); + } + + // protected methods ------------------------------------------------------ + + protected ConflictResolver getConflictResolver() + { + return conflictResolver; + } + + protected void assertResolveConflict( ResolutionNode expectedNode, ResolutionNode actualNode1, ResolutionNode actualNode2 ) + { + ResolutionNode resolvedNode = getConflictResolver().resolveConflict( actualNode1, actualNode2 ); + + assertNotNull( "Expected resolvable", resolvedNode ); + assertEquals( "Resolution node", expectedNode, resolvedNode ); + } + + protected void assertUnresolvableConflict( ResolutionNode actualNode1, ResolutionNode actualNode2 ) + { + ResolutionNode resolvedNode = getConflictResolver().resolveConflict( actualNode1, actualNode2 ); + + assertNull( "Expected unresolvable", resolvedNode ); + } + + protected Artifact createArtifact( String id, String version ) throws InvalidVersionSpecificationException + { + return createArtifact( id, version, Artifact.SCOPE_COMPILE ); + } + + protected Artifact createArtifact( String id, String version, boolean optional ) + throws InvalidVersionSpecificationException + { + return createArtifact( id, version, Artifact.SCOPE_COMPILE, null, optional ); + } + + 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 ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java new file mode 100644 index 00000000..96e283df --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java @@ -0,0 +1,107 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.FarthestConflictResolver; + +/** + * Tests FarthestConflictResolver. + * + * @author Mark Hobson + * @see FarthestConflictResolver + */ +public 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
    +     * 
    + */ + public void testDepth() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + + assertResolveConflict( a2n, a1n, a2n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * b:1.0 -> a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testDepthReversed() + { + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a2n, a1n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * a:1.0
    +     * a:2.0
    +     * 
    + */ + public void testEqual() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a1n, a2n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testEqualReversed() + { + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a2n, a1n ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java new file mode 100644 index 00000000..0c7b035f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java @@ -0,0 +1,107 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.NearestConflictResolver; + +/** + * Tests NearestConflictResolver. + * + * @author Mark Hobson + * @see NearestConflictResolver + */ +public 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
    +     * 
    + */ + public void testDepth() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + + assertResolveConflict( a1n, a1n, a2n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * b:1.0 -> a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testDepthReversed() + { + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a2n, a1n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * a:1.0
    +     * a:2.0
    +     * 
    + */ + public void testEqual() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a1n, a2n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testEqualReversed() + { + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a2n, a1n ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java new file mode 100644 index 00000000..68d19d6c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java @@ -0,0 +1,107 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.NewestConflictResolver; + +/** + * Tests NewestConflictResolver. + * + * @author Mark Hobson + * @see NewestConflictResolver + */ +public 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
    +     * 
    + */ + public void testDepth() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + + assertResolveConflict( a2n, a1n, a2n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * b:1.0 -> a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testDepthReversed() + { + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a2n, a1n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * a:1.0
    +     * a:2.0
    +     * 
    + */ + public void testEqual() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a1n, a2n ); + } + + /** + * Tests that a:2.0 wins in the scenario: + *
    +     * a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testEqualReversed() + { + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a2n, a2n, a1n ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java new file mode 100644 index 00000000..6b06d34e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java @@ -0,0 +1,107 @@ +package org.apache.maven.repository.legacy.resolver.conflict; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collections; + +import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.repository.legacy.resolver.conflict.OldestConflictResolver; + +/** + * Tests OldestConflictResolver. + * + * @author Mark Hobson + * @see OldestConflictResolver + */ +public 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
    +     * 
    + */ + public void testDepth() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + + assertResolveConflict( a1n, a1n, a2n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * b:1.0 -> a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testDepthReversed() + { + ResolutionNode b1n = new ResolutionNode( b1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST, b1n ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a2n, a1n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * a:1.0
    +     * a:2.0
    +     * 
    + */ + public void testEqual() + { + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a1n, a2n ); + } + + /** + * Tests that a:1.0 wins in the scenario: + *
    +     * a:2.0
    +     * a:1.0
    +     * 
    + */ + public void testEqualReversed() + { + ResolutionNode a2n = new ResolutionNode( a2, Collections.EMPTY_LIST ); + ResolutionNode a1n = new ResolutionNode( a1, Collections.EMPTY_LIST ); + + assertResolveConflict( a1n, a2n, a1n ); + } +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java new file mode 100644 index 00000000..4f40516c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java @@ -0,0 +1,120 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; +import org.apache.maven.repository.metadata.ArtifactMetadata; +import org.apache.maven.repository.metadata.ClasspathContainer; +import org.apache.maven.repository.metadata.ClasspathTransformation; +import org.apache.maven.repository.metadata.MetadataGraph; +import org.apache.maven.repository.metadata.MetadataGraphEdge; +import org.apache.maven.repository.metadata.MetadataGraphVertex; +import org.codehaus.plexus.PlexusTestCase; + +/** + * + * @author Oleg Gusakov + * + */ + +public class DefaultClasspathTransformationTest +extends PlexusTestCase +{ + ClasspathTransformation transform; + + MetadataGraph graph; + + MetadataGraphVertex v1; + MetadataGraphVertex v2; + MetadataGraphVertex v3; + MetadataGraphVertex v4; + //------------------------------------------------------------------------------------------ + @Override + protected void setUp() throws Exception + { + super.setUp(); + transform = (ClasspathTransformation) lookup( ClasspathTransformation.ROLE, "default" ); + + 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 ) ); + } + //------------------------------------------------------------------------------------------ + public void testCompileClasspathTransform() + throws Exception + { + ClasspathContainer res; + + res = transform.transform( graph, ArtifactScopeEnum.compile, false ); + + assertNotNull("null classpath container after compile transform", res ); + assertNotNull("null classpath after compile transform", res.getClasspath() ); + assertEquals("compile classpath should have 3 entries", 3, res.getClasspath().size() ); + } + //------------------------------------------------------------------------------------------ + public void testRuntimeClasspathTransform() + throws Exception + { + ClasspathContainer res; + + res = transform.transform( graph, ArtifactScopeEnum.runtime, false ); + + assertNotNull("null classpath container after runtime transform", res ); + assertNotNull("null classpath after runtime transform", res.getClasspath() ); + assertEquals("runtime classpath should have 4 entries", 4, res.getClasspath().size() ); + + ArtifactMetadata md = res.getClasspath().get(3); + assertEquals("runtime artifact version should be 1.1", "1.1", md.getVersion() ); + } + //------------------------------------------------------------------------------------------ + public void testTestClasspathTransform() + throws Exception + { + ClasspathContainer res; + + res = transform.transform( graph, ArtifactScopeEnum.test, false ); + + assertNotNull("null classpath container after runtime transform", res ); + assertNotNull("null classpath after runtime transform", res.getClasspath() ); + assertEquals("runtime classpath should have 4 entries", 4, res.getClasspath().size() ); + + ArtifactMetadata md = res.getClasspath().get(3); + assertEquals("test artifact version should be 1.2", "1.2", md.getVersion() ); + } + //------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java new file mode 100644 index 00000000..31832c33 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java @@ -0,0 +1,59 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.repository.metadata.GraphConflictResolutionPolicy; +import org.apache.maven.repository.metadata.MetadataGraphEdge; +import org.codehaus.plexus.PlexusTestCase; + +/** + * + * @author Oleg Gusakov + * + */ + +public class DefaultGraphConflictResolutionPolicyTest +extends PlexusTestCase +{ + GraphConflictResolutionPolicy policy; + MetadataGraphEdge e1; + MetadataGraphEdge e2; + MetadataGraphEdge e3; + //------------------------------------------------------------------------------------------ + @Override + protected void setUp() throws Exception + { + super.setUp(); + policy = (GraphConflictResolutionPolicy) lookup( GraphConflictResolutionPolicy.ROLE, "default" ); + 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 ); + } + //------------------------------------------------------------------------------------------ + public void testDefaultPolicy() + throws Exception + { + MetadataGraphEdge res; + + res = policy.apply( e1, e2 ); + assertEquals( "Wrong depth edge selected", "1.1", res.getVersion() ); + + res = policy.apply( e1, e3 ); + assertEquals( "Wrong version edge selected", "1.2", res.getVersion() ); + } + //------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java new file mode 100644 index 00000000..4fba8f54 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java @@ -0,0 +1,153 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.artifact.ArtifactScopeEnum; +import org.apache.maven.repository.metadata.ArtifactMetadata; +import org.apache.maven.repository.metadata.GraphConflictResolver; +import org.apache.maven.repository.metadata.MetadataGraph; +import org.apache.maven.repository.metadata.MetadataGraphEdge; +import org.apache.maven.repository.metadata.MetadataGraphVertex; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.logging.Logger; + +/** + * + * @author Oleg Gusakov + * + */ + +public class DefaultGraphConflictResolverTest +extends PlexusTestCase +{ + Logger log; + + GraphConflictResolver resolver; + + MetadataGraph graph; + + MetadataGraphVertex v1; + MetadataGraphVertex v2; + MetadataGraphVertex v3; + MetadataGraphVertex v4; + //------------------------------------------------------------------------------------------ + @Override + protected void setUp() throws Exception + { + super.setUp(); + resolver = (GraphConflictResolver) lookup( GraphConflictResolver.ROLE, "default" ); + + /* + * 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 ) ); + } + //------------------------------------------------------------------------------------------ + public void testCompileResolution() + throws Exception + { + MetadataGraph res; + + res = resolver.resolveConflicts( graph, ArtifactScopeEnum.compile ); + + assertNotNull("null graph after resolver", res ); + assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() ); + + assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) ); + + assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() ); + assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() ); + + assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() ); + assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() ); + + assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() ); + assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() ); + + assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() ); + assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v4).get(0).getVersion() ); + } + //------------------------------------------------------------------------------------------ + public void testRuntimeResolution() + throws Exception + { + MetadataGraph res; + + res = resolver.resolveConflicts( graph, ArtifactScopeEnum.runtime ); + + assertNotNull("null graph after resolver", res ); + assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() ); + assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) ); + + assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() ); + assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() ); + + assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() ); + assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() ); + + assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() ); + assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() ); + + assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() ); + assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v4).get(0).getVersion() ); + } + //------------------------------------------------------------------------------------------ + public void testTestResolution() + throws Exception + { + MetadataGraph res; + + res = resolver.resolveConflicts( graph, ArtifactScopeEnum.test ); + + assertNotNull("null graph after resolver", res ); + assertNotNull("no vertices in the resulting graph after resolver", res.getVertices() ); + assertNotNull("no edges in the resulting graph after resolver", res.getExcidentEdges(v1) ); + + assertEquals( "wrong # of vertices in the resulting graph after resolver", 4, res.getVertices().size() ); + assertEquals( "wrong # of excident edges in the resulting graph entry after resolver", 2, res.getExcidentEdges(v1).size() ); + + assertEquals( "wrong # of v2 incident edges in the resulting graph after resolver", 1, res.getIncidentEdges(v2).size() ); + assertEquals( "wrong edge v1-v2 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v2).get(0).getVersion() ); + + assertEquals( "wrong # of edges v1-v3 in the resulting graph after resolver", 1, res.getIncidentEdges(v3).size() ); + assertEquals( "wrong edge v1-v3 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v3).get(0).getVersion() ); + + assertEquals( "wrong # of edges v3-v4 in the resulting graph after resolver", 1, res.getIncidentEdges(v4).size() ); + assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v4).get(0).getVersion() ); + } + //------------------------------------------------------------------------------------------ + //------------------------------------------------------------------------------------------ +} diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java new file mode 100644 index 00000000..dd9a9001 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java @@ -0,0 +1,99 @@ +package org.apache.maven.repository.metadata; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.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; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; + +@Component(role = ArtifactMetadataSource.class) +public class TestMetadataSource + implements ArtifactMetadataSource +{ + @Requirement + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar new file mode 100644 index 00000000..609ec21b Binary files /dev/null and b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.jar differ diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.pom new file mode 100644 index 00000000..f4514188 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/0.1/a-0.1.pom @@ -0,0 +1,41 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml new file mode 100644 index 00000000..8099175e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/a/maven-metadata.xml @@ -0,0 +1,12 @@ + + + org.apache.maven.its + a + 0.1 + + + 0.1 + + 20091023222756 + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar new file mode 100644 index 00000000..19df0485 Binary files /dev/null and b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.jar differ diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.pom new file mode 100644 index 00000000..ca20cbf5 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/0.1/b-0.1.pom @@ -0,0 +1,49 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml new file mode 100644 index 00000000..e77af628 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/remote-repo/org/apache/maven/its/b/maven-metadata.xml @@ -0,0 +1,12 @@ + + + org.apache.maven.its + b + 0.1 + + + 0.1 + + 20091023222817 + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/repository-system/maven-core-2.1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/repository-system/maven-core-2.1.0.jar new file mode 100644 index 00000000..e69de29b diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar new file mode 100644 index 00000000..421376db --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/artifact-install/artifact-1.0.jar @@ -0,0 +1 @@ +dummy diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom new file mode 100644 index 00000000..92c9f41d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p0-1.0.pom @@ -0,0 +1,11 @@ + + 4.0.0 + maven + p0 + pom + p0 + 1.0 + + Codehaus + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom new file mode 100644 index 00000000..6038a806 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p1-1.0.pom @@ -0,0 +1,16 @@ + + + p0 + maven + 1.0 + + 4.0.0 + maven + p1 + pom + p1 + 1.0 + + scm-url + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom new file mode 100644 index 00000000..9ac112ac --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p2-1.0.pom @@ -0,0 +1,18 @@ + + + p1 + maven + 1.0 + + 4.0.0 + maven + p2 + pom + p2 + 1.0 + + + mailing-list + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom new file mode 100644 index 00000000..d40684e9 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p3-1.0.pom @@ -0,0 +1,14 @@ + + + p2 + maven + 1.0 + + 4.0.0 + maven + p3 + pom + p3 + 1.0 + 2000 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom new file mode 100644 index 00000000..dc9a2735 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t00/maven/poms/p4-1.0.pom @@ -0,0 +1,13 @@ + + + p3 + maven + 1.0 + + 4.0.0 + maven + p4 + jar + p4 + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom new file mode 100644 index 00000000..9df2582d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p0-1.0.pom @@ -0,0 +1,11 @@ + + 4.0.0 + maven.t01 + p0 + pom + p0 + 1.0 + + p0-org + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom new file mode 100644 index 00000000..4fc81d83 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p1-1.0.pom @@ -0,0 +1,16 @@ + + + p0 + maven.t01 + 1.0 + + 4.0.0 + maven.t01 + p1 + pom + p1 + 1.0 + + p1-org + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom new file mode 100644 index 00000000..8032cf2f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p2-1.0.pom @@ -0,0 +1,16 @@ + + + p1 + maven.t01 + 1.0 + + 4.0.0 + maven.t01 + p2 + pom + p2 + 1.0 + + p2-org + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom new file mode 100644 index 00000000..6ed58569 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p3-1.0.pom @@ -0,0 +1,16 @@ + + + p2 + maven.t01 + 1.0 + + 4.0.0 + maven.t01 + p3 + pom + p3 + 1.0 + + p3-org + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom new file mode 100644 index 00000000..1739333a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t01/maven.t01/poms/p4-1.0.pom @@ -0,0 +1,16 @@ + + + p3 + maven.t01 + 1.0 + + 4.0.0 + maven.t01 + p4 + jar + p4 + 1.0 + + p4-org + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml new file mode 100644 index 00000000..93d1d72f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/p5/pom.xml @@ -0,0 +1,32 @@ + + + + + p4 + maven.t02 + 1.0 + + 4.0.0 + maven.t02 + p5 + jar + p5 + 1.0 + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml new file mode 100644 index 00000000..77958f78 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/p4/pom.xml @@ -0,0 +1,32 @@ + + + + + p3 + maven.t02 + 1.0 + + 4.0.0 + maven.t02 + p4 + pom + p4 + 1.0 + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml new file mode 100644 index 00000000..d83de976 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/p3/pom.xml @@ -0,0 +1,33 @@ + + + + + p2 + maven.t02 + 1.0 + + 4.0.0 + maven.t02 + p3 + pom + p3 + 1.0 + 2000 + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml new file mode 100644 index 00000000..c2b7d715 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/p2/pom.xml @@ -0,0 +1,37 @@ + + + + + p1 + maven.t02 + 1.0 + + 4.0.0 + maven.t02 + p2 + pom + p2 + 1.0 + + + mailing-list + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml new file mode 100644 index 00000000..af2d92ed --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/p1/pom.xml @@ -0,0 +1,51 @@ + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml new file mode 100644 index 00000000..3643fe49 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t02/p0/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + maven.t02 + p0 + pom + p0 + 1.0 + + Codehaus + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml new file mode 100644 index 00000000..69fe6a1d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/p1/pom.xml @@ -0,0 +1,45 @@ + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml new file mode 100644 index 00000000..476ffdfb --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t03/p0/pom.xml @@ -0,0 +1,30 @@ + + + + 4.0.0 + maven.t03 + p0 + pom + p0 + 1.0 + + Codehaus + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-b-2.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/jars/t04-c-2.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom new file mode 100644 index 00000000..5ca34c3a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-a-1.0.pom @@ -0,0 +1,21 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom new file mode 100644 index 00000000..4c311ab1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t04-b + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom new file mode 100644 index 00000000..d24e3bc1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-b-2.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t04-b + jar + 2.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom new file mode 100644 index 00000000..bef2488b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t04-c + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom new file mode 100644 index 00000000..d24e3bc1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/maven-test/poms/t04-c-2.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t04-b + jar + 2.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml new file mode 100644 index 00000000..c25fc3e7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/p1/pom.xml @@ -0,0 +1,41 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml new file mode 100644 index 00000000..1b02dc2c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t04/p0/pom.xml @@ -0,0 +1,37 @@ + + 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 + + + + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-a-2.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-b-2.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/jars/t05-d-1.2.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom new file mode 100644 index 00000000..a1b8cb9b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom new file mode 100644 index 00000000..097101e8 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-a-2.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom new file mode 100644 index 00000000..e0490ff7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom new file mode 100644 index 00000000..ff59f5d2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-1.1.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom new file mode 100644 index 00000000..79370ec4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-b-2.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom new file mode 100644 index 00000000..0edc3ddd --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-c-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom new file mode 100644 index 00000000..9290b033 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t05-d + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom new file mode 100644 index 00000000..b4af4b2c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.1.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t05-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom new file mode 100644 index 00000000..09e1d947 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/maven-test/poms/t05-d-1.2.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t05-d + jar + 1.2 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml new file mode 100644 index 00000000..d9c2d52b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/p1/pom.xml @@ -0,0 +1,54 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml new file mode 100644 index 00000000..6c93838b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t05/p0/pom.xml @@ -0,0 +1,36 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-b-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/jars/t06-d-1.2.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom new file mode 100644 index 00000000..21aa5f55 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-a-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom new file mode 100644 index 00000000..a9af131c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom new file mode 100644 index 00000000..a9af131c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-b-1.1.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom new file mode 100644 index 00000000..80272114 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-c-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom new file mode 100644 index 00000000..e4531ab4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t06-d + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom new file mode 100644 index 00000000..c146cb89 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.1.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t06-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom new file mode 100644 index 00000000..ff91f975 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/maven-test/poms/t06-d-1.2.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t06-d + jar + 1.2 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml new file mode 100644 index 00000000..46862190 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/p1/pom.xml @@ -0,0 +1,54 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml new file mode 100644 index 00000000..60c540ca --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t06/p0/pom.xml @@ -0,0 +1,37 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-b-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/jars/t07-d-1.2.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom new file mode 100644 index 00000000..05665a9c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-a-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom new file mode 100644 index 00000000..8ce6751c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom new file mode 100644 index 00000000..689ad055 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-b-1.1.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom new file mode 100644 index 00000000..494470c4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-c-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom new file mode 100644 index 00000000..5761d515 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t07-d + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom new file mode 100644 index 00000000..08fc179c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.1.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t07-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom new file mode 100644 index 00000000..544ccc59 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/maven-test/poms/t07-d-1.2.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t07-d + jar + 1.2 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml new file mode 100644 index 00000000..6f700429 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/p1/pom.xml @@ -0,0 +1,54 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml new file mode 100644 index 00000000..b500ee0e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t07/p0/pom.xml @@ -0,0 +1,37 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-b-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.1.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/jars/t08-d-1.2.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom new file mode 100644 index 00000000..186c2d89 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-a-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom new file mode 100644 index 00000000..d866ab35 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom new file mode 100644 index 00000000..d402466e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-b-1.1.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom new file mode 100644 index 00000000..d8250528 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-c-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom new file mode 100644 index 00000000..f4530458 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t08-d + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom new file mode 100644 index 00000000..c7703b02 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.1.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t08-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom new file mode 100644 index 00000000..e341be53 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/maven-test/poms/t08-d-1.2.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t08-d + jar + 1.2 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml new file mode 100644 index 00000000..331996d8 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/p1/pom.xml @@ -0,0 +1,59 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml new file mode 100644 index 00000000..a18ab853 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t08/p0/pom.xml @@ -0,0 +1,37 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/jars/t09-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom new file mode 100644 index 00000000..54cf647b --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-a-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom new file mode 100644 index 00000000..ce001c2f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-b-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom new file mode 100644 index 00000000..da7bc349 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-c-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t09-c + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom new file mode 100644 index 00000000..86227472 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/maven-test/poms/t09-d-1.0.pom @@ -0,0 +1,17 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml new file mode 100644 index 00000000..ae435843 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p1/pom.xml @@ -0,0 +1,36 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml new file mode 100644 index 00000000..4681c2ef --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/p2/pom.xml @@ -0,0 +1,42 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml new file mode 100644 index 00000000..a93746d2 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t09/p0/pom.xml @@ -0,0 +1,38 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/jars/t10-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom new file mode 100644 index 00000000..1fc2a221 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-a-1.0.pom @@ -0,0 +1,24 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom new file mode 100644 index 00000000..64b5f97a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-b-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t10-b + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom new file mode 100644 index 00000000..6548ab30 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/maven-test/poms/t10-c-1.0.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + t10-c + jar + 1.0 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml new file mode 100644 index 00000000..ed82ae13 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/p1/pom.xml @@ -0,0 +1,42 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml new file mode 100644 index 00000000..853af40d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t10/p0/pom.xml @@ -0,0 +1,41 @@ + + 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 + + + + + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml new file mode 100644 index 00000000..e4c79be4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/p1/pom.xml @@ -0,0 +1,16 @@ + + + p0 + maven + 1.0 + + 4.0.0 + maven + p1 + jar + p1 + 1.0 + + scm-url + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml new file mode 100644 index 00000000..23b07e2c --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t11/p0/pom.xml @@ -0,0 +1,27 @@ + + 4.0.0 + maven + p0 + pom + p0 + 1.0 + + Codehaus + + + + + + + + maven + p1 + 1.0 + test + + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml new file mode 100644 index 00000000..15115cb8 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/p1/pom.xml @@ -0,0 +1,29 @@ + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml new file mode 100644 index 00000000..4f2e6426 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12/p0/pom.xml @@ -0,0 +1,30 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom new file mode 100644 index 00000000..97bf7ccc --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p0/1.0/p0-1.0.pom @@ -0,0 +1,18 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom new file mode 100644 index 00000000..e9ddf0d7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/maven/p1/1.0/p1-1.0.pom @@ -0,0 +1,11 @@ + + + p0 + maven + 1.0 + ../../pom.xml + + 4.0.0 + p1 + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml new file mode 100644 index 00000000..736b5153 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/modules/p1/pom.xml @@ -0,0 +1,11 @@ + + + p0 + maven + 1.0 + ../../pom.xml + + 4.0.0 + p1 + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml new file mode 100644 index 00000000..a22df68e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/inheritance-repo/t12scm/p0/pom.xml @@ -0,0 +1,18 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/marker.txt b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/marker.txt new file mode 100644 index 00000000..d9bab060 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/marker.txt @@ -0,0 +1 @@ +this is just a marker file. \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-a-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-b-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-c-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar new file mode 100644 index 00000000..257cc564 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/jars/maven-test-d-1.0.jar @@ -0,0 +1 @@ +foo diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom new file mode 100644 index 00000000..6905f6c8 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-a-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom new file mode 100644 index 00000000..e814951a --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-b-1.0.pom @@ -0,0 +1,23 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom new file mode 100644 index 00000000..4631b88f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-c-1.0.pom @@ -0,0 +1,16 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom new file mode 100644 index 00000000..6e22f608 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.1.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + maven-test-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom new file mode 100644 index 00000000..6e22f608 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/maven-test/poms/maven-test-d-1.2.pom @@ -0,0 +1,7 @@ + + 4.0.0 + maven-test + maven-test-d + jar + 1.1 + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar new file mode 100644 index 00000000..c2c027fe --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar @@ -0,0 +1 @@ +local \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version new file mode 100644 index 00000000..09f9180f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-a-1.0-SNAPSHOT.jar.snapshot-version @@ -0,0 +1 @@ +20040101.101010 \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar new file mode 100644 index 00000000..c2c027fe --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar @@ -0,0 +1 @@ +local \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version new file mode 100644 index 00000000..09f9180f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-b-1.0-SNAPSHOT.jar.snapshot-version @@ -0,0 +1 @@ +20040101.101010 \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar new file mode 100644 index 00000000..c2c027fe --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar @@ -0,0 +1 @@ +local \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version new file mode 100644 index 00000000..09f9180f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/jars/maven-snapshot-e-1.0-SNAPSHOT.jar.snapshot-version @@ -0,0 +1 @@ +20040101.101010 \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom new file mode 100644 index 00000000..64a075f4 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/local-repo/snapshot-test/poms/maven-test-snapshot-resolving-1.0.pom @@ -0,0 +1,49 @@ + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml new file mode 100644 index 00000000..f7c381fe --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/deployer/ArtifactDeployerTest.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml new file mode 100644 index 00000000..f7c381fe --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/installer/ArtifactInstallerTest.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml new file mode 100644 index 00000000..925022ef --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/manager/DefaultWagonManagerTest.xml @@ -0,0 +1,48 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml new file mode 100644 index 00000000..2b950859 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactResolverTest.xml @@ -0,0 +1,71 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml new file mode 100644 index 00000000..b434d7b9 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/artifact/resolver/ArtifactUpdatePolicyTest.xml @@ -0,0 +1,29 @@ + + + + + + org.apache.maven.wagon.Wagon + testfile + org.apache.maven.artifact.resolver.TestFileWagon + per-lookup + + + \ No newline at end of file diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/project/AbstractMavenProjectTestCase.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/project/AbstractMavenProjectTestCase.xml new file mode 100644 index 00000000..bcc291e1 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/org/apache/maven/project/AbstractMavenProjectTestCase.xml @@ -0,0 +1,9 @@ + + + + + org.apache.maven.lifecycle.LifeCyclePluginAnalyzer + org.apache.maven.project.EmptyLifecyclePluginAnalyzer + + + diff --git a/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/pom.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/pom.xml new file mode 100644 index 00000000..9443d87d --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/pom.xml @@ -0,0 +1,155 @@ + + + + + + 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 + 2.5.1 + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml new file mode 100644 index 00000000..c7062501 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/project-with-scoped-dependencies.xml @@ -0,0 +1,99 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml new file mode 100644 index 00000000..1161c698 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-compile-dep.xml @@ -0,0 +1,57 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml new file mode 100644 index 00000000..c904be0e --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-default-dep.xml @@ -0,0 +1,58 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml new file mode 100644 index 00000000..b85669ce --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-provided-dep.xml @@ -0,0 +1,57 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml new file mode 100644 index 00000000..921723c7 --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-runtime-dep.xml @@ -0,0 +1,58 @@ + + + + + + 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/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml new file mode 100644 index 00000000..ea2dde9f --- /dev/null +++ b/framework/src/maven/apache-maven-3.3.3/maven-compat/src/test/resources/projects/scope/transitive-test-dep.xml @@ -0,0 +1,58 @@ + + + + + + 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 + + + + + -- cgit 1.2.3-korg